︠3b7b6754-1520-4b9a-8243-70faeeb53359︠ ︠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. ︡509b058a-5869-4676-9282-2378d334bbf9︡{"done":true,"md":"An example for the combinatorial identity $\\binom{n}{k}=\\binom{n-1}{k-1}+\\binom{n-1}{k}$\n========================================================================================\n\nConsider 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]$).\n\nBelow 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."} ︠df036ab7-e8fd-4951-ae9d-fb0a5ba87f27i︠ for i,s in enumerate(Subsets(6,4)): color = 'red' if 6 in s else 'blue' html_set = """{2}: {0}
""".format(s,color,i+1) html(html_set) ︡f442d42a-daeb-42f7-b148-6d173bec18ac︡{"hide":"input"}︡{"html":"0: {1, 2, 3, 4}
"}︡{"hide":"input"}︡{"html":"1: {1, 2, 3, 5}
"}︡{"hide":"input"}︡{"html":"2: {1, 2, 3, 6}
"}︡{"hide":"input"}︡{"html":"3: {1, 2, 4, 5}
"}︡{"hide":"input"}︡{"html":"4: {1, 2, 4, 6}
"}︡{"hide":"input"}︡{"html":"5: {1, 2, 5, 6}
"}︡{"hide":"input"}︡{"html":"6: {1, 3, 4, 5}
"}︡{"hide":"input"}︡{"html":"7: {1, 3, 4, 6}
"}︡{"hide":"input"}︡{"html":"8: {1, 3, 5, 6}
"}︡{"hide":"input"}︡{"html":"9: {1, 4, 5, 6}
"}︡{"hide":"input"}︡{"html":"10: {2, 3, 4, 5}
"}︡{"hide":"input"}︡{"html":"11: {2, 3, 4, 6}
"}︡{"hide":"input"}︡{"html":"12: {2, 3, 5, 6}
"}︡{"hide":"input"}︡{"html":"13: {2, 4, 5, 6}
"}︡{"hide":"input"}︡{"html":"14: {3, 4, 5, 6}
"}︡{"done":true}︡ ︠c34f2c5a-f831-4fe6-bdd9-f7830a69efb9︠ ︡03e20c9e-ae01-4002-95d9-ec1729009da6︡{"done":true}︡