125. The number of subsets of a set

125.1 Definition: binomial coefficient

$C(n,k)$ denotes the number of $k$-element subsets of an $n$-element set.

125.1.1 Example $C(4,0) = 1$ (there is exactly one subset with no elements in a set with 4 elements), $C(4,1) = 4$ (there are four singleton subsets of a four-element set) and $C(4,2) = 6$ (count them).

We can deduce some immediate consequences of the definition:

125.2 Theorem

For all $n \geq 0$ and $k \geq 0$,

a) $C(n,0) = 1$.

b) $C(n,n) = 1$.

c) $C(n,k) = C(n,n-k)$.

d) $C(n,k) = 0$ if $k > n$.

Proof

a) There is exactly one empty subset of any set, so $C(n,0) = 1$ for any $n$.

b) An $n$-element set clearly has exactly one subset with $n$ elements, namely itself.

c) This follows from the fact that for a particular $k$ there is a bijection between $k$ element subsets of an $n$-element set and their complements, which of course are $(n-k)$-element subsets.

d) Obvious.

$C(n,k)$ is called a binomial coefficient because of the formula in the following theorem. $C(n,k)$ is also written $\dbinom{n}{k}$.

125.3 Theorem

For all real $x$ and $y$ and all nonnegative integers $n$ and $k$,

$$(x+y)^n = \sum_{k=0}^{n} C(n,k)x^{n-k}y^k \tag{125.1}$$

I won’t give a formal proof, but just sketch the idea.

$$(x+y)^n = (x+y)(x+y)\cdots(x+y) \tag{125.2}$$

where $(x+y)$ occurs $n$ times in the expression on the right. In the expanded version of $(x+y)^n$, each term occurs by selecting an $x$ or a $y$ in each factor of the right side of Equation (125.2) and multiplying them together (try this on $(x+y)(x+y)(x+y)$). You get one occurrence of $x^{n-k}y^k$ by choosing a subset of $k$ factors (out of the $n$ that occur) and using $y$ from those factors and $x$ from the $n-k$ other factors. There are $C(n,k)$ ways to do this, so that Equation (125.1) follows.

125.4 Recurrence relation for $C(n,k)$

We can get a recurrence relation for $C(n,k)$ which will allow us to calculate it.

Suppose, for a fixed $k$, we want to know $C(n+1,k)$, the number of $k$-element subsets of an $n+1$-element set $A$. Let $a\in A$. Then we can get each subset of $A$ that has $a$ in it exactly once by adjoining $a$ to a $(k-1)$-element subset of $A-\{a\}$, so there are $C(n,k-1)$ $k$-element subsets of $A$ that have $a$ as an element. On the other hand, every $k$-element subset of $A$ that does not contain $a$ as an element is a $k$-element subset of $A-\{a\}$, so there are $C(n,k)$ of them.

Every subset of $A$ either has $a$ as an element or not, so we have the following theorem:

125.5 Theorem

For all $n\geq 0$ and $k>0$,

$$\left\{\begin{array}{rcll} C(n,0) &=& 1 & \\ C(n,k) &=& 0 & \text{if } k>n \\ C(n+1,k) &=& C(n,k-1)+C(n,k) & \text{otherwise.} \end{array}\right. \tag{125.3}$$

125.5.1 Example

$$\begin{align} C(4,2) &= C(3,1)+C(3,2) \\ &= C(2,0)+C(2,1)+C(2,1)+C(2,2) \\ &= 1+2\cdot C(2,1)+C(2,2) \\ &= 1+2(C(1,0)+C(1,1))+C(1,1)+C(1,2) \tag{125.4} \\ &= 1+2(1+C(0,0)+C(0,1))+C(0,0)+C(0,1) \\ &= 1+2\cdot 2+1=6 \tag{125.5} \end{align}$$

125.5.2 Example The recurrence relation for $C(n,k)$ can be used to give an inductive proof of Theorem 125.3.

The basis step is to prove that

$$(x+y)^0 = \sum_{k=0}^{0} C(0,k)x^{-k}y^k$$

The sum on the right has only one term, namely $C(0,0)x^0y^0$, which is 1, as is the expression on the left.

Inductive step: Assume

$$(x+y)^n = \sum_{k=0}^{n} C(n,k)x^{n-k}y^k$$

We must prove

$$(x+y)^{n+1} = \sum_{k=0}^{n+1} C(n+1,k)x^{n+1-k}y^k$$

We now make a calculation. In this calculation it is convenient to define $C(n,-1)$ to be 0.

$$\begin{aligned} (x+y)^{n+1} &= (x+y)(x+y)^n \\ &= (x+y)\sum_{k=0}^{n} C(n,k)x^{n-k}y^k \quad\text{by induction hypothesis} \\ &= x\sum_{k=0}^{n} C(n,k)x^{n-k}y^k + y\sum_{k=0}^{n} C(n,k)x^{n-k}y^k \\ &= \sum_{k=0}^{n} C(n,k)x^{n+1-k}y^k + \sum_{k=0}^{n} C(n,k)x^{n-k}y^{k+1} \\ &\qquad\text{(now change $k$ to $k-1$ in the second term)} \\ &= \sum_{k=0}^{n} C(n,k)x^{n+1-k}y^k + \sum_{k=1}^{n+1} C(n,k-1)x^{n-(k-1)}y^k \\ &= \sum_{k=0}^{n+1} \bigl(C(n,k)+C(n,k-1)\bigr)x^{n+1-k}y^k \\ &= \sum_{k=0}^{n+1} C(n+1,k)x^{n+1-k}y^k \quad\text{by Theorem 125.5} \end{aligned}$$

Note that I changed the limits on the sum in the next to last line of this proof, using the facts that $C(n,n+1)=0$ and $C(n,-1)=0$.

There is a sense in which this proof forces you to believe Theorem 125.3, but the earlier proof (on page 191) explains why it is true. Mathematicians sometimes call a proof like the earlier one a conceptual proof.

The following theorem gives an explicit formula for the binomial coefficient.

125.6 Theorem

For $0\leq k\leq n$,

$$C(n,k) = \frac{n!}{k!(n-k)!} \tag{125.6}$$

The proof is omitted.

125.6.1 Worked Exercise Find the number of strings of length $n$ in $\{a,b,c\}^{*}$ that contain exactly two $a$’s. Answer Now that we have the function $C(n,r)$ we can solve this using the idea of Worked Exercise 114.2.2. To construct such a string, we must choose two locations in the string where the two $a$’s will be. There are $C(n,2)$ ways of doing this. Then there are two choices ($b$ or $c$) for each of the other locations, so the answer is $C(n,2)\cdot 2^{n-2}$, which by Theorem 125.6 is

$$\frac{n(n-1)}{2}2^{n-2}$$

125.6.2 Proving identities for the binomial coefficient An enormous number of identities are known for the binomial coefficient. We consider one here to illustrate how one goes about proving such identities. The identity is

$$\sum_{k=0}^{n} C(n,k)^2 = C(2n,n) \tag{125.7}$$

This can be proved using the recurrence relation of Theorem 125.5, but the proof is rather tedious. I quail with terror at the idea of using the formula in Theorem 125.6 to prove this theorem.

It is much easier to use Definition 125.1. $C(2n,n)$ is the number of ways of choosing $n$ balls from a set of $2n$ balls. Now suppose that we have $2n$ balls and $n$ of them are red and $n$ of them are green. Then an alternative way of looking at the task of choosing $n$ balls from this set is that we must choose $k$ red balls and $n-k$ green balls for some integer $k$ such that $0\leq k\leq n$. For a particular $k$ there are $C(n,k)C(n,n-k)$ ways of doing this. By Theorem 125.2(c), this is the same as $C(n,k)^2$. Altogether this alternative method of choosing a $n$-element subset gives

$$\sum_{k=0}^{n} C(n,k)^2$$

possibilities.

125.6.3 Remark Like most concepts in mathematics, $C(n,k)$ has a conceptual definition, namely Definition 125.1, and a method of calculating it, in this case two of them: Theorems 125.5 and 125.6. It is generally good advice to try the conceptual approach first.

In this case there is a second conceptual description, as coefficients in a polynomial (Formula 125.1), and in fact that formula allows a faily easy second proof of Formula (125.7).

125.6.4 Exercise Prove that $\sum_{k=0}^{n} C(n,k) = 2^n$.

125.6.5 Exercise Prove that $\sum_{k=0}^{n} (-1)^k C(n,k) = 0$ for $n>0$.

125.6.6 Exercise Prove two ways that for all $n\geq 4$,

$$C(n,3) = \frac{n-2}{3}\cdot C(n,2)$$

a) Prove it by using the definition of $C(n,k)$.

b) Prove it using formula (125.6).

125.6.7 Exercise Prove Theorem 125.6. (It can be done by induction, but is a bit complicated.)

125.6.8 Exercise Prove Formula (125.7) using Formula (125.1).

125.6.9 Exercise Let $F(n,k)$ be the number of strings of length $n$ in $\{a,b,c\}^{*}$ with exactly $k$ $b$’s. Find a formula or recurrence relation for $F(n,k)$.

125.6.10 Exercise Derive a formula or recurrence relation for the number of strings of length $n$ in $\{a,b\}^{*}$ with the same number of $a$’s as $b$’s.

125.6.11 Exercise (hard) Find a recurrence relation for the number of partitions of an $n$-element set that have exactly $k$ blocks.

125.6.12 Exercise (hard) Prove formula (125.6).

Pages 190–195 of the book (PDF).