# $C^1$ function on compact set is Lipschitz

Let $\emptyset\ne A\subset\mathbb{R}^n$ be open and let $f \in C^1 (A, \mathbb{R})$ be a function. Let $\emptyset\ne K\subset A$ be compact and convex. I want to prove that $f$ is Lipschitz on $K$; that is, prove there exists a constant $c > 0$ such that $| f ( x ) - f( y ) | \leq c \, \| x - y \|, \forall x , y \in K$.

My approach:

Let $x,y\in K$ be two arbitrary points. Then, since $K$ is convex, the line segment between $x$ and $y$, i.e. $Co(x,y)$, is in $K$. Thus, by MVT, there exists a vector $b\in Co(x,y)$ such that

$$\text{(*) } |f(x)-f(y)|=|\langle x-y, (\nabla f)(b)\rangle|\le \|x-y\|\|(\nabla f)(b)\|$$

Now, since $K$ is compact, $f$ takes a maximum and a minimum values on $K$, so that $\exists b'\in K$ such that $\|(\nabla f)(b') \|\ge \|(\nabla f)(b) \|$, for all $b\in K$. Let $c\in \mathbb{R}$, $c:=(\nabla f)(b')$, then

$$|f(x)-f(y)|\le\|x-y\|\|(\nabla f)(b)\|\le\|x-y\|\|(\nabla f)(b')\|=c\|x-y\|$$

This implies that $f$ is Lipschitz on $K$ for all $x,y\in K$.

Please let me know if you think my proof is correct or not very much? I'm somewhat concerned about the part with the gradient - how exactly is the maximality of the norm of the gradient related to the EVT, that is to $f$ taking maximum and minimum values? As far as I can tell, the maximum norm of the gradient exists because that is the direction to the maximum (or minimum) point of $f$.

• What is $a$? It seems undefined to me . . . – Robert Lewis Jun 28 '17 at 0:24
• Sorry, it was supposed to be $y$. Fixed. – sequence Jun 28 '17 at 0:26
• I guess is because $||f'||$ is a real function on a compact set? – Li Chun Min Jun 28 '17 at 0:41
• @LiChunMin Can you please clarify your question? – sequence Jun 28 '17 at 0:47
• Looks good to me. You do not need the EVT. Since $\nabla (f)$ is continuous, the real-valued function $\|\nabla (f)\|$ is continuous .So $T=\{\| \nabla f(x)\|: x\in K\}$ is compact (because $K$ is compact) , so $T$ is a bounded real subset....So $\|f(x)-f(y)\|\leq \|x-y\|\cdot \sup T$ for all $x,y\in K$. – DanielWainfleet Jun 28 '17 at 2:48

Here's how I would do it:

for $x, y \in K$, let $\gamma(t):[0, 1] \to K$ be the line segment

$\gamma(t) = x + t(y - x); \tag{1}$

then

$\gamma(0) = x, \tag{2}$

$\gamma(1) = x +(y - x) = y, \tag{3}$

and

$\gamma'(t) = y - x; \tag{4}$

furthermore, since $K$ is convex, $\gamma(t)$ lies entirely within $K$, hence also in $A$.

Now, for $x, y \in K$, we have:

$\Vert f(y) - f(x) \Vert = \Vert \displaystyle \int_0^1 \dfrac{d(f(\gamma(t))}{dt}dt \Vert = \Vert \displaystyle \int_0^1 \nabla f(\gamma(t)) \cdot \gamma'(t) dt \Vert$ $\le \displaystyle \int_0^1 \Vert \nabla f(\gamma(t)) \cdot \gamma'(t) \Vert dt \le \displaystyle \int_0^1 \Vert \nabla f(\gamma(t)) \Vert \Vert \gamma'(t) \Vert dt.\tag{5}$

Since $K$ is compact and $\nabla f \in C^0(A, \Bbb R)$, so hence $\nabla f \in C^0(K, \Bbb R)$, $\Vert \nabla f \Vert$ is bounded by some $B$ on $K$, hence

$\displaystyle \int_0^1 \Vert \nabla f(\gamma(t)) \Vert \Vert \gamma'(t) \Vert dt \le \displaystyle \int_0^1 B \Vert \gamma'(t) \Vert dt; \tag{6}$

using (4),

$\displaystyle \int_0^1 B \Vert \gamma'(t) \Vert dt = \displaystyle \int_0^1 B \Vert y - x \Vert dt = B \Vert y - x \Vert; \tag{7}$

bringing together (5), (6), and (7) yields

$\Vert f(y) - f(x) \Vert \le B \Vert y - x \Vert, \tag{8}$

that is, $f(x)$ is Lipschitz continuous on $K$.

• Thank you, this is very elegant. Do you think my proof could possibly be correct? – sequence Jun 28 '17 at 1:32
• Yes, your method seems fine. Note it agrees with mine. – Robert Lewis Jun 28 '17 at 1:39
• "Since $K$ is compact and $\nabla f \in C^0(A, \Bbb R)$, so hence $\nabla f \in C^0(K, \Bbb R)$, $\Vert \nabla f \Vert$ is bounded by some $B$ on $K$.." Is there a proof for that or is it trivial? – abuchay May 14 '18 at 14:25
• @abuchay: Well, $\nabla f \in C^0(K)$ since $\nabla f \in C^0(A)$ and $K \subset A$. $\Vert \nabla f \Vert \in C^0(K)$ since $\Vert \cdot \Vert$ is itself continuous in its argument. Then the boundedness follows since continuous functions on compacta are bounded, which is standard result in elementary topology. – Robert Lewis May 14 '18 at 15:40

The convexity of $K$ is not needed. Suppose the conclusion fails. Then for each $m\in \mathbb N,$ there exist $y_m,x_m \in K$ such that

$$\tag 1 |f(y_m)- f(x_m)| > m|y_m-x_m|.$$

Because $K$ is compact, we can find a subsequence $m_k$ such that the sequences $y_{m_k},x_{m_k}$ converge to points $y,x\in K$ respectively.

Suppose $y\ne x.$ Then $|y-x| > 0.$ For large $k$ we then have

$$|f(y_{m_k})- f(x_{m_k})| > m_k|y_{m_k}-x_{m_k}|> m_k(|y-x|/2)\to \infty$$

This implies $f$ is not bounded on $K.$ But $f$ is continuous on $A,$ hence is continuous on $K,$ hence $f$ is bounded on $K$ by compactness. This contradiction shows $y=x.$

Because $A$ is open we can choose $r>0$ such that $B(x,r)\subset A.$ For large $k$ we then have $y_{m_k},x_{m_k}$ in the compact convex set $\overline {B(x,r/2}) \subset A.$ By $(1),$ your highlighted mean value inequality then fails in this last set, contradiction. Therefore $(1)$ cannot hold, proving the result.

• I dont understand why $m_k(|y-x|/2)\to \infty$. Why does it tend to infinity? If $m_k$ is a subsequence of $y_{mk}$ then $m_k$ also converges to $y$. Then, how can $m_k$ be a subsequence of $x_{mk}$ too? – John Keeper Oct 24 '18 at 9:46
• @JohnKeeper $m_k$ is a subsequence of $1,2,\dots$ hence $\to \infty$ – zhw. Oct 24 '18 at 21:32


Here's a cute puzzle.

Player A tosses a coin indefinitely and stops when he encounters a consecutive sequence of HT. Player B plays a similar game, except he stops when he encounters HH consecutively. Is the expected number of tosses equal for both players? If not, who has more, and can you give an intuitive explanation why?

Note by C Lim
4 years, 8 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

I think that player A is expected to be finished earlier. If he encounters an H, then he would have to keep tossing H's in order to continue. The chance of throwing $$n$$ consecutive H's decreases rapidly as $$n$$ increases.

If player B encounters an H, then he will have to toss a T to continue, but after tossing a T, he will continue tossing, because no matter what he tosses next, he doesn't encounter HH.

So, player A is doomed so to say whenever he tosses an H, because he'll have to keep tossing H's in order to continue. That's why he is expected to stop earlier than player B. I hope that makes sense.

- 4 years, 8 months ago

Yup that's correct! It would also be interesting to explicitly calculate the expected number of throws for both A and B.

- 4 years, 8 months ago

Player A is expected to throw his first H after $$2$$ tosses, because

$1 \cdot \frac{1}{2} + 2 \cdot \frac{1}{4} + 3 \cdot \frac{1}{8} + 4 \cdot \frac{1}{16} + 5 \cdot \frac{1}{32} + \dots = 2.$

Similarly, after having tossed his first H, player A is expected to throw his first T (and thus stopping) after another 2 tosses. So (hopefully) I can conclude that player H is expected to toss 4 times.

Player B is expected to roll his first H in two tosses. Then, there is a chance of 50% that he stops after the third toss, i.e. after tossing H again. However, if he tosses a T, then again, he is expected to toss his second H in two tosses, after which there is a 50% chance that he stops after the toss after that. It goes on and on. So, the amount of tosses player B is expected to do is

$3 \cdot \frac{1}{2} + 6 \cdot \frac{1}{4} + 9 \cdot \frac{1}{8} + 12 \cdot \frac{1}{16} + 15 \cdot \frac{1}{32} + \dots = 3 \cdot 2 = 6.$

And $$6 > 4$$.

I hope that what I did is allowed, I'm not completely convinced of that just yet. Could anyone confirm that what I did is correct (or show me what I've done wrong)?

- 4 years, 8 months ago

I'm not sure what you did is ok either, but your answer is correct! [ This suggests there's probably a way to rigourously justify your working. ]

Here's how I'd do it. To compute the expected number of tosses for HH, we define two values:

• let a = expected number of additional tosses, assuming previous was 'H';
• let b = expected number of additional tosses, assuming previous was 'T'.

Then $$a = \frac{b+1} 2 + \frac 1 2$$ since if the previous toss was 'H', there's a 50% chance the next is 'T' (in which case the expected number of tosses is b+1), and a 50% chance the next is 'H' (in which case the number of tosses is 1 since it ends).

Likewise, $$b = \frac{a+1} 2 + \frac{b+1}2$$ since if the previous toss was 'T', there's a 50% chance the next is 'H' (in which case expected number of tosses is a+1), and a 50% chance the next is 'T' (and the expected number of tosses is b+1).

Solving then gives us a=4, b=6. The expected number of tosses is then b=6, since we can assume the 0-th toss was 'T' with no loss of generality.

The equations for HT are similar:

$a = \frac {a+1} 2 + \frac 1 2, \quad b = \frac{a+1}2 + \frac{b+1} 2$

which gives us a=2, b=4.

[ P.S. To be pedantic, my working isn't 100% rigourous either, since it already assumes a, b are finite. ]

- 4 years, 8 months ago

That's really great. Two completely different ways of solving the problem :) I wouldn't know how to prove that $$a,b$$ are finite though.

- 4 years, 8 months ago

If you want a finiteness proof, use first principles. Let $$N_A$$ be the number of tosses until $$A$$ stops. The probability $$P[N_A>n]$$ is the probability that $$A$$ has not thrown HT in the first $$n$$ tosses. This can only happen if $$A$$ has thrown $$j$$ tails followed by $$n-j$$ heads, for some $$0 \le j \le n$$. Thus there are $$n+1$$ possible sequences, all equally likely, and so $P[N_A > n] = (n+1)2^{-n}$ Thus $P[N_A \ge n] \;=\; P[N_A > n-1] \; = \; n2^{1-n}$ Normal probability and series summation tricks give us $E[N_A] \;=\; \sum_{n=1}^\infty P[N_A \ge n] \; = \; \sum_{n=1}^\infty n2^{1-n} \; = \; 4$ The result for $$B$$ is a little more challenging. Let $$N_B$$ be the number of tosses until $$B$$ stops. The probability that $$N_B > n$$ is the probability that $$B$$ does not throw HH in the first $$n$$ tosses. This is the probability that the first $$n$$ tosses are made up of "HT"s and "T"s stuck together, plus the probability that the first $$n-1$$ tosses are made up of "HT"s and "T"s stuck together, followed by a single "H".

It is well-known that the number of ways of tiling a $$n\times1$$ chess-board using just $$2\times1$$ dominoes and $$1\times1$$ squares is the Fibonacci number $$F_{n+1}$$. (Just to be definite, $$F_0=0$$, $$F_1=1$$, etc.) Thus the probability that $$N_B > n$$ is the sum of the probabilities $$F_{n+1}2^{-n}$$ and $$F_n2^{-n}$$, and hence $P[N_B > n] \; = \; \frac{F_{n+2}}{2^n}$ and hence $P[N_B \ge n] \; = \; P[N_B > n-1] \; = \; \frac{F_{n+1}}{2^{n-1}} \qquad n \ge 1.$ Thus $E[N_B] \; = \; \sum_{n=1}^\infty P[N_B \ge n] \; = \; \sum_{n=1}^\infty \tfrac{F_{n+1}}{2^{n-1}} \; = \; 4G(0.5) - 2$ where $G(x) \;=\; \sum_{n=0}^\infty F_nx^n$ is the generating function of the Fibonacci numbers. It is well-known that $G(x) \; = \; \frac{x}{1-x-x^2}$ so that $$G(0.5) = 2$$. Thus $$E[N_B] = 6$$.

- 4 years, 8 months ago

Of course, once you showed that the number of ways is $$F_{n+2}$$, you can use the ratio test to conclude that the sum is finite, which is all we needed.

Nice way of calculating the sum through generating functions.

Staff - 4 years, 8 months ago

In a similar vein, check out High school math #8.

Staff - 4 years, 8 months ago

The absorbing Markov chain also gets the same answer.

This is the markov chain for ending the game with HH, for player B. I is the initial state, and the probabilities of moving to different states are shown:

$$\left(\begin{array}{cccccccc} & I & H & T & HT & TH & TT & HH \\ I & 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 & 0 \\ H & 0 & 0 & 0 & \frac{1}{2} & 0 & 0 & \frac{1}{2} \\ T & 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 \\ HT & 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 \\ TH & 0 & 0 & 0 & \frac{1}{2} & 0 & 0 & \frac{1}{2} \\ TT & 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 \\ HH & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{array}\right)$$

Matrix Q is:

$$\left(\begin{array}{rrrrrr} 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 \\ 0 & 0 & 0 & \frac{1}{2} & 0 & 0 \\ 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} \\ 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} \\ 0 & 0 & 0 & \frac{1}{2} & 0 & 0 \\ 0 & 0 & 0 & 0 & \frac{1}{2} & \frac{1}{2} \end{array}\right)$$

Fundamental matrix $$(I-Q)^{-1}$$ is:

$$\left(\begin{array}{rrrrrr} 1 & \frac{1}{2} & \frac{1}{2} & 1 & \frac{3}{2} & \frac{3}{2} \\ 0 & 1 & 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 & 2 & 2 \\ 0 & 0 & 0 & 2 & 2 & 2 \\ 0 & 0 & 0 & 1 & 2 & 1 \\ 0 & 0 & 0 & 1 & 2 & 3 \end{array}\right)$$

The required expectation is the sum of the first row, which is 6.

Similarly doing for the 'HT' case yields an expected value of 4.

- 4 years, 8 months ago


# Number of 5-digit numbers such that the sum of their digits is even

I found the same question on this site and many others...where everywhere the answer $45000$ is written ...while I have no problem with this but I am having problems with the logical answer...as everywhere it is written since total numbers is $90000$ so half of the numbers satisfy the above condition(but why??it is not explained anywhere as to how we can say that half the numbers satisfy this condition)...I know that half the numbers are even and half the numbers are odd...but that is not what we are asked here...we need to find numbers whose sum of digits is even ...and not numbers who are just even... I think these conditions are very different but it is used evrwhere...can someone please clarify..this.??..as to how we can say..half the numbers have their sum of digits as even?? i don't think this question is entirely a duplicate but if it please let me know...where I can get the explanation of what I am asking..

• Hint: a sum of numbers is even if and only if there are an even number of odd numbers in the sum. – Colm Bhandal Nov 25 '15 at 18:23
• An other way of seeing it, the last number decide if the sum is odd or even. If the sum of the 4 first numbers is even, then the last number need to be even. If the sum of the 4 first numbers is odd, then the last number need to be odd. – Alain Remillard Nov 25 '15 at 18:26
• @Colm That is a very complicated use of even and odd term...!!..can you please expand this comment just a little bit...so that I can at least get a hint... – Freelancer Nov 25 '15 at 18:26
• @Freelancer- actually I think Alain Remillard's suggestion is the more elegant of the two. Can you see how this leads to the result? How many possibilities are there for that last digit? And how many of them result in an even number, how many in an odd number? – Colm Bhandal Nov 25 '15 at 18:28

To expand on the wonderful insight of Alain Remillard in the comments, let's consider the set of all $5$ digit numbers. Now, you can partition this set into $9 \times 10^3$ subsets (we exclude a leading $0$ as a possibility) each of which contains all numbers with a common prefix of $4$ numbers. For example, one of the partitions, for the prefix $2346$ would be:

$$\{23460, 23461, 23462, 23463, \dots, 23469\}$$

Note that each partition contains exactly $10$ elements, with the last digit numbered $0-9$. Now, to prove that exactly half the numbers in the entire set have even digit sums, all we have to do is to prove that half the numbers in each of these partitions has an even digit sum. So we've reduced the problem to something much simpler! I hope you can see why.

Now, to show that in any partition there are exactly $5$ elements with an even digit sum, consider the first element in the set e.g. in the above it would be $23460$. The sum of its digits is either even or odd. If it's even, then the next number will be odd, because you're just adding $1$ to it, and vice versa (the example is 15, which is odd). Then the sums go: even, odd, even, odd, even, odd etc. Or else they go: odd, even, odd, even etc. In either case, there are exactly $10$ elements, $5$ even, and $5$ odd. And we are done.

Update: As the OP cleverly points out in the comments below, the choice to fix the first four digits is indeed arbitrary. The first digit must be fixed, because there are only $9$ possibilities for this, but after this any three of the remaining four digits can be fixed. The remaining digit will then have ten possibilities, and the proof will proceed just as above.

• Well ..you fixed the first 3-digits...and then showed that for the last digit half numbers will be positive and half will be negative...let us say I want to think in another way and I fix the last three digits(say for example $X234$ and then show that half of the numbers so formed will be having sum as even and half will be having sum as odd...is that correct also?? ...can I do this... – Freelancer Nov 25 '15 at 19:03
• @Freelancer- that is a very clever insight. Nicely though out :):) Yes you can indeed fix any three digits and the first digit and the above method will work. I will update accordingly. – Colm Bhandal Nov 26 '15 at 12:00

• even + even = even
• even + odd = odd
• odd + odd = even

Using this we can show the even-ness of the sum of digits. Take $234582$. We have

$$E + O + E + O + E + E \\= (E + O) + (E + O) + (E + E) \\= O + O + E \\= (O+O) + E \\= E + E \\= E.$$

So, for a five-digit number, what numbers of odd digits can we have to make the sum even?

Next, let's count the number of five-digit numbers that have three odd digits. (Is the sum of digits of these numbers even or odd?)

There are $125$ three-digit odd numbers. (Why?) There are $_5C_3 = 10$ combinations of places we can put the digits in order within the five-digit number. Then, there are $25$ two-digit even numbers. So the number of five digit numbers with three odd digits is $125 \cdot 10 \cdot 25 = 31250.$ (I'm assuming leading zeroes are valid (like $00123$)).

To solve the problem, then, you'll need to determine what numbers of odd digits will give you an even sum, and then count each of those cases.


# Isomorphic groups

I know that there is a formal definition isomorphism but for the purpose of this homework questions, I call two groups isomorphic if they have the same structure, that is group table for one can be turned into the table for the other by a suitable renaming.

Now consider $\mathbf{Z}_2=\{0,1\}$ (group under addition modulo $2$) and $\mathbf{Z}_3^{\times}=\{1,2\}$ (group under multiplication modulo $3$). In general $\mathbf{Z}_n^{\times}=\{a|0\leq a\leq n-1 \text{ and }\gcd(a,n)=1\}$. Now the group table for $\mathbf{Z}_2$ is: $$\begin{array}{c|cc} &0&1\\ \hline 0&0&1\\ 1&1&0 \end{array}$$ and the group table for $\mathbf{Z}_3^{\times}$ is: $$\begin{array}{c|cc} &1&2\\ \hline 1&1&2\\ 2&2&1 \end{array}$$ Obviously these two groups are isomorphic because if in the first table, I replace $0$s by $1$s and $1$s by $2$s, I get exactly the second table.

However, if I write out the group table for $\mathbf{Z}_4$ and $\mathbf{Z}_5^{\times}$, there is no way that group table for one can be turned into the table for the other by a suitable renaming. This means that these two groups are not isomorphic but the question asks me to prove that they are isomorphic. Now what should I do?

-
There is no difference between the usual formal notion of "being isomorphic" and the one you propose to use! –  Mariano Suárez-Alvarez Apr 2 '11 at 5:10
In any case, you should look harder at the group tables for $\mathbb Z_4$ and $\mathbb Z_5^\times$!... –  Mariano Suárez-Alvarez Apr 2 '11 at 5:10
There is a suitable renaming. Keep trying... –  Zev Chonoles Apr 2 '11 at 5:12
In short, the two examples are all concerned with the structure of cyclic groups, et c'est la méme. –  awllower Apr 2 '11 at 7:08

You are incorrect in claiming that there is no way to turn one table into the other. But the key is that you are not just allowed to rename, you are also allowed to list the elements in a different order! (After all, listing the elements of $\mathbf{Z}_4$ in a different order in the table will not change the group or the operation, will it?) This amounts to shuffling rows and columns together: if you exchange rows 2 and 3, say, you should also exchange columns 2 and 3.

The table for $\mathbf{Z}_4$ is: $$\begin{array}{c|cccc} +&0&1&2&3\\ \hline 0&0&1&2&3\\ 1&1&2&3&0\\ 2&2&3&0&1\\ 3&3&0&1&2 \end{array}$$ The table for $Z_5^{\times}$ is: $$\begin{array}{c|cccc} \times&1&2&3&4\\ \hline 1&1&2&3&4\\ 2&2&4&1&3\\ 3&3&1&4&2\\ 4&4&3&2&1 \end{array}$$ If you are going to be able to rename the entries in the last table to match the first, then "1" must be renamed "0". Now, notice that there is only one of the remaining four elements that when operated with itself gives you the "identity"; since in $\mathbf{Z}_4$ this happens for $2$, you may want to shuffle the rows and columns to move that element to be in the third row and column and see what you have then.

-
c'est superbe!! –  awllower Apr 2 '11 at 7:11
Apparently not; any reason for the downvote? –  Arturo Magidin Apr 2 '11 at 18:13
Who downvoted ? –  awllower Apr 3 '11 at 2:45
Don't know; but someone did... –  Arturo Magidin Apr 3 '11 at 2:50
Since $\mathbb{Z}_n^\times$ is cyclic, reordering can be easily done by picking a generator element (i. e., any other than 1), and computing its power. In this case, the powers of 2 are, in order, 1, 2, 4 and 3, which is the ordering for the first line of the table for $\mathbb{Z}_5^\times$ that will suit the isomorphism. –  Luke May 10 '11 at 1:04

Your "naive" definition of isomorphic almost coincides with the abstract one. The difference is that apart from renaming you must also be allowed to change the order of the elements. Then you should have no difficulties with $\mathbb{Z}/4\mathbb{Z}$ vs. $(\mathbb{Z}/5\mathbb{Z})^\times$.

-
Note by the way that this little confusion is a good argument for learning the actual definition of group isomorphism, rather than trying to avoid it by only thinking in terms of "group tables". –  Pete L. Clark Apr 2 '11 at 12:30


# Calculating conditional probability with marginal

Assume we are given a joint distribution $$P(X,Y)$$ where $$P(0,0)=0.1$$, $$P(0,1) = 0.4$$, $$P(1,0)=0.3$$, and $$P(1,1)=0.2$$. The goal is to compute $$P(X|Y=1)$$.

Traditionally, solving a conditional probability problem $$P(A|B)$$ simplifies to $$\frac{P(A,B)}{P(B)}$$, but I'm unsure how to apply it to this case. In particular, I am unclear on what the probability $$P(X,Y=1)$$ means since $$P(X)$$ is a marginal probability.

To avoid this, I enumerated the different values $$X$$ takes on and plugged it into the original quantity to solve -- $$P(X|Y=1)$$:

• $$P(X=0|Y=1) = 0.4/0.6 = 4/6$$
• $$P(X=1|Y=1) = 0.2/0.6 = 2/6$$

This gives me the final answer of $$P(X|Y=1) = [4/6, 2/6]$$, but I'm not sure whether the answer should be multiple probabilities or a single probability.

• P(X|Y=2) is a distribution in the same way that P(X) is also a distribution (and not just one "probability"). One probably is P(X=0, Y=0)=0.1, for example. – nbro Jan 28 at 2:14
• @nbro Does this mean my answer is correct? – Shrey Jan 28 at 4:04
• you're ok. just as $p(x,y)$ is a 2D function(table), $p(x)$, $p(x|Y=y)$ are 1D functions (rows). – gunes Jan 28 at 4:52
• $P(X|Y=1)$ is shorthand for $P(X=x|Y=1)$ – StatsStudent Jan 28 at 5:47

You have gone about this correctly, but the final answers are typically written as a function of $$x$$. It's helpful, I think, to remember that $$P(X|Y=1)$$ is just shorthand for $$P(X=x|Y=1)$$ where $$x$$ is any number in the support of $$x$$ (in this case 0 and 1). So you'd calculate this as follows:

$$\begin{eqnarray*} \\{P(X|Y=1)} & = & {P\left(X=x|Y=1\right)}\\ & = & \frac{P\left(X=x,\,Y=1\right)}{P\left(Y=1\right)}\\ & = & \frac{P\left(X=x,\,Y=1\right)}{P\left(X=0,\,Y=1\right)+P\left(X=1,\,Y=1\right)}\\ & = & \frac{P\left(X=x,\,Y=1\right)}{0.4+0.2}\\ & = & \frac{P\left(X=x,\,Y=1\right)}{0.6} \end{eqnarray*}$$

Now, writing this as a function of $$x$$ gives:

$$\begin{eqnarray*} P\left(X=x|Y=1\right) & = & \begin{cases} \frac{P\left(X=0,\,Y=1\right)}{0.6} & ,\text{for }x=0\\ \frac{P\left(X=1,\,Y=1\right)}{0.6} & ,\text{for }x=1 \end{cases}\\ & = & \begin{cases} \frac{0.4}{0.6} & ,\text{for }x=0\\ \frac{0.2}{0.6} & ,\text{for }x=1 \end{cases}\\ & = & \begin{cases} \frac{2}{3} & ,\text{for }x=0\\ \frac{1}{3} & ,\text{for }x=1 \end{cases} \end{eqnarray*}$$

You are correct. You are supposed to be getting "multiple" probabilities.

You said that your goal is to figure out $$P(X|Y = 1)$$. Well, in order to achieve your goal, you need to know what the probability that $$X = 0$$ given that $$Y = 1$$ is as well as what the probability that $$X = 1$$ given that $$Y = 1$$ is, which you did.

nbro's comment is basically telling you that when you get "multiple" probabilities, you are actually computing a probability mass (or density) function (or, equivalently, yet not the same, the distribution of the random variable $$X$$ given $$Y = 1$$).

Note: $$P(X|Y=1)=[4/6,2/6]$$ is the probability mass function of the random variable $$X$$ given $$Y = 1$$ because it tells you what that probability is for all the possible values of $$X$$, ie, $$X = 0$$ and $$X$$ = 1.

Finally, I use "multiple" in quotes because nobody really says that. In your case, they would ask something like: "This gives me the final answer of P(X|Y=1)=[4/6,2/6], but I'm not sure whether the answer should be $${\it \text{ a probability mass function}}$$ or a single probability."


# If series is absolutely convergent then $\sum \limits_{n\in I}a_n=\sum \limits_{k=1}^{\infty}\sum \limits_{n\in I_k}a_n.$

Suppose that the series $$\sum \limits_{n=1}^{\infty}a_n$$ is absolutely convergent and let $$I\subseteq \mathbb{N}$$ such that $$I=\bigsqcup\limits_{k=1}^{\infty}I_k$$. Then show that $$\sum \limits_{n\in I}a_n=\sum \limits_{k=1}^{\infty}\sum \limits_{n\in I_k}a_n. \qquad (*)$$

I don't have any idea how to solve it.

I do know that in any absolute convergent series permutation of terms does not change the sum and I guess it should be used somehow in order to prove equality $$(*)$$.

Can anyone show the rigorous proof of equality $$(*)$$, please?

• here is a proof. Here is another. – Masacroso May 16 at 20:14
• What's the definition of summation here? – Hashem Ben Abdelbaki May 16 at 20:14
• @Masacroso, link which you provided have not nothing in common with my question. I do know that in absolute convergent series any permutation does not change the sum. – ZFR May 16 at 20:22
• @ZFR you had written "I do know that in any absolute convergent series permutation of terms does not change the sum. But I want to prove it rigorously and cannot do it." Hence my comment providing two formal proofs. Make clear your question please. – Masacroso May 16 at 20:23
• @Masacroso, sorry about that. Done – ZFR May 16 at 20:27

First assume that $$a_n \ge 0$$ and define $$\sum_{n \in I} a_n = \sup_{J \subset I, J \text{ finite}} \sum_{n \in J} a_n$$. Note that it follows that if $$I \subset I'$$ then $$\sum_{n \in I} a_n \le \sum_{n \in I'} a_n$$.

From https://math.stackexchange.com/a/3680889/27978 we see that if $$K = K_1 \cup \cdots \cup K_m$$, a disjoint union, then $$\sum_{n \in K} a_n = \sum_{n \in K_1} a_n + \cdots + \sum_{n \in K_m} a_n$$.

Since $$I'=I_1 \cup \cdots \cup I_m \subset I$$ we see that $$\sum_{n \in I} a_n \ge \sum_{n \in I'} a_n = \sum_{k=1}^m \sum_{n \in I_k} a_n$$. It follows that $$\sum_{n \in I} a_n \ge \sum_{k=1}^\infty \sum_{n \in I_k} a_n$$. This is the 'easy' direction.

Let $$\epsilon>0$$, then there is some finite $$J \subset I$$ such that $$\sum_{n\in J} a_n > \sum_{n \in I} a_n -\epsilon$$. Since $$J$$ is finite and the $$I_k$$ are pairwise disjoint we have $$J \subset I'=I_1 \cup \cdots \cup I_m$$ for some $$m$$ and so $$\sum_{k=1}^\infty \sum_{n \in I_k} a_n \ge \sum_{k=1}^m\sum_{n \in I_k} a_n \ge \sum_{k=1}^m\sum_{n \in J \cap I_k} a_n = \sum_{n\in J} a_n > \sum_{n \in I} a_n -\epsilon$$.

(It is not relevant here, but a small proof tweak shows that the result holds true even if the $$a_n$$ do not have a finite sum.)

Now suppose we have $$a_n \in \mathbb{R}$$ and $$\sum_{n \in I} |a_n| = \sum_{n=1}^\infty |a_n|$$ is finite. We need to define what we mean by $$\sum_{n \in I} a_n$$. Note that $$(a_n)_+=\max(0,a_n) \ge 0$$ and $$(a_n)_-=\max(0,-a_n) \ge 0$$. Since $$0 \le (a_n)_+ \le |a_n|$$ and $$0 \le (a_n)_- \le |a_n|$$ we see that $$\sum_{n \in I} (a_n)_+ = \sum_{k=1}^\infty \sum_{n \in I_k} (a_n)_+$$ and similarly for $$(a_n)_-$$.

This suggests the definition (cf. Lebesgue integral) $$\sum_{n \in I} a_n = \sum_{n \in I} (a_n)_+ - \sum_{n \in I} (a_n)_-$$.

With this definition, all that remains to be proved is that $$\sum_{k=1}^\infty \sum_{n \in I_k} a_n = \sum_{k=1}^\infty \sum_{n \in I_k} (a_n)_+ - \sum_{k=1}^\infty \sum_{n \in I_k} (a_n)_-$$ and this follows from summability and the fact that for each $$k$$ we have $$\sum_{n \in I_k} a_n = \sum_{n \in I_k} (a_n)_+ - \sum_{n \in I_k} (a_n)_-$$.

Note: To elaborate the last sentence, recall that I defined $$\sum_{n \in I_k} a_n$$ to be $$\sum_{n \in I_k} (a_n)_+ - \sum_{n \in I_k} (a_n)_-$$, so all that is happening here is the definition is applied to $$I_k$$ rather than $$I$$. Then to finish, note that if $$d_k,b_k,c_k$$ are summable and satisfy $$d_k=b_k-c_k$$ then $$\sum_{k=1}^\infty d_k= \sum_{k=1}^\infty b_k- \sum_{n=1}^\infty c_k$$, where $$d_k = \sum_{n \in I_k} a_n$$, $$b_k = \sum_{n \in I_k} (a_n)_+$$ and $$c_k = \sum_{n \in I_k} (a_n)_-$$.

• Great answer! But probably you meant bijection $\sigma: \mathbb{N}\to I$, right? – ZFR May 18 at 18:42
• @ZFR: Correct, I will fix. – copper.hat May 18 at 18:58
• When you wrote that "It is straightforward to show that for any bijection $\sigma:\mathbb{N} \to I$ we have $\sum_{n \in I} a_n = \sum_{n=1}^\infty a_{\sigma(n)}$." Do you mean here that $a_n\geq 0$ or not? I am a bit confused – ZFR May 18 at 19:17
• (+1) This is less fussy, more self-contained, more authoritative, and better connected to the literature than my answer, so it ought to replace it as the accepted answer. (I haven't read @Matematleta's answer yet, because it looks harder to understand than these two, so I reserve judgement on it, for now!) On this answer: am I right in thinking that one can also write $\sum_{n \in I}a_n = s$ iff for all $\epsilon > 0$ there exists finite $J \subseteq I$ such that $\left\lvert\sum_{n \in J}a_n- s\right\rvert < \epsilon$? – Calum Gilhooley May 18 at 19:18
• You really helped me to understand the thing which i did not understand for a long time. Thank you so much! I really appreciate your permanent help! – ZFR May 18 at 20:50

Suppose for the moment that the result is known to be true for convergent series of non-negative terms.

If $$\sum_{n=1}^\infty a_n$$ is an absolutely convergent series of real numbers, define $$a_n = b_n - c_n,$$ for all $$n \geqslant 1,$$ where $$c_n = 0$$ when $$a_n \geqslant 0$$ and $$b_n = 0$$ when $$a_n \leqslant 0.$$ Then $$|a_n| = b_n + c_n,$$ therefore $$\sum_{n=1}^\infty b_n$$ and $$\sum_{n=1}^\infty c_n$$ are convergent series of non-negative terms, therefore: \begin{align*} \sum_{n \in I}a_n & = \sum_{n \in I}b_n - \sum_{n \in I}c_n \\ & = \sum_{k=1}^\infty\sum_{n \in I_k}b_n - \sum_{k=1}^\infty\sum_{n \in I_k}c_n \\ & = \sum_{k=1}^\infty\left( \sum_{n \in I_k}b_n - \sum_{n \in I_k}c_n\right) \\ & = \sum_{k=1}^\infty\sum_{n \in I_k}(b_n - c_n) \\ & = \sum_{k=1}^\infty\sum_{n \in I_k}a_n. \end{align*} So it is enough to prove the result on the assumption that $$a_n \geqslant 0$$ for all $$n \geqslant 1.$$

Given any set $$K \subseteq \mathbb{N},$$ I shall use the Iverson bracket notation: $$[n \in K] = \begin{cases} 1 & \text{if } n \in K, \\ 0 & \text{if } n \notin K. \end{cases}$$ I shall assume that, however the notation $$\sum_{n \in K}a_n$$ has been defined, it satisfies the identity: $$\sum_{n \in K}a_n = \sum_{n=1}^\infty a_n[n \in K].$$ Let $$J_k = I_1 \cup I_2 \cup \cdots \cup I_k$$ ($$k = 1, 2, \ldots$$). Because the $$I_k$$ are disjoint, we have $$[n \in J_k] = [n \in I_1] + [n \in I_2] + \cdots + [n \in I_k],$$ therefore $$\sum_{n \in I_1}a_n + \sum_{n \in I_2}a_n + \cdots + \sum_{n \in I_k}a_n = \sum_{n \in J_k}a_n \leqslant \sum_{n \in I}a_n,$$ therefore $$\sum_{k=1}^\infty\sum_{n \in I_k}a_n \leqslant \sum_{n \in I}a_n,$$ and the outer infinite sum on the left hand side exists, because its partial sums are bounded above by the sum on the right hand side. On the other hand, for all $$m \geqslant 1,$$ \begin{align*} \sum_{n=1}^ma_n[n \in I] & = \sum_{n=1}^ma_n[n \in I_1] + \sum_{n=1}^ma_n[n \in I_2] + \cdots + \sum_{n=1}^ma_n[n \in I_r] \\ & \leqslant \sum_{n \in I_1}a_n + \sum_{n \in I_2}a_n + \cdots + \sum_{n \in I_r}a_n \\ & \leqslant \sum_{k=1}^\infty\sum_{n \in I_k}a_n, \end{align*} where $$r = \max\{k \colon n \leqslant m \text{ for some } n \in I_k\},$$ therefore $$\sum_{n \in I}a_n \leqslant \sum_{k=1}^\infty\sum_{n \in I_k}a_n,$$ and the two inequalities together prove (*).

• Thanks a lot for your answer! I read your answer and I have two questions: 1) I am a bit confused by the definition of $r$? Could you explain it in details, please? 2) Have you ever used that the series $\sum \limits_{n=1}^{\infty}a_n$ is absolutely convergent? – ZFR May 17 at 2:16
• I would define $r$ in this way: for each $n\in I$ s.t. $1\leq n\leq m$ there is $p(n)$ s.t. $n\in I_{p(n)}$ and let's take $r=\max \{p(1),\dots,p(m)\}$ then $[n\in I]=[n\in I_1]+\dots+[n\in I_r]$. Is my reasoning correct? And still I would be happy if you can explain and point the moments where you have used that the series is absolutely convergent. – ZFR May 17 at 2:30
• Your definition of $r$ looks right to me, and looks equivalent to mine. Certainly I had much the same idea in mind. I used the absolute convergence of $\sum_{n=1}^\infty a_n$ when I inferred that the two series of non-negative terms $\sum_{n=1}^\infty b_n$ and $\sum_{n=1}^\infty c_n$ are convergent. I'm going to try to get some more sleep now, but I'll have another look at the whole thing after lunch, and see if I can make it any clearer. (Assuming it isn't all just a load of dingo's kidneys, of course!) – Calum Gilhooley May 17 at 9:04
• I deliberately chose not to write \begin{gather*} b_n = \frac{|a_n| + a_n}2 \geqslant 0, \\ c_n = \frac{|a_n| - a_n}2 \geqslant 0, \end{gather*} but perhaps it would have been clearer had I done so. – Calum Gilhooley May 17 at 15:00
• Perhaps I should also have stated explicitly that the identity I took to be satisfied by $\sum_{n \in K}a_n$ is a possible definition of that notation; but it is not the only possible definition; and you didn't say what definition you were using; so I left it open. – Calum Gilhooley May 17 at 15:05

I think there is an elementary proof (one without measure theory), that we can adapt from a similar claim in Apostol's Analysis book. Without loss of generality, $$I=\mathbb N$$. For each $$k\in \mathbb N,\ I_k$$ may be regarded as a map from some subset $$\{1,2,\cdots,\}\subseteq \mathbb N$$, to $$\{\sigma_k(1),\sigma_k(2),\cdots,\}$$ which may or may not be infinite, so $$\sigma_k$$ is an injective map from the susbet of $$\mathbb N$$ of the same cardinality as $$|I_k|,$$ starting at $$1$$, to the $$\textit{set}\ I_k.$$ If $$|I_k|=j$$, extend $$I_k$$ to all of $$\mathbb N$$ by mapping $$n\in \mathbb N\setminus \{1,2,\cdots, j\}$$ to $$\mathbb N\setminus \{\sigma_k(1),\sigma_k(2),\cdots, \sigma_k(j)\}$$ injectively and defining $$a'_n:=0$$ for all $$n\in \mathbb N\setminus \{\sigma_k(1),\sigma_k(2),\cdots, \sigma_k(j)\}$$. This construction will not affect any of the sums, so without loss of generality, $$I_k$$ maps $$\mathbb N$$ to a subset of $$\mathbb N$$ such that

$$\tag1 I_k\ \text{is injective on}\ \mathbb N$$

$$\tag2 \text{the range of each}\ I_k \ \text{is a subset of } \ \mathbb N, \text{say}\ P_k$$

$$\tag3 \text{the}\ P_k\ \text{are disjoint}$$

Now put $$\tag4 b_k(n)=a_{I_{k}(n)}\ \text{and}\ s_k=\sum^\infty_{n=0}b_k(n)$$

which is well-defined by $$(1)-(3).$$ We have to prove that

$$\tag5 \sum^\infty_{k=0}a_k=\sum^\infty_{k=0}s_k$$

It's easy to show that the right hand side of this converges absolutely. To find the sum, set $$\epsilon>0$$ and choose $$N$$ large enough so that $$\sum^\infty_{k=0}|a_k|-\sum^n_{k=0}|a_k|<\frac{\epsilon}{2}$$ as soon as $$n>N.$$ This implies also that

$$\tag6\left|\sum^\infty_{k=0}a_k-\sum^n_{k=0}a_k\right|<\frac{\epsilon}{2}$$

Now choose $$\{I_1,\cdots, I_r\}$$ so that each element of $$\{a_1,\dots ,a_N\}$$ appears in the sum $$\sum^\infty_{n=0}a_{I_{1(n)}}+\cdots +\sum^\infty_{n=0}a_{I_{r(n)}}=s_1+\cdots+ s_r.$$ Then, if $$n>r,N$$ we have

$$\tag 7\left|\sum^n_{k=0}s_k-\sum^n_{k=0}a_k\right|<\sum^\infty_{n=N+1}<\frac{\epsilon}{2}$$

Now $$(5)$$ folllows from $$(6)$$ and $$(7).$$

• I am a bit confused with your definition of $I_k$? Could you clarify it, please? – ZFR May 16 at 23:26
• $I_k$ is some subset of $\mathbb N$. So it may be regarded as a function on the subset of $\mathbb N$ of the same cardinality. For instance, if $I_k=\{2,5,7\}$ then $I_k$ the function would map $\{1,2,3\}$ to $\{2,5,7\}$. If $I_k$ is infinite, then it is countable, so there is an injective function from $\mathbb N$ to it. That would be our $I_k$ considered as a function on $\mathbb N.$ – Matematleta May 16 at 23:31
• Hmm. I guess that i got you. Also could you show why the RHS of (5) converges absolutely, please? – ZFR May 16 at 23:37
• Hint: show directly by comparison with $\sum |a_n|$ that $\{s_k\}$ has bounded partial sums. – Matematleta May 16 at 23:42


# Why don't you need the Axiom of Choice when constructing the “inverse” of an injection?

Suppose $f:X\rightarrow Y$ is a surjection and you want to show that there exists $g:Y\rightarrow X$ s.t. $f\circ g=\mathrm{id}_Y$. You need the AC to show this.

However, suppose $f$ is a injection and you want show there is $g$ s.t. $g\circ f=\mathrm{id}_X$. Then, according to my textbook, you don't need the AC to show this.

This is counterintuitive to me, because it's like you need a special axiom to claim that an infinite product of big sets is nonempty, while you don't need one to claim that an infinite product of singleton sets is nonempty, which seems smaller than the former.

So why don't you need the AC to show the latter?

EDIT: $X$ should be nonempty.

EDIT 2: I realized (after asking this) that my question mostly concerns whether the AC is needed to say that an infinite product of finite sets is nonempty, and why.

• I can't fix your details (Asaf will probably see to that) but here's the intuition: Why do we need AC? Because with big sets, the problem is specifying how to pick the elements. No such problem with singleton sets! – Ragib Zaman Apr 16 '12 at 13:32
• Making one choice (or some fixed finite number of choices) doesn't require Axiom of Choice. It's entailed by first-order logic, q.v. Rule C. – hardmath Apr 16 '12 at 13:42
• hardmath: your comment is best in answering my question as I hold in my heart. Could you please elaborate on that? – Pteromys Apr 16 '12 at 13:47
• @Pteromys: Read this answer to why we can choose from non-empty sets. Finitely many choices follow by induction. – Asaf Karagila Apr 16 '12 at 13:48
• @Pteromys: As others have noted, the Axiom of Choice is needed to deal with infinite products of different sets, even in the case those sets each contain two elements. We've moved sufficiently far from your original Question, it might be best to formulate a new one if you want elaboration! – hardmath Apr 16 '12 at 14:58

The need for the axiom of choice is to choose arbitrary elements. Injectivity eliminates this need.

Assume that $A$ is not empty, if $f\colon A\to B$ is injective this means that if $b\in B$ is in the range of $f$ then there is a unique $a\in A$ such that $f(a)=b$.

This means that we can define (from $f$) what is the $a$ to which we send $b$.

So if $f$ is not onto $B$ we have two options:

1. $b\in B$ in the range of $f$, then we have exactly one option to send $b$ to.
2. $b\in B$ not in the range of $f$. Since $A$ is not empty fix in advance some $a_0\in A$ and send $b$ to $a_0$.

Another way to see this is let $B=B'\cup Rng(f)$, where $B'\cap Rng(f)=\varnothing$. Fix $a_0\in A$ and define $g|_{B'}(x)=a_0$. For every $b\in Rng(f)$ we have that $f^{-1}[\{b\}]=\{a\in A\mid f(a)=b\}$ is a singleton, so there is only one function which we can define in: $$\prod_{b\in Rng(f)}f^{-1}[\{b\}]$$

Now let the unique function in the product be $g|_{Rng(f)}$ and define $g$ to be the union of these two.

Your intuition about the need for the axiom of choice is true for surjections, if $f$ was surjective then we only know that $f^{-1}[\{b\}]$ is non-empty for every $b\in B$, and we need the full power of the axiom of choice to ensure that an arbitrary surjection has an inverse function.

To the edited question:

The axiom of choice is needed because we have models in which the axiom of choice does not hold, where there exists an infinite family of pairs whose product is empty.

There are weaker forms from which follow choice principles for finite sets. However these are still not provable from ZF on its own.

As indicated by Chris Eagle in the comments, and as I remark above, in a product of singletons there is no need for the axiom of choice since there is only one way to choose from a singleton.

• Why not just "flip the graph" with $(x,y) \mapsto (y,x)$ to get a function $g: f(X) \to X$ (since $f$ is injective) and extend it to $Y \smallsetminus f(X)$ by $g(y) = x_0$ as you said? – t.b. Apr 16 '12 at 13:42


# One-zero dividend

## Challenge description

For every positive integer n there exists a number having the form of 111...10...000 that is divisible by n i.e. a decimal number that starts with all 1's and ends with all 0's. This is very easy to prove: if we take a set of n+1 different numbers in the form of 111...111 (all 1's), then at least two of them will give the same remainder after division by n (as per pigeonhole principle). The difference of these two numbers will be divisible by n and will have the desired form. Your aim is to write a program that finds this number.

## Input description

A positive integer.

## Output description

A number p in the form of 111...10...000, such that p ≡ 0 (mod n). If you find more than one - display any of them (doesn't need to be the smallest one).

## Notes

Your program has to give the answer in a reasonable amount of time. Which means brute-forcing is not permited:

p = 0
while (p != 11..10.00 and p % n != 0)
p++

Neither is this:

do
p = random_int()
while (p != 11..10.00 and p % n != 0)

Iterating through the numbers in the form of 11..10..00 is allowed.

Your program doesn't need to handle an arbitrarily large input - the upper bound is whatever your language's upper bound is.

## Sample outputs

2: 10
3: 1110
12: 11100
49: 1111111111111111111111111111111111111111110
102: 1111111111111111111111111111111111111111111111110

• Can we have a reasonable upper bound to the possible output? (Something about less than 2.4 billion (approx. the max value of a signed integer) should be fine, as arrays or lists might be required for some implementations) – Tamoghna Chowdhury Feb 28 '16 at 15:25
• @MartinBüttner I think that the first satisfying output should be enough (reasonable timeframe constraint) – Tamoghna Chowdhury Feb 28 '16 at 15:26
• The last 0 is not necessary in the 49 test case. – CalculatorFeline Feb 28 '16 at 15:36
• @CatsAreFluffy I think all numbers need to contain at least 1 and at least one 0, otherwise 0 is a solution for any input. (Would be good to clarify this though.) – Martin Ender Feb 28 '16 at 15:38
• Just requiring one 1 should work. – CalculatorFeline Feb 28 '16 at 15:41

## Mathematica, 29 bytes

⌊10^(9EulerPhi@#)/9⌋10^#&

Code by Martin Büttner.

On input $$\n\$$, this outputs the number with $$\9\varphi(n)\$$ ones followed by $$\n\$$ zeroes, where $$\\varphi(\cdot)\$$ is the Euler totient function. With a function phi, this could be expressed in Python as

lambda n:'1'*9*phi(n)+'0'*n

It would suffice to use the factorial $$\n!\$$ instead of $$\\varphi(n)\$$, but printing that many ones does not have a reasonable run-time.

Claim: $$\9\varphi(n)\$$ ones followed by $$\n\$$ zeroes is a multiple of $$\n\$$.

Proof: First, let's prove this for the case that $$\n\$$ is not a multiple of $$\2, 3, \text{or } 5\$$. We'll show the number with consisting of $$\\varphi(n)\$$ ones is a multiple of $$\n\$$.

The number made of $$\k\$$ ones equals $$\\frac{10^k-1}9\$$. Since $$\n\$$ is not a multiple of $$\3\$$, this is a multiple of $$\n\$$ as long as $$\10^k-1\$$ is a factor of $$\n\$$, or equivalently if $$\10^k \equiv 1\mod n\$$. Note that this formulation makes apparent that if $$\k\$$ works for the number of ones, then so does any multiple of $$\k\$$.

So, we're looking for $$\k\$$ to be a multiple of the order of $$\k\$$ in the multiplicative group modulo n. By Lagrange's Theorem, any such order is a divisor of the size of the group. Since the elements of the group are the number from $$\1\$$ to $$\n\$$ that are relatively prime to $$\n\$$, its size is the Euler totient function $$\\varphi(n)\$$. So, we've shown that $$\10^{\varphi(n)} \equiv 1 \mod n\$$, and so the number made of $$\\varphi(n)\$$ ones is a multiple of $$\n\$$.

Now, let's handle potential factors of $$\3\$$ in $$\n\$$. We know that $$\10^{\varphi(n)}-1\$$ is a multiple of $$\n\$$, but $$\\frac{10^{\varphi(n)}-1}9\$$ might not be. But, $$\\frac{10^{9\varphi(n)}-1}9\$$ is a multiple of $$\9\$$ because it consists of $$\9\varphi(n)\$$ ones, so the sum of its digits a multiple of $$\9\$$. And we've noted that multiplying the exponent $$\k\$$ by a constant preserves the divisibility.

Now, if $$\n\$$ has factors of $$\2\$$'s and $$\5\$$'s, we need to add zeroes to end of the output. It way more than suffices to use $$\n\$$ zeroes (in fact $$\\log_2(n)\$$ would do). So, if our input $$\n\$$ is split as $$\n = 2^a \times 5^b \times m\$$, it suffices to have $$\9\varphi(m)\$$ ones to be a multiple of $$\n\$$, multiplied by $$\10^n\$$ to be a multiple of $$\2^a \times 5^b\$$. And, since $$\n\$$ is a multiple of $$\m\$$, it suffices to use $$\9\varphi(n)\$$ ones. So, it works to have $$\9\varphi(n)\$$ ones followed by $$\n\$$ zeroes.

• Just to make sure no one thinks this was posted without my permission: xnor came up with the method and proof all on his own, and I just supplied him with a Mathematica implementation, because it has a built-in EulerPhi function. There is nothing mind-blowing to the actual implementation, so I'd consider this fully his own work. – Martin Ender Feb 28 '16 at 18:29

## Python 2, 44 bytes

f=lambda n,j=1:j/9*j*(j/9*j%n<1)or f(n,j*10)

When j is a power of 10 such as 1000, the floor-division j/9 gives a number made of 1's like 111. So, j/9*j gives 1's followed by an equal number of 0's like 111000.

The function recursively tests numbers of this form, trying higher and higher powers of 10 until we find one that's a multiple of the desired number.

• Oh, good point, we only need to check 1^n0^n... – Martin Ender Feb 28 '16 at 16:03
• @MartinBüttner If it's any easier, it also suffices to fix the number of 0's to be the input value. Don't know if it counts as efficient to print that many zeroes though. – xnor Feb 28 '16 at 16:37
• Why does checking 1^n0^n work? – Lynn Feb 28 '16 at 17:54
• @Lynn Adding more zeroes can't hurt, and there's infinitely many possible numbers of ones, some number will have enough of both ones and zeroes. – xnor Feb 28 '16 at 18:15

# Pyth, 11 bytes

.W%HQsjZTT

Test suite

Basically, it just puts a 1 in front and a 0 in back over and over again until the number is divisible by the input.

Explanation:

.W%HQsjZTT
Implicit: Q = eval(input()), T = 10
.W              while loop:
%HQ           while the current value mod Q is not zero
jZT      Join the string "10" with the current value as the separator.
s          Convert that to an integer.
T     Starting value 10.

# Haskell, 51 bytes

\k->[b|a<-[1..],b<-[div(10^a)9*10^a],bmodk<1]!!0

Using xnor’s approach. nimi saved a byte!

## CJam, 2825 19 bytes

Saved 6 bytes with xnor's observation that we only need to look at numbers of the form 1n0n.

ri:X,:)Asfe*{iX%!}=

Test it here.

### Explanation

ri:X    e# Read input, convert to integer, store in X.
,:)     e# Get range [1 ... X].
As      e# Push "10".
fe*     e# For each N in the range, repeat the characters in "10" that many times,
e# so we get ["10" "1100" "111000" ...].
{iX%!}= e# Select the first element from the list which is divided by X.

# JavaScript (ES6), 65 bytes

Edit 2 bytes saved thx @Neil

It works within the limits of javascript numeric type, with 17 significant digits. (So quite limited)

a=>{for(n='';!(m=n+=1)[17];)for(;!(m+=0)[17];)if(!(m%a))return+m}

Less golfed

function (a) {
for (n = ''; !(m = n += '1')[17]; )
for (; !(m += '0')[17]; )
if (!(m % a))
return +m;
}

• Why not for(m=n;? – Neil Feb 28 '16 at 17:11
• @Neil because I need at least one zero. Maybe I can find a shorter way ... (thx for the edit) – edc65 Feb 28 '16 at 18:30
• Oh, that wasn't clear in the question, but I see now that the sample outputs all have at least one zero. In that case you can still save a byte using for(m=n;!m[16];)if(!((m+=0)%a)). – Neil Feb 28 '16 at 18:42
• @Neil or even 2 bytes. Thx – edc65 Feb 28 '16 at 18:52

# Husk, 11 10 bytes

-1 byte thanks to Razetime!

ḟ¦⁰modṘḋ2N

Try it online! Constructs the infinite list [10,1100,111000,...] and selects the first element which is a multiple of the argument.

# Mathematica, 140 55 bytes

NestWhile["1"<>#<>"0"&,"1",FromDigits@#~Mod~x>0&/.x->#]

Many bytes removed thanks to xnor's 1^n0^n trick.

Minimal value, 140 156 bytes This gives the smallest possible solution.

NestWhile["1"<>#&,ToString[10^(Length@NestWhileList[If[EvenQ@#,If[10~Mod~#>0,#/2,#/10],#/5]&,#,Divisors@#~ContainsAny~{2, 5}&],FromDigits@#~Mod~m>0&/.m->#]&

It calculates how many zeros are required then checks all possible 1 counts until it works. It can output a number with no 0 but that can be fixed by adding a <>"0" right before the final &.

## Haskell, 37 bytes

f n=[d|d<-"10",i<-[1..n*9],gcd n i<2]

This uses the fact that it works to have 9*phi(n) ones, where phi is the Euler totient function. Here, it's implemented using gcd and filtering, producing one digit for each value i that's relatively prime to it that is in the range 1 and 9*n. It also suffices to use this many zeroes.

# Jelly, 11 bytes

⁵DxⱮḅ⁵ḍ@Ƈ⁸Ḣ

Try it online!

Ignoring runtime requirements, we can reduce this to 10 bytes using xnor's method, but with $$\\varphi(n)\$$ replaced with $$\n!\$$:

!,µ⁵Dx"µFḌ

Try it online!

## How they work

⁵DxⱮḅ⁵ḍ@Ƈ⁸Ḣ - Main link. Takes n on the left
⁵D          - Yield [1, 0]
Ɱ        - For each integer i in [1, 2, ..., n]:
x         -   Repeat each element of [1, 0] i times
ḅ⁵      - Convert each back into an integer
Ƈ   - Keep those for which the following is true:
ḍ@    -   Is divisible by
⁸  -   n
Ḣ - Take the first value of those remaining

!,µ⁵Dx"µFḌ - Main link. Takes n on the left
!          - Yield n!
,         - Yield [n!, n]. Call this l
µ        - Begin new link with l on the left
⁵D      - Yield [1, 0]
"    - Zip [1, 0] with [n!, n] and do the following over each pair:
x     -   Repeat
- This yields [[1, 1, ..., 1], [0, 0, ..., 0]].
The first element has n! 1s and the second n 0s
Call this k
µ   - Begin new link with k on the left
F  - Flatten k
Ḍ - Convert to integer

# Perl 5, 26 bytes

includes a byte for -n (-M5.01 is free)

($.="1$.0")%$_?redo:say$.

## Explanation

$. starts off with value 1. We immediately concatenate it with 1 beforehand and 0 afterward, yielding 110, and reassign that to $. — that's what the $.="1$.0" does.

The assignment returns the assigned value so when we take it modulo the input number $_ we obtain 0 (false) if 110 is divisible by the input and nonzero (true) otherwise. • In the latter case, we redo, i.e. repeat the block (the -n switch makes the whole thing a loop block, and incidentally, assigns $_ to the input number). This concatenates another 1 and 0, yielding 11100, etc.
• If 110, or 11100, or 1111000, or whatever we're up to, is divisible by the input, we stop and say (print) it.

Note that every number divides such a number (i.e. that has one more 1 than the numbers of 0s it has). After all, if it divides something with more 1s than 0s, you can append 0s and it'll still divide that. And if divides something with fewer 1s than 0s, say m 1s and n 0s with m < n, then it also divides the number with 2m 1s and n 0s.

## Sage, 33 bytes

lambda n:'1'*9*euler_phi(n)+'0'*n

This uses xnor's method to produce the output.

Try it online

# 05AB1E, 8 bytes

$Õ9*×Î×«  Port of @xnor's Mathematica answer, so make sure to upvote him!! Explanation: $         # Push 1 and the input-integer
Õ        # Pop the input, and get Euler's totient of this integer
9*      # Multiply it by 9
×     # Repeat the 1 that many times as string
Î    # Push 0 and the input-integer
×   # Repeat the 0 the input amount of times as string
«  # Concatenate the strings of 1s and 0s together
# (after which the result is output implicitly)

A more to-the-point iterative approach would be 11 bytes:

TS∞δ×øJ.ΔIÖ

Explanation:

T             # Push 10
S            # Convert it to a list of digits: [1,0]
∞           # Push an infinite positive list: [1,2,3,...]
δ          # Apply double-vectorized on these two lists:
×         #  Repeat the 1 or 0 that many times as string
# (we now have a pair of infinite lists: [[1,11,111,...],[0,00,000,...]])
ø       # Zip/transpose; swapping rows/columns:
#  [[1,0],[11,00],[111,000],...]
J      # Join each inner pair together:
#  [10,1100,111000,...]
.Δ    # Find the first value in this list which is truthy for:
IÖ  #  Check that it's divisible by the input-integer
# (after which the result is output implicitly)

# bc, 58 bytes

define f(n){for(x=1;m=10^x/9*10^x;++x)if(m%n==0)return m;}

## Sample results

200: 111000
201: 111111111111111111111111111111111000000000000000000000000000000000
202: 11110000
203: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000
204: 111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000
205: 1111100000
206: 11111111111111111111111111111111110000000000000000000000000000000000
207: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
208: 111111000000
209: 111111111111111111000000000000000000
210: 111111000000
211: 111111111111111111111111111111000000000000000000000000000000
212: 11111111111110000000000000
213: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
214: 1111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000
215: 111111111111111111111000000000000000000000
216: 111111111111111111111111111000000000000000000000000000
217: 111111111111111111111111111111000000000000000000000000000000
218: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
219: 111111111111111111111111000000000000000000000000

# dc, 27 bytes

Odsm[O*lmdO*sm+O*dln%0<f]sf

This defines a function f that expects its argument in the variable n. To use it as a program, ?sn lfx p to read from stdin, call the function, and print the result to stdout. Variable m and top of stack must be reset to 10 (by repeating Odsm) before f can be re-used.

## Results:

200: 111000
201: 111111111111111111111111111111111000000000000000000000000000000000
202: 11110000
203: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000
204: 111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000
205: 1111100000
206: 11111111111111111111111111111111110000000000000000000000000000000000
207: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
208: 111111000000
209: 111111111111111111000000000000000000
210: 111111000000
211: 111111111111111111111111111111000000000000000000000000000000
212: 11111111111110000000000000
213: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
214: 1111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000
215: 111111111111111111111000000000000000000000
216: 111111111111111111111111111000000000000000000000000000
217: 111111111111111111111111111111000000000000000000000000000000
218: 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
219: 111111111111111111111111000000000000000000000000
`


1. ## Completing the Square

What is the minimum point of the graph of the equation

y = 2x^2 + 8x + 9?

I understand the minimum point is the vertex (h, k).

To complete the square, I set the function to zero first.

2x^2 + 8x + 9 = 0

I then subtracted 9 from both sides.

2x^2 + 8x = -9

I then took half of the second term and squared it.

2x^2 + 8x = 16 - 9

Where do I go from here?

2. Hello !

y = 2x² + 8x + 9
y = 2 (x² + 4x + 9/2)
y = 2 ((x+2)²+1/2)

Therefore the minimum point of the graph is such as x+2=0 => x=-2 and y=1

3. Originally Posted by magentarita
What is the minimum point of the graph of the equation

y = 2x^2 + 8x + 9?

I understand the minimum point is the vertex (h, k).

To complete the square, I set the function to zero first.

2x^2 + 8x + 9 = 0

I then subtracted 9 from both sides.

2x^2 + 8x = -9

I then took half of the second term and squared it.

2x^2 + 8x = 16 - 9

Where do I go from here?
===============================================
magentarita,
I see where your problem is.
2x^2 + 8x = -9 ------ ok so far.
Before you take half of the secod term and square,
Make sure the coefficient of suared term 2x^2 to be 1.
Therefore, 2x^2 + 8x = -9
becomes (x^2) + 4x = -9/2 -- simply didived by 2.
(x^2) + 4x = -9/2 -- now you are ready to take half of the secod term and square, you get
(x^2) + 4x + 2^2 = (-9/2 ) + 2^2
(x + 2)^2 = -1/2 now complete the square part is done at this point.
Rewrite original question to y = [(x + 2)^2 ]+ 1/2
Can you see y = a ( x-h )^2 + k --- standard form.
Vertex is at ( h, k ) = ( -2, 1/2) and a =1
Opens up vertically, therefor, mini. point is at vertex.

4. ## ok............

Originally Posted by 2976math
===============================================
magentarita,
I see where your problem is.
2x^2 + 8x = -9 ------ ok so far.
Before you take half of the secod term and square,
Make sure the coefficient of suared term 2x^2 to be 1.
Therefore, 2x^2 + 8x = -9
becomes (x^2) + 4x = -9/2 -- simply didived by 2.
(x^2) + 4x = -9/2 -- now you are ready to take half of the secod term and square, you get
(x^2) + 4x + 2^2 = (-9/2 ) + 2^2
(x + 2)^2 = -1/2 now complete the square part is done at this point.
Rewrite original question to y = [(x + 2)^2 ]+ 1/2
Can you see y = a ( x-h )^2 + k --- standard form.
Vertex is at ( h, k ) = ( -2, 1/2) and a =1
Opens up vertically, therefor, mini. point is at vertex.

ok but none the choices given for the minimum point is (-2, 1/2).

(2,33)

(2,17)

(-2,-15)

(-2,1)

5. ## ok....

Originally Posted by running-gag
Hello !

y = 2x² + 8x + 9
y = 2 (x² + 4x + 9/2)
y = 2 ((x+2)²+1/2)

Therefore the minimum point of the graph is such as x+2=0 => x=-2 and y=1
You got the right answer. But how did you get y = 1?

I got y = 1/2

6. Originally Posted by magentarita
You got the right answer. But how did you get y = 1?

I got y = 1/2
Substitute x= -2 into the expression :
2 [ (-2+2)² + 1/2 ] = 2 [ 0+1/2 ] = 1

7. Originally Posted by magentarita
ok but none the choices given for the minimum point is (-2, 1/2).

(2,33)

(2,17)

(-2,-15)

(-2,1)
I found the problem!
y should be 1 not 1/2, so answer (-2,1) is correct.

Reason: I forgot to divid y by 2.

Remember orginal question: y =( 2x^2 ) + 8x +9

(1/2) y = (x^2) + 4x + ( 9/2) -- divid by 2 both side

(1/2) y = [( x +2)^2 ] + (1/2) -- complete square right side

y = 2 [( x +2)^2 ] + 1 ----- multiply 2 both side

y = a [ ( x-h)^2 ] + k

where a=2, h=-2, k=1 sorry

8. I think you were originally trying to solve for the minimum point by finding the vertex through the method of 'completing the square'.

From $y=ax^2+bx+c$, you want to convert to $y=a(x-h)^2+k$, where $(h, k)$ represent the vertex of your parabola and thus the maximum or minimum point depending on a<0 or a>0.

$y=2x^2+8x+9$ Factor 2 out of first 2 terms

$y=2(x^2+4x)+9$ Next, complete the square in parentheses.

$y=2(x^2+4x+4)+9-8$ Notice that we added 2 times 4, so we subtract 8 to balance the side

$y=2(x+2)^2+1$ Now, we're in vertex form.

$V(h, k)=V(-2, 1) = \ \ minimum \ \ point$

9. ## ok.........

Originally Posted by Moo
Substitute x= -2 into the expression :
2 [ (-2+2)² + 1/2 ] = 2 [ 0+1/2 ] = 1
By subbing -2 for x, I get y = 1.

I got it.

10. ## ok..........

Originally Posted by 2976math
I found the problem!
y should be 1 not 1/2, so answer (-2,1) is correct.

Reason: I forgot to divid y by 2.

Remember orginal question: y =( 2x^2 ) + 8x +9

(1/2) y = (x^2) + 4x + ( 9/2) -- divid by 2 both side

(1/2) y = [( x +2)^2 ] + (1/2) -- complete square right side

y = 2 [( x +2)^2 ] + 1 ----- multiply 2 both side

y = a [ ( x-h)^2 ] + k

where a=2, h=-2, k=1 sorry

Be be sorry, be right. We all make mistakes, right?

11. ## ok..........

Originally Posted by masters
I think you were originally trying to solve for the minimum point by finding the vertex through the method of 'completing the square'.

From $y=ax^2+bx+c$, you want to convert to $y=a(x-h)^2+k$, where $(h, k)$ represent the vertex of your parabola and thus the maximum or minimum point depending on a<0 or a>0.

$y=2x^2+8x+9$ Factor 2 out of first 2 terms

$y=2(x^2+4x)+9$ Next, complete the square in parentheses.

$y=2(x^2+4x+4)+9-8$ Notice that we added 2 times 4, so we subtract 8 to balance the side

$y=2(x+2)^2+1$ Now, we're in vertex form.

$V(h, k)=V(-2, 1) = \ \ minimum \ \ point$
I enjoyed the steps as a guide. Well-done!


# Problems that become easier in a more general form

When solving a problem, we often look at some special cases first, then try to work our way up to the general case.

It would be interesting to see some counterexamples to this mental process, i.e. problems that become easier when you formulate them in a more general (or ambitious) form.

## Motivation/Example

Recently someone asked for the solution of $a,b,c$ such that $\frac{a}{b+c} = \frac{b}{a+c} = \frac{c}{a+b} (=t).$

Someone suggested writing this down as a system of linear equations in terms of $t$ and solving for $a,b,c$. It turns out, either (i) $a=b=c$ or (ii) $a+b+c=0$.

Solution (i) is obvious from looking at the problem, but (ii) was not apparent to me until I solved the system of equations.

Then I wondered how this would generalize to more variables, and wrote the problem as: $$\frac{x_i}{\sum x - x_i} = \frac{x_j}{\sum x - x_j} \quad \forall i,j\in1,2,\dots,n$$

Looking at this formulation, both solutions became immediately evident without the need for linear algebra (for (ii), set $\sum x=0$ so each denominator cancels out its numerator).

-
The linked Question : math.stackexchange.com/questions/897118/… – lab bhattacharjee Aug 16 '14 at 12:16
Well, I personally don't think this is actually simplification by generalization, but rather simplification motivated by generalization. Like if you write $\frac{a}{b+c}$ as $\frac{a}{(a + b + c) - a}$, you'd say that the problem becomes obvious too. – Tunococ Aug 16 '14 at 12:59
@Tunococ Fair enough, I'm just saying that writing it like this didn't occur to me until I thought of generalizing it. I understand that this is all a little subjective (hence the "soft-question" tag). – MGA Aug 16 '14 at 13:01
This is relevant. – Julien Godawatta Aug 16 '14 at 13:58
Introducing topology makes certain proofs in real analysis clearer and more elegant, though I'm not sure whether they are necessarily easier per se. – Harry Johnston Aug 17 '14 at 0:24

Consider the following integral $\displaystyle\int_{0}^{1}\dfrac{x^7-1}{\ln x}\,dx$. All of our attempts at finding an anti-derivative fail because the antiderivative isn't expressable in terms of elementary functions.

Now consider the more general integral $f(y) = \displaystyle\int_{0}^{1}\dfrac{x^y-1}{\ln x}\,dx$.

We can differentiate with respect to $y$ and evaluate the resulting integral as follows:

$f'(y) = \displaystyle\int_{0}^{1}\dfrac{d}{dy}\left[\dfrac{x^y-1}{\ln x}\right]\,dx = \int_{0}^{1}x^y\,dx = \left[\dfrac{x^{y+1}}{y+1}\right]_{0}^{1} = \dfrac{1}{y+1}$.

Since $f'(y) = \dfrac{1}{y+1}$, we have $f(y) = \ln(y+1)+C$ for some constant $C$.

Trivially, $f(0) = \displaystyle\int_{0}^{1}\dfrac{x^0-1}{\ln x}\,dx = \int_{0}^{1}0\,dx = 0$. Hence $C = 0$, and thus, $f(y) = \ln(y+1)$.

Therefore, our original integral is $\displaystyle\int_{0}^{1}\dfrac{x^7-1}{\ln x}\,dx = f(7) = \ln 8$.

This technique of generalizing an integral by introducing a parameter and differentiating w.r.t. that parameter is known as Feynman Integration.

-
Great example! Really neat – mattecapu Aug 16 '14 at 19:59
My favorite illustration so far. Of course the others are nice too. – MGA Aug 16 '14 at 20:22
The special form (not only the general form) can also easily be determined by setting $\ln x=-t$ and then use Frullani's integral. – Tunk-Fey Aug 17 '14 at 14:44
The integrand does have an anti-derivative in terms of the upper incomplete gamma function: $\Gamma(0, -\ln x) - \Gamma(0, -8\,\ln x)$. That still doesn't help because it's undefined at both limits of integration. – Tavian Barnes Aug 17 '14 at 21:52
@Tunk-Fey You're right, apologies. Deleting my comment. – MGA Aug 18 '14 at 11:39

George Polya's book How to Solve It calls this phenomenon "The Inventor's Paradox": "The more ambitious plan may have more chances of success." The book gives several examples, including the following.

1) Consider the problem: "A straight line and a regular octahedron are given in position. Find a plane that passes through the given line and bisects the volume of the given octahedron." If we generalize this to "a straight line and a solid with a center of symmetry are given in position..." it becomes very easy. (The plane goes through the center of symmetry and the line.)

The book also gives other examples of the Inventor's Paradox, but "more ambitious" is not always the same as "more general." Consider: "Prove that $1^3 + 2^3 + 3^3 + ... + n^3$ is a perfect square." Polya shows that it is easier to prove (by mathematical induction) that "$1^3 + 2^3 + 3^3 + ... + n^3 = (1 + 2 + 3 + ...+ n)^2$". This is more ambitious but is not more general.

The web page Generalizations in Mathematics gives many similar examples. It even gets into the difference between "more ambitious" and "more general."

-
Good point regarding generality/ambitiousness, and both are interesting. I have made a minor edit to the question to reflect this. – MGA Aug 16 '14 at 12:51
In the first the easy approach is "more general" in the sense that it picks out the significant property of an entity and ignores any other particular properties it may have. There are loads of examples like it, for example any time you're asked to prove some property of a particular group that's true of all Abelian groups, or some property of a particular function that's true of any continuous monotonic function, and so on. The problem is, "identify the useful property of this object", so the more general problem where you only have the useful property is always easier ;-) – Steve Jessop Aug 16 '14 at 19:26
The cubes and square example, termed 'more ambitious', is an example of the technique of solving a problem by the addition of an invented constraining hypothesis, and thus is actually a case of particularization. – Jose Brox Aug 20 '14 at 8:00

I recall something like this coming up when evaluating certain summations. For example, consider:

$$\sum_{n=0}^{\infty} {n \over 2^n}$$

We can generalize this by letting $f(x) = \sum_{n=0}^{\infty} nx^n$, so:

\begin{align} {f(x) \over x} &= \sum_{n=0}^{\infty} nx^{n-1} \\ &= {d \over dx} \sum_{n=0}^{\infty} x^n \\ &= {d \over dx} {1 \over {1-x}} = {1 \over (x-1)^2} \end{align}

Therefore,

$$f(x) = {x \over (x-1)^2}$$

The solution to the original problem is $f({1 \over 2}) = 2$.

-
Interestingly, this also shows $\sum_{n=0}^\infty \frac{1}{2^n} = \sum_{n=0}^\infty \frac{n}{2^n}$, which succeeded at surprising me. :) – Keba Aug 3 '15 at 23:26

The solution to the Monty Hall problem

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, follows the fixed protocol of opening another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

becomes more obvious when you generalize it to an $N$-door problem with the host opening $N-2$ doors. For $N\gg3$ most people's intuition revolts against staying with the original choice.

-
A more helpful approach to the standard Monty Hall is to examine what is wrong with the above formulation. The story, as told here, is consistent with a game show where the host offers a chance to switch only to contestants who have already chosen the correct door. When playing that game, you should never switch regardless of how many doors there are. In the standard problem, it is explicitly stated that the host will always offer the switch. That's what makes the odds $N-1$ to $1$ in favor of the switch; and $2$-to-$1$ odds is good enough. – David K Aug 16 '14 at 15:22
@DavidK - the text I included is Wikipedia's description of the Monty Hall problem. Have modified it. – Johannes Aug 16 '14 at 20:20
The problem has been underspecified in some widely-read sources; no surprise one of those got copied to Wikipedia. I'll accept this version as implying the player knows the fixed protocol. In that case, if someone's intuition requires $N$ to be increased above $3$ before they think the switch is beneficial, they do not understand the reason why it is beneficial. They have merely been nudged from an incorrect guess to an unjustified but luckily correct guess. – David K Aug 18 '14 at 23:12
@DavidK: I think that would be a fair criticism of someone who claims to be game-theoretically rational, but I doubt such a person exists; would a reasonable person expect a Bayes factor of $2:1$ to come to his rescue? Even though it wouldn't be necessary to the idealised mathematical observer with the eyes of a hawk, in many contexts exaggerating the difference helps me notice there is one, whence I can see via a monotonicity argument that the effect is non-zero (if weak) for $N \gtrsim 3$. – Vandermonde Feb 16 '15 at 19:27
Heck, what I thought negligible was a raw probability of 1/6, which I ought to appreciate even then. – Vandermonde Feb 16 '15 at 21:25

I'm not entirely convinced that problems made somehow easier by generalizations is exactly what is going on here.

In the example provided in your question, what made the solution to the general problem appear easier is that it dawned on you that $$x_1+\cdots+x_{j-1}+x_{j+1}+\cdots+x_n=\sum_{i=1}^nx_i-x_j.$$ Indeed, (as tunococ commented) had the less general problem been written as $$\frac{a}{a+b+c-a}=\frac{b}{a+b+c-b}=\frac{c}{a+b+c-c},$$ then your easier solution to the general problem applies here as well. I would argue that, if anything, the generalization helped you notice a pattern you had not before seen. Would you still have noticed this pattern had you not formulated the problem in a general way? Perhaps, perhaps not.

In my opinion, what your experience shows is that formulating a problem $Q$ in more general terms $P$ is one of many ways by which one can gain a fundamental insight that provides the key to the solution of the general problem $P$ (and thus inevitably also solves the initial special case $Q$ also). Sometimes, this can lead to a solution that was as of yet unknown to you and that will be more elegant or easier than the previous solutions. However, given that such an insight could easily have come without generalizing the problem, the fact that the solution did come from you thinking about the generalization seems highly circumstantial to me.

EDIT: JimmyK4542's example (and Feynmann's integration trick) seems like a spectacular demonstration of the phenomenon, however.

-
I merely meant that as an example to get the discussion started, and you're of course right that in this case one doesn't have to generalize to see the solution. But personally, I didn't think of writing $+a-a$ etc. because I didn't feel the need to. Once I considered the general case, I was compelled to write it like this. Anyway, I think that better examples have now been given on here that really illustrate the point - I'm particularly fond of the Feynman integration trick. – MGA Aug 16 '14 at 20:16
JimmyK4542's example (and Feynmann's integration trick in general) indeed contradicts my claim that a solution to a general problem always applies to a special case. I'll edit this out. – user78270 Aug 16 '14 at 23:53

On this site one frequently finds under the linear-algebra tag questions of the kind: what is the determinant of a matrix $$\begin{pmatrix}a&b&b&b\\b&a&b&b\\b&b&a&b\\b&b&b&a\end{pmatrix}?$$ (I've just posted this question, which contains a list of such questions). It turns out finding an answer to this question becomes almost trivial (see my answer to the linked question) when reformulated more generally as

What is the characteristic polynomial of a square matrix$~A$ of rank$~1$?

knowing that by specialisation the answer gives the determinant of $\lambda I-A$ for any scalar$~\lambda$.

-

From time to time famous problems have such feature. History suggests this point: the transcendentalness of $\pi$ solves the long-lasting problem of squaring a circle, analytic geometry and irrationality theory solve the problem of doubling a cubic, Galois's invention of group theory and quintic function, Kummer's invention of ideals and Fermat's last theorem, global differential geometry and Chern's intrinsic proof of Gauss-Bonnet theorem, and so on.

-

A broadly successful application of this was introduced by Richard Bellman under the phrase dynamic programming. The story of the "birth" of this now foundational topic in applied math is told largely in Bellman's own words here.

A related term gives more evidence of the connection of ideas: invariant imbedding.

A good discussion of dynamic programming references and examples came up early at StackOverflow, but was subsequently closed as off-topic.

An illustration is finding a shortest path between two specified points by "imbedding" that problem in finding all shortest paths from one point, Dijkstra's algorithm.

-

Generalization comes up a lot when doing induction. For example,

$$\forall n ~~ \sum_{k=0}^n 2^{-k} \le 2$$

is difficult to prove directly using induction on $n$. However, if you generalize to a stronger statement:

$$\forall n ~~ \sum_{k=0}^n 2^{-k} \le 2 - 2^{-n}$$

Then induction may be used directly:

$$\sum_{k=0}^{n+1} 2^{-k} \le 2 - 2^{-n - 1}$$ $$\sum_{k=0}^n 2^{-k} + 2^{-n-1} \le 2 - 2^{-n - 1}$$ $$\sum_{k=0}^n 2^{-k}\le 2 - 2^{-n}$$

Obviously you could see that it is a geometric series, but that is a generalization also.

problems that become easier when you formulate them in a more general (or ambitious) form

The potential difficulty of a generalization isn't the only disadvantage. If you disprove a generalization, then you haven't disproven the original theorem. In that respect, a generalization effectively forces you to pick sides in the investigation of a theorem.

-

The most spectacular example I have seen is this one:

Suppose A is an $n\times n$ matrix with eigenvalues $\lambda_1$, ..., $\lambda_n$, including each eigenvalue according to its multiplicity. Then $A^2$ has eigenvalues $\lambda_1^2$, ..., $\lambda_n^2$ including multiplicity.

To prove this is in fact very very hard. (It's easy to show that $\lambda_1^2$, ..., $\lambda_n^2$ are all eigenvalues of $A$ by considering their eigenvectors, but unless you the dimensions of the eigenspaces match the multiplicities you're stuck.)

However, the proof of the following statement is actually perfectly possible using elementary arguments (albeit clever arguments):

Suppose A is an $n\times n$ matrix with eigenvalues $\lambda_1$, ..., $\lambda_n$, including each eigenvalue according to its multiplicity. Then for any polynomial $g(x)$, $g(A)$ has eigenvalues $g(\lambda_1)$, ..., $g(\lambda_n)$ including multiplicity.

-

A nice example appeared on this web site today: Every prime number $p\ge 5$ has $24\mid p^2-1$ .

As posed, the problem sounds like it might be difficult. But it is very easy to show the more general result that every $n$ of the form $6k\pm 1$ has the required property.

-


# For a prime $p$, determine the number of positive integers whose greatest proper divisor is $p$

I'm having a bit of difficulty writing a graceful proof for the following problem:

For a prime $p$, determine the number of positive integers whose greatest proper divisor is $p$.

Let $A$ be the set of positive integers whose greatest proper divisor is $p$. I will show that $A=\{\alpha p\,|\,\alpha \;\text{prime},\; \alpha \leq p\}$ so that $|A|=\pi(p)$, the number of primes less than or equal to $p$.

Assume that $n=\alpha p$ for some prime $\alpha \leq p$. The factors of $n$ are $1, \alpha, p, \alpha p$. (In the case that $\alpha =p$, the factors of $n$ are $1,p, p^2$.) The greatest proper divisor of $n$ therefore is $p$ and so $n\in A$.

Conversely, for any number in $A$, clearly we have that $p$ is the greatest prime dividing it. Moreover, any three primes dividing it would contradict $p$ being the greatest divisor (this can be seen in the following way: if $\alpha_1\neq \alpha_2$ are two primes dividing the number, neither of which is $p$, then we have $\alpha_1<p<\alpha_1p<\alpha_1\alpha_2p$ from which we infer that $p$ is not the greatest proper divisor.) Therefore, a number in $A$ must have at most two prime factors, one being $p$. (We can rule out that a number in $A$ has exactly the one prime factor, $p$, since it has no proper divisors.) Hence, $A\subset \{\alpha p\,|\,\alpha \;\text{prime},\; \alpha \leq p\}$.

Perhaps there's a more elegant proof, but I'm concerned with my writing style. Can anyone help me rephrase my argument in a smoother way or critique it?

edit: incorporated the changes suggested by Henning.

-
Isn't that what I did in the first paragraph? –  sasha Oct 5 '11 at 22:48
perhaps you did –  Henry Oct 5 '11 at 22:54

Looks sound and direct to me. There is only minor copy-editing to do, such as:

• The condition $2\le\alpha$ is redundant; it is already implied by $\alpha$ being prime.

• The part "Let $n\in\{\alpha p\,|\,\alpha \;\text{prime},\; 2\leq \alpha \leq p\}$. Then $n=\alpha p$ for some prime $\alpha$, $2\leq \alpha \leq p$" is probably more verbose than you need to be. I would just write, "Assume that $n=\alpha p$ for some prime $\alpha \leq p$."

• To make the structure of the proof more explicit, you could write "Conversely," rather than "Now," at the beginning of the third paragraph. This tells the reader that you have now finished something and is proceeding to the opposite direction of what you just proved.

• Calling the other prime $q$ would be somewhat more conventional than $\alpha$.

-
Great, thank you for the suggestions. Last thing--if you could judge from this one post, would you say that my mathematical writing is verbose overall? Definitely would like to change that... –  sasha Oct 6 '11 at 7:49


# Math Help - trig integration

1. ## trig integration

After I complete $\int \frac{\sqrt{x^2-9}}{x}\,dx$ by sec substitution I get

$3\sec^{-1}\left(\frac{x}{3}\right)-\sqrt{x^2-3}+C$.

But this doesn't match the calculator's answer:

$3\tan^{-1}\left(\frac{\sqrt{x^2-9}}{3}\right) - \sqrt{x^2-3}+C$

After differentiating the result my answer is different as well... I thought the answers we got would be equivalent though...

Then the second question is $f(x) = 3$. Find the equation.

2. Originally Posted by DivideBy0
After I complete $\int \frac{\sqrt{x^2-9}}{3}\,dx$ by sec substitution I get

$3\sec^{-1}\left(\frac{x}{3}\right)-\sqrt{x^2-3}+C$.

But this doesn't match the calculator's answer:

$3\tan^{-1}\left(\frac{\sqrt{x^2-9}}{3}\right) - \sqrt{x^2-3}+C$

After differentiating the result my answer is different as well... I thought the answers we got would be equivalent though...

Then the second question is $f(x) = 3$. Find the equation.
I guess the right integral is: $\int \frac{\sqrt{x^2-9}}{x}\,dx$

3. Woops, sorry, you're right that's what I meant

4. Hello, DivideBy0!

After I complete $\int \frac{\sqrt{x^2-9}}{x}\,dx$ by sec substitution I get: . $3\sec^{-1}\! \left(\frac{x}{3}\right)-\sqrt{x^2-3}+C$.

But this doesn't match the calculator's answer: / $3\tan^{-1}\!\left(\frac{\sqrt{x^2-9}}{3}\right) - \sqrt{x^2-3}+C$
The answers are equivalent.

Let $\theta \:=\:\sec^{-1}\!\left(\frac{x}{3}\right)$
Then we have: . $\sec\theta \:=\:\frac{x}{3} \:=\:\frac{hyp}{adj}$

$\theta$ is in a right triangle with: $adj = 3,\;hyp = x$

. . Using Pythagorus: . $opp = \sqrt{x^2-9}$

So: . $\tan\theta \:=\:\frac{\sqrt{x^2-9}}{3}$
Hence:. . $\theta \:=\:\tan^{-1}\!\left(\frac{\sqrt{x^2-9}}{3}\right)$

See? . . . . . $\sec^{-1}\!\left(\frac{x}{3}\right) \;=\;\tan^{-1}\left(\frac{\sqrt{x^2-9}}{3}\right)$

5. Originally Posted by DivideBy0
After I complete $\int \frac{\sqrt{x^2-9}}{x}\,dx$ by sec substitution I get

$3\sec^{-1}\left(\frac{x}{3}\right)-\sqrt{x^2-3}+C$.

But this doesn't match the calculator's answer:

$3\tan^{-1}\left(\frac{\sqrt{x^2-9}}{3}\right) - \sqrt{x^2-3}+C$

After differentiating the result my answer is different as well... I thought the answers we got would be equivalent though...

Then the second question is $f(x) = 3$. Find the equation.
the answar is
$-3\sec^{-1}\left(\frac{x}{3}\right)+\sqrt{x^2-9}+C$.
or

$-3\cos^{-1}\left(\frac{3}{x}\right)+\sqrt{x^2-9}+C$.

6. Thanks Soroban for clearing it up a bit more... but when I differentiated on the calculator I still got

$\frac{d}{\,dx}\left(3\sec^{-1}(\frac{x}{3})-\sqrt{x^2-3}\right)=\frac{9|\frac{1}{x}|}{\sqrt{x^2-9}}-\frac{x}{\sqrt{x^2-3}}$

But the original expression obviously has no absolute value signs.

7. Originally Posted by DivideBy0
$\int \frac{\sqrt{x^2-9}}{x}\,dx$
You don't even need trig. sub. - this only requires a simple substitution.

Step #1: The make-up.

$\int {\frac{{\sqrt {x^2 - 9} }}
{x}\,dx} = \int {\frac{{\sqrt {x^2 - 9} \cdot x}}
{{x^2 }}\,dx} .$

Step #2: The substitution.

$u^2 = x^2 - 9 \implies u\,du = x\,dx,$

$\int {\frac{{\sqrt {x^2 - 9} }}
{x}\,dx} = \int {\frac{{u^2 }}
{{u^2 + 9}}\,du} .$

Step #3: Simple trick & mission almost-accomplished.

$\int {\frac{{u^2 }}
{{u^2 + 9}}\,du} = \int {du} - 9\int {\frac{1}
{{u^2 + 9}}\,du} = u - 3\arctan \frac{u}
{3}+k.$

Step #4: Back substitute.

$\int {\frac{{\sqrt {x^2 - 9} }}
{x}\,dx} = \sqrt {x^2 - 9} - 3\arctan \frac{{\sqrt {x^2 - 9} }}
{3} + k.$


# Ways of selecting $3$ balls out of $9$ balls if at least one black ball is to be selected

A box contains two white, three black, and four red balls. In how many ways can three balls be drawn from the box if at least one black ball is to be included in the draw.

The answer given is $$64$$. I attempted the problem with two different approaches.

My two different attempts:

Attempt #1
Number of ways in which any $$3$$ balls can be drawn out of $$9$$ balls $$\binom{9}{3}=84$$ Number of ways in which no black balls are drawn out of $$9$$ balls (choosing $$3$$ balls from the remaining $$6$$ balls) $$\binom{6}{3}=20$$ Thus, the number of ways of choosing at least $$1$$ black ball is $$84-20=64$$

Attempt #2
Number of ways of drawing $$1$$ black ball out of $$3$$ black balls $$\binom{3}{1}=3$$ Now, we have to draw two more balls, we can choose those balls from the $$8$$ remaining balls $$\binom{8}{2}=28$$ Since both the above events are associated with each other, by fundamental principle of counting, the number of ways of drawing at least one black ball out of the $$9$$ balls is $$3\times28=84$$

I think my second attempt should also be right. Please explain what I'm doing wrong with my second attempt.

The second attempt counts the combination $$\{B_1,B_2,B_3\}$$ three times as $$(B_1, \{B_2, B_3\})$$, $$(B_2, \{B_3, B_1\})$$ and $$(B_3, \{B_1, B_2\})$$.

N.B: $$(B_i, \{B_j, B_k\})$$ means pick $$B_i$$ first, followed by the combination $$\{B_j, B_k\}$$.

We have the basic product rule

$$|A\times B| = \#\{(a,b) \mid A \times B\} = |A| \times |B|$$

for cardinals which holds for any sets $$A$$ and $$B$$.

By writing $$3 \times 28$$, you are actually counting $$\{B_1, B_2, B_3\} \times \{B_2,B_3, \dots\}$$, which doesn't answer the problem.

In , $$(a,b)$$ is defined as $$\{a,\{a,b\}\}$$, so order matters.

• Would you please elaborate the answer? I get that the second attempt is wrong, but I'm unable to understand it clearly. – Azelf Dec 7 '18 at 20:14
• @Azelf My original notation would be clear enough. I've edited my answer to make it even clearer. – GNUSupporter 8964民主女神 地下教會 Dec 7 '18 at 20:57

A selection of three balls that includes at least one black ball has either one black ball and two of the other six balls, two blacks balls and one of the other six balls, or three black balls and none of the other six balls. Therefore, the number of ways of selecting at least one black ball when three balls are selected from two white, three black, and four red balls is $$\binom{3}{1}\binom{6}{2} + \binom{3}{2}\binom{6}{1} + \binom{3}{3}\binom{6}{0} = 45 + 18 + 1 = 64$$
You counted each case in which $$k$$ black balls were selected $$k$$ times, once for each of the $$k$$ ways you could have designated one of those black balls as the designated black ball. Notice that $$\color{red}{\binom{1}{1}}\binom{3}{1}\binom{6}{2} + \color{red}{\binom{2}{1}}\binom{3}{2}\binom{6}{1} + \color{red}{\binom{3}{1}}\binom{3}{3}\binom{6}{0} = 45 + 36 + 3 = 84$$ To illustrate, place numbers on the black balls. If you select black balls $$b_1$$ and $$b_2$$ and a red ball, you count this selection twice: $$\begin{array}{c c} \text{designated black ball} & \text{additional balls}\\ b_1 & b_2, r\\ b_2 & b_1, r \end{array}$$ If you select all three black balls, you count this selection three times: $$\begin{array}{c c} \text{designated black ball} & \text{additional balls}\\ b_1 & b_2, b_3\\ b_2 & b_1, b_3\\ b_3 & b_1, b_2 \end{array}$$


Is there a combinatorial way to see the link between the beta and gamma functions?

The Wikipedia page on the beta function gives a simple formula for it in terms of the gamma function. Using that and the fact that $\Gamma(n+1)=n!$, I can prove the following formula: $$\begin{eqnarray*} \frac{a!b!}{(a+b+1)!} & = & \frac{\Gamma(a+1)\Gamma(b+1)}{\Gamma(a+1+b+1)}\\ & = & B(a+1,b+1)\\ & = & \int_{0}^{1}t^{a}(1-t)^{b}dt\\ & = & \int_{0}^{1}t^{a}\sum_{i=0}^{b}\binom{b}{i}(-t)^{i}dt\\ & = & \int_{0}^{1}\sum_{i=0}^{b}\binom{b}{i}(-1)^{i}t^{a+i}dt\\ & = & \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\int_{0}^{1}t^{a+i}dt\\ & = & \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\left[\frac{t^{a+i+1}}{a+i+1}\right]_{t=0}^{1}\\ & = & \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+1}\\ b! & = & \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{(a+b+1)!}{a!(a+i+1)} \end{eqnarray*}$$ This last formula involves only natural numbers and operations familiar in combinatorics, and it feels very much as if there should be a combinatoric proof, but I've been trying for a while and can't see it. I can prove it in the case $a=0$: $$\begin{eqnarray*} & & \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{(b+1)!}{0!(i+1)}\\ & = & \sum_{i=0}^{b}(-1)^{i}\frac{b!(b+1)!}{i!(b-i)!(i+1)}\\ & = & b!\sum_{i=0}^{b}(-1)^{i}\frac{(b+1)!}{(i+1)!(b-i)!}\\ & = & b!\sum_{i=0}^{b}(-1)^{i}\binom{b+\text{1}}{i+1}\\ & = & b!\left(1-\sum_{i=0}^{b+1}(-1)^{i}\binom{b+\text{1}}{i}\right)\\ & = & b! \end{eqnarray*}$$ Can anyone see how to prove it for arbitrary $a$? Thanks!

• The usual interpretation of "combinatoric proof" (that I'm accustomed to) is to show that the beta function counts something; what exactly do you mean by "combinatoric proof" here? Oct 12, 2011 at 17:15
• In any event: it might be more interesting to establish this relationship instead... Oct 12, 2011 at 17:18
• I'm with @J.M. - your derivation for $a=0$ doesn't really look like a combinatorial proof, as you're using only symbolic manipulation instead of counting and combining objects.
– anon
Oct 12, 2011 at 21:03

Here's a combinatorial argument for $a!\, b! = \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{(a+b+1)!}{(a+i+1)}$, which is just a slight rewrite of the identity you want to show.

Suppose you have $a$ red balls numbered $1$ through $a$, $b$ blue balls numbered $1$ through $b$, and one black ball.

Question: How many permutations of the balls have all the red balls first, then the black ball, and then the blue balls?

Answer 1: $a! \,b!$. There are $a!$ ways to choose the red balls to go in the first $a$ slots, $b!$ ways to choose the blue balls to go in the last $b$ slots, and $1$ way for the black ball to go in slot $a+1$.

Answer 2: Let $A$ be the set of all permutations in which the black ball appears after all the red balls (irrespective of where the blue balls go). Let $B_i$ be the subset of $A$ such that the black ball appears after blue ball $i$. Then the number of permutations we're after is also given by $|A| - \left|\bigcup_{i=1}^b B_i\right|$. Since the probability that the black ball appears last of any particular $a+i+1$ balls is $\frac{1}{a+i+1}$, and there are $(a+b+1)!$ total ways to arrange the balls, by the principle of inclusion-exclusion we get $$\frac{(a+b+1)!}{a+1} - \sum_{i=1}^{b}\binom{b}{i}(-1)^{i+1}\frac{(a+b+1)!}{(a+i+1)} = \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{(a+b+1)!}{(a+i+1)}.$$

• Fantastic! How did you find this? Oct 12, 2011 at 22:17
• @Steven: I thought about it for way too long. :) More seriously, an alternating binomial sum smells like inclusion-exclusion to me. I also thought I could generalize my answer to a similar question, and that turned out to work, although it took a while to get the formulation right. I kept trying to apply inclusion-exclusion to the full set of permutations, and it finally hit me that I only needed to consider subsets of the set I call $A$. And thanks! Oct 12, 2011 at 22:30
• Nicely done indeed!
– robjohn
Oct 13, 2011 at 0:37
• @robjohn: And thanks for the edit. Not sure how I managed to leave that out! :) Oct 13, 2011 at 1:32
• Beautiful, this is exactly the kind of answer I was hoping for, thank you! Oct 13, 2011 at 7:04

Using partial fractions, we have that $$\frac{1}{(a+1)(a+2)\dots(a+b+1)}=\frac{A_1}{a+1}+\frac{A_2}{a+2}+\dots+\frac{A_{b+1}}{a+b+1}\tag{1}$$ Use the Heaviside Method; multiply $(1)$ by $(a+k)$ and set $a=-k$ to solve $(1)$ for $A_k$: $$A_k=\frac{(-1)^{k-1}}{(k-1)!(b-k+1)!}=\frac{(-1)^{k-1}}{b!}\binom{b}{k-1}\tag{2}$$ Plugging $(2)$ into $(1)$, yields $$\frac{a!}{(a+b+1)!}=\sum_{k=1}^{b+1}\frac{(-1)^{k-1}}{b!}\binom{b}{k-1}\frac{1}{a+k}\tag{3}$$ Multiplying $(3)$ by $b!$ and reindexing, gives us $$\frac{a!b!}{(a+b+1)!}=\sum_{k=0}^{b}(-1)^k\binom{b}{k}\frac{1}{a+k+1}\tag{4}$$ and $(4)$ is your identity.

Update: Starting from the basic binomial identity $$(1-x)^b=\sum_{k=0}^b(-1)^k\binom{b}{k}x^k\tag{5}$$ multiply both sides of $(5)$ by $x^a$ and integrate from $0$ to $1$: $$B(a+1,b+1)=\sum_{k=0}^b(-1)^k\binom{b}{k}\frac{1}{a+k+1}\tag{6}$$

• FYI: This argument appears on pages 188-189 of Concrete Mathematics, 2nd edition, where it is discussed in the context of the $n$th forward difference formula. Oct 12, 2011 at 20:50
• This identity is one of my favorite uses of partial fractions and it turns up when using Euler's Transform for series acceleration.
– robjohn
Oct 12, 2011 at 21:00
• @Mike: not surprising since it computes the $b^{th}$ forward difference of $\frac{1}{a+1}$. Thanks for the reference!
– robjohn
Oct 12, 2011 at 21:02

Seven years later I found another way to attack this. Define $$f(b, a) = \frac{a!b!}{(a+b+1)!}$$ and $$h(b, a) = \sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+1}$$. To connect the two, we define $$g$$ such that $$g(0, a) = \frac{1}{a + 1}$$ and $$g(b + 1, a) = g(b, a) - g(b, a + 1)$$ and prove by induction in $$b$$ that $$f = g = h$$. In each case the base case is straightforward and we consider only the inductive step.

$$\begin{eqnarray*} & & g(b + 1, a) \\ & = & g(b, a) - g(b, a + 1) \\ & = & f(b, a) - f(b, a + 1) \\ & = & \frac{a!b!}{(a+b+1)!} - \frac{(a+1)!b!}{(a+b+2)!} \\ & = & \frac{a!b!(a + b + 2)}{(a+b+2)!} - \frac{a!b!(a+1)}{(a+b+2)!} \\ & = & \frac{a!b!(b+1)}{(a+b+2)!} \\ & = & \frac{a!(b+1)!}{(a+b+2)!} \\ & = & f(b+1, a)\\ \end{eqnarray*}$$

$$\begin{eqnarray*} & & g(b + 1, a) \\ & = & g(b, a) - g(b, a + 1) \\ & = & h(b, a) - h(b, a + 1) \\ & = & \left(\sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+1}\right) - \left(\sum_{i=0}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+2}\right) \\ & = & \frac{1}{a+1} + \left(\sum_{i=1}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+1}\right) - \left(\sum_{i=0}^{b-1}\binom{b}{i}(-1)^{i}\frac{1}{a+i+2}\right) - (-1)^{b}\frac{1}{a+b+2}\\ & = & \frac{1}{a+1} + \left(\sum_{i=1}^{b}\binom{b}{i}(-1)^{i}\frac{1}{a+i+1}\right) + \left(\sum_{i=1}^{b}\binom{b}{i-1}(-1)^{i}\frac{1}{a+i+1}\right) + (-1)^{b+1}\frac{1}{a+b+2}\\ & = & \frac{1}{a+1} + \left(\sum_{i=1}^{b}\left(\binom{b}{i} + \binom{b}{i-1}\right)(-1)^{i}\frac{1}{a+i+1}\right) + (-1)^{b+1}\frac{1}{a+b+2}\\ & = & \frac{1}{a+1} + \left(\sum_{i=1}^{b}\binom{b+1}{i}(-1)^{i}\frac{1}{a+i+1}\right) + (-1)^{b+1}\frac{1}{a+b+2}\\ & = & \sum_{i=0}^{b+1}\binom{b+1}{i}(-1)^{i}\frac{1}{a+i+1} \\ & = & h(b + 1, a) \\ \end{eqnarray*}$$


# Taxonomy of polygons

I've written a tree-like layout to help myself remember which polygons are sub-types of others, because I always get confused. I was just wondering if this is right:

|quadrilateral
|parallelogram
|rectangle
|square
|oblong
|rhomboid
|kite (corrected after rschwieb's answer, a rhombus is a kite)
|rhombus
|square
|trapezoid(AmE) / trapezium (BrE)

So a square is a rhombus and a parallelogram.

Also, I know that there are two definitions of "trapezoid." Under the inclusive definition "trapezoid" is immediately under "quadrilateral" in the tree and above parallelogram and kite. Under this definition all squares are trapezoids.

Is my tree correct, at least ignoring the difference in the trapezoid definition difference?

Edit: Thanks to rschwieb for helping me realise that a rhombus is a kite. There is also a nice Euler diagram Wikipedia

You need to see this post I wrote some time ago.

In short, the education system (at least in the US) has confused this issue and made it harder than it has to be.

There is a very natural hierarchy the depends on logical connections between quadrilaterals, and there is really no benefit to using the “exclusive version” of definitions.

I would argue for this picture for the main characters:

Actually there is a little puzzle where you can figure out a new node to insert between "quadrilateral" and "kite" which also connects to "parallelogram," and I have never seen this shape mentioned in a textbook. It's just not common enough to encounter in normal life.

• I see in your chart you've used the inclusive definition of trapezoid, that's all good. I see the difference between this chart and the "frankenstein" chart you referred to is that the kite is in a separate area on its own, but in yours it traces down to rhombus. In yours it shows a rhombus as being a kite. This seems unintuitive with my everyday notion of a kite, but Wikipedia says: "If all four sides of a kite have the same length (that is, if the kite is equilateral), it must be a rhombus." Also, the other chart doesn't link the kite to the rhombus at all. I think this chart is easier. – Zebrafish Apr 21 '18 at 2:21
• There's just one thing I see wrong with it, a rectangle is an isosceles trapezoid? Are those two supposed to be connected with a line over on the right? – Zebrafish Apr 21 '18 at 2:49
• "Rectangles and squares are usually considered to be special cases of isosceles trapezoids though some sources would exclude them." Wow, there are a few a discrepancies in definitions, that's not helping. – Zebrafish Apr 21 '18 at 2:52
• @Zebrafish as I mentioned “exclusive definitions” aren’t as useful, they’re harder to state, and make proving things less convenient. – rschwieb Apr 21 '18 at 3:41
• @Zebrafish yes, I would cal a rectangle an isosoles trapezoid. – rschwieb Apr 21 '18 at 3:43

Can't a kite also be a parallelogram, in the case where all sides are equal?

That of course depends on your definition of kite... I've rarely seen the term used at all. You can exclude that case specifically and your tree is then okay.

Wikipedia's Kite (geometry) article seems to include that in their special cases.

EDIT: In that special case, it can also be a rhombus or a square

• A kite that’s also a parallelogram is a rhombus. – rschwieb Apr 21 '18 at 3:45