## Binomial coefficients
\providecommand{\ddx}{\frac{d}{dx}}
\providecommand{\ddz}{\frac{d}{dz}}

# Miscellaneous Curiosities

Recall:
    ***) For $n$ a non-negative integer and $r$ an integer,
	${n \choose r} =$ number of subsets of size $r$ of a set of size $n$
        :   $= \frac{n!}{n!(n-r)!} \quad$ if $0 <= r <= n$
        :   $= 0 \quad\quad$ else.

    ** Pascal's triangle

    ** Pascal's Formula: ${n \choose r} = {n-1 \choose r} + {n-1 \choose r-1}$

    ** ${n \choose r} = {n \choose n-r}$

    ** $\sum_{r=0}^n {n \choose r} = 2^n$

    ** $(x+y)^n = \sum_{r=0}^n {n \choose r} x^{n-r}y^r$
    *e)*

Remark:
    ${n \choose r} =$ number of paths from root of Pascal's triangle to the
    $(n,r)$ position.

Further identities:
    ***) $k{n \choose k} = n{n-1 \choose k-1}$
        (immediate from ${n \choose k} = \frac{n(n-1)...(n-k+1)}{k(k-1)...1}$)

    ** $(x+1)^n = \sum_{r=0}^n {n \choose r} x^r$

    ** $0 = ((-1) + 1)^n = \sum_{r=0}^n {n \choose r} (-1)^r$;
        so alternating sum of binomial coefficients is 0;
        so sum of even coefficients = sum of odd coefficients $= 2^{n-1}$.
    *e)*

Yet further identities:
    **(i) ${n+1 \choose r+1} = \sum_{s=0}^n {s \choose r}$
    ** $\sum_{r=0}^n {n \choose r}^2 = {2n \choose n}$
    ** $\sum_{r=0}^n r {n \choose r} = n2^{n-1}$
    *ee*
Proofs:
    **(i) Iteratively apply Pascal's formula:
        ${n+1 \choose r+1} = {n \choose r+1} + {n \choose r}$
        :   $= {n-1 \choose r+1} + {n-1 \choose r}$
        :   $= ...$
        :   $= {0 \choose r+1} + {0 \choose r} + ... + {n-1 \choose r}$
        :   $= {0 \choose r} + ... + {n-1 \choose r}$
    
        Alternative inductive proof:
        Easily holds for $n=r=0$.
        Suppose inductively it holds for smaller $n+r$.
        Then using Pascal's formula, we have:
        ${n+1\choose r+1} = {n \choose r+1} + {n \choose r}$
        :   $= \sum_{k=0}^{n-1} {k \choose r} + \sum_{k=0}^{n-1} {k \choose r-1}$
        :   $= \sum_{k=0}^{n-1} ({k \choose r} + {k\choose r-1})$
        :   $= \sum_{k=0}^{n-1} {k+1 \choose r}$
        :   $= \sum_{k=1}^{n} {k \choose r}$
        :   $= \sum_{k=0}^{n} {k \choose r}$

    ** Consider diamonds in Pascal's triangle.

	OR: Given a set $S$ of size $2n$, arbitrarily split it into two sets
	$S_1,S_2$ of size $n$.
	Then an $n$-subset $S'$ of $S$ corresponds to
	the pair $(S' \cap S_1, S' \cap S_2)$.
	The pairs of subsets arising in this way are precisely those of sizes
	summing to $n$,
	so
	:    ${2n \choose n} = \sum_{r=0}^n {n \choose r}{n \choose n-r} = \sum_{r=0}^n {n \choose r}^2$

    ** Neat algebraic proof:
        $n (x+1)^{n-1} = \ddx(x+1)^n = \ddx \sum_{r=0}^n {n \choose r} x^r$
        :   $= \sum_{r=0}^n r {n \choose r} x^r$.
        This holds for all $x$; taking $x=1$ gives the result.

    *ee*
Examples of (i):
    ***) ${n \choose 1} = \sum_{s=0}^{n-1} {s \choose 0} = \sum_{s=0}^{n-1} 1 = n$
    **${n \choose 2} = \sum_{s=0}^{n-1} {s \choose 1} = \sum_{s=0}^{n-1} s =$ $n$th triangular number
    **${n \choose 3} = \sum_{s=0}^{n-1} {s \choose 2} =$ $n$th pyrimidal number
    *e)*


# Multinomial theorem

What is the coefficient $a_{r,s,t}$ of $x^ry^sz^t$ in the expansion of $(x+y+z)^n$?

Clearly $a_{r,s,t} != 0$ only if $r+s+t=n$.

$a_{r,s,t}$ is the number of ways of choosing $r$ $x$'s, $s$ $y$'s, and $t$
$z$'s from the $n$ factors $(x+y+z)$;
i.e. the number of strings like "xyzzyxyzzy" with this many of each letter;
i.e. the number of permutations of the multiset $\{ r*x, s*y, t*z \}$.

So as we saw before,
:   $a_{r,s,t} = \frac{n!}{r!s!t!}$.

Write ${n \choose r\;s\;t}$ for this number.

Generalising to arbitrarily many variables, we have

Theorem:
    $(x_1 + ... + x_t)^n = \sum_{n_i >= 0,n_1+...+n_t=n}
        {n \choose n_1\;n_2\;...\;n_t} x_1^{n_1}x_2^{n_2}...x_t^{n_t}$

Here, ${n \choose n_1\;n_2\;...\;n_t} = \frac{n!}{n_1!...n_t!}$
are the _multinomial coefficients_ (only defined if $n_1+...+n_t=n$).

Note:
    ${n \choose r} = {n \choose r\;n-r}$.

The number of terms in the multinomial expansion of $(x_1+...+x_t)^n$ is the
number of $n$-combinations with $t$ types in unlimited supply, which we saw is
:   ${n+t-1 \choose n}$.


# Unnatural exponents: $(x+y)^\alpha$

Theorem [Newton's Binomial Theorem]:
    Let $\alpha$ be a real (or even complex) number.
    Suppose $0 <= |x| < |y|$.
    Then
    :   $(x+y)^\alpha = \sum_{k=0}^\infty {\alpha \choose k} x^k y^{\alpha-k}$
    
    where
    :   ${\alpha \choose k} = \frac{\alpha(\alpha-1)...(\alpha-k+1)}{k!}$.

Note that for $\alpha$ natural, this agrees with our previous definition.

Proof (not on syllabus):
    Dividing through by $y^\alpha$, sufficient to show that for $|z|<1$,
    :   $(1+z)^\alpha = \sum_{k=0}^\infty {\alpha \choose k} z^k$.

    We show this for complex $z$ with $|z|<1$.
    $(1+z)^\alpha = \exp(\alpha\log(1+z))$ for any choice of branch.
    This is holomorphic on the domain $|z|<1$,
    so the Taylor series at 0 converges to the value of the function on this domain.

    Since $\ddz (1+z)^\alpha = \alpha(1+z)^{\alpha-1}$ and $(1+0)^\alpha=1$,
    this gives
    :   $(1+z)^\alpha = ((1+z)^\alpha |_{z=0})\frac{z^0}{0!} +$
    :       $(\alpha(1+z)^{\alpha-1}|_{z=0})\frac{z^1}{1!} +$
    :       $(\alpha(\alpha-1)(1+z)^{\alpha-2}|_{z=0})\frac{z^2}{2!} + ...$
    :   $= \sum_{k=0}^\infty (\alpha(\alpha-1)...(\alpha-k+1))\frac{z^k}{k!}$
    :   $= \sum_{k=0}^\infty {\alpha \choose k} z^k$
    \qed

Examples:
    ***) $\frac{1}{1+z} = (1+z)^{-1}$
        :   $= \sum_{k=0}^\infty {-1 \choose k} z^k$
        :   $= \sum_{k=0}^\infty \frac{(-1)*(-2)*...*(-k)}{k*(k-1)*...*1} z^k$
        :   $= \sum_{k=0}^\infty (-1)^k z^k$
        :   $= 1 - z + z^2 - z^3 + ...$

    **
        :   $\sqrt{37} = \sqrt{6^2+1} = 6\sqrt{1+1/36} = 6(1+1/36)^{1/2}$
        :       $= 6(\sum_{k=0}^\infty {1/2 \choose k} (1/36)^k)$

        Now for $k>0$,
        :   ${1/2\choose k} = \frac{ \frac{1}{2}\frac{1-2}{2}...\frac{1-2(k-1)}{2} }{k!}$
        :       $= \frac{(-1)^{k-1} 1*3*5*...*(2k-3)}{2^k k!}$
        :       $= \frac{(-1)^{k-1} (2k-2)!}{2^k (2*4*...*(2k-2)) k!}$
        :       $= \frac{(-1)^{k-1} (2k-2)!}{2^{2k-1} (k-1)! k!}$
        :       $= \frac{(-1)^{k-1}}{k 2^{2k-1}} {2k-2 \choose k-1}$

        So
        :   $\sqrt{1+z} = 1 + \sum_{k=1}^\infty \frac{(-1)^{k-1}}{k 2^{2k-1}} {2k-2 \choose k-1} z^k$
        :       $= 1 + \frac{1}{2}z - \frac{1}{8}z^2 + \frac{1}{16}z^3 - \frac{1}{25}z^4 + ...$

        So $\sqrt{37} = 6(1+1/36)^{1/2}$
        :   $~~ 6(1 + 1/(2*36) - 1/(8*36^2) + 1/(16*36^3) - 1/(25*36^4))$
        :   $= 6.0828$

        (Error is very small: $(6*(1 + 1/(2*36) - 1/(8*36^2) + 1/(16*36^3) - 1/(25*36^4)))^2 = 36.99999992692224$)

    *e)*
