CoCalc Public Filesteaching / math-3012b / notes / a_combinatorial_identity.sagews
Author: Fidel Barrera-Cruz
Views : 40
Compute Environment: Ubuntu 18.04 (Deprecated)

︠ba0cbcd0-06df-4074-98fd-c0655b4073eei︠
%md
An example for the combinatorial identity $\binom{n}{k}=\binom{n-1}{k-1}+\binom{n-1}{k}$
========================================================================================

Consider the set $[n]=\{1,2,\dots,n\}$. Recall that the LHS counts the number of ways to choose $k$ elements from $[n]$, or in other words the number of $k$-sets of $[n]$. At the RHS the term $\binom{n-1}{k-1}$ counts the number of $k$-sets of $[n]$ that contain the element $n$ (note that $n$ "has been chosen" and we are only left to choose $k-1$ from the remaining $n-1$); the term $\binom{n-1}{k}$ counts the number of $k$-sets of $[n]$ that do not contain the element $n$ (all $k$ elements are chosen from $[n-1]$).

Below we illustrate the identity with an example. We set $n=6$ and $k=4$. The identity is now $\binom{6}{4}={\color{red}\binom{5}{3}}+{\color{blue}\binom{5}{4}}$ (or $15={\color{red}10}+{\color{blue}5}$ ). Sets that contain the element $6$ are colored red and sets that do not contain $6$ are colored blue.



# An example for the combinatorial identity $\binom{n}{k}=\binom{n-1}{k-1}+\binom{n-1}{k}$

Consider the set $[n]=\{1,2,\dots,n\}$. Recall that the LHS counts the number of ways to choose $k$ elements from $[n]$, or in other words the number of $k$-sets of $[n]$. At the RHS the term $\binom{n-1}{k-1}$ counts the number of $k$-sets of $[n]$ that contain the element $n$ (note that $n$ "has been chosen" and we are only left to choose $k-1$ from the remaining $n-1$); the term $\binom{n-1}{k}$ counts the number of $k$-sets of $[n]$ that do not contain the element $n$ (all $k$ elements are chosen from $[n-1]$).

Below we illustrate the identity with an example. We set $n=6$ and $k=4$. The identity is now $\binom{6}{4}={\color{red}\binom{5}{3}}+{\color{blue}\binom{5}{4}}$ (or $15={\color{red}10}+{\color{blue}5}$ ). Sets that contain the element $6$ are colored red and sets that do not contain $6$ are colored blue.

0: {1, 2, 3, 4}
1: {1, 2, 3, 5}
2: {1, 2, 3, 6}
3: {1, 2, 4, 5}
4: {1, 2, 4, 6}
5: {1, 2, 5, 6}
6: {1, 3, 4, 5}
7: {1, 3, 4, 6}
8: {1, 3, 5, 6}
9: {1, 4, 5, 6}
10: {2, 3, 4, 5}
11: {2, 3, 4, 6}
12: {2, 3, 5, 6}
13: {2, 4, 5, 6}
14: {3, 4, 5, 6}