# The Yanghui Triangle, Part I

Many of you know Yanghui’s Triangle as Pascal’s triangle.  However, about 500 years earlier (according to Wolfram Mathworld), a Chinese mathematician Yanghui studied this triangle. In China, it is referred to as the Yanghui Triangle.

How is it produced? In my previous blog post, Counting Can Be Really Tough, I introduced you to combinations.  As a quick review, we use combinations when we want to count the number of ways you want to select things from a total of n different things.  The notation and formula for it are given as

${}_nC_r = \frac{n!}{r!(n-r)!}$

Examples: Say you want 5 cards from 52 randomly.  You can plug this into your calculator using the ${}_nC_r$ button by first putting in 52 and then pressing that key, plugging in 5, and then pressing Enter.

If you don’t have a calculator handy, open up another window for WolframAlpha, and plug any of the following in: “nCr(52,5)”, “52 nCr 5”, or “Binomial[52,5]”.  Confirm you answer at the bottom of this post.

In the mathematics world, the notation $\binom{n}{r}$ is used instead of ${}_nC_r$, as you’ll find it on your calculator.

## Construction of the Triangle

WE begin with n=0. The only value that r can be is 0 in the combination formula.  The very top value of the triangle is ${}_0C_0 = \binom{0}{0} = 1$.

Now, we will derive the second row (or the first row if you want to think of the top row as the zeroth row). For this row, n increases to 1.  We can either choose nothing from 1 thing, or we can choose the 1 thing, so r can either be 0 or 1.  You can confirm with a calculator or WolframAlpha that

$\displaystyle \binom{1}{0}=\binom{1}{1}=1$.

We’ll analyze one more row and let the reader generalize to further rows.

With n=2 now, we can either select nothing, 1 thing, or both things.  There is 1 way, 2 ways, and 1 way of doing this, respectively.  Again, you can confirm that

$\displaystyle \binom{2}{0}=1, \,\,\, \binom{2}{1}=2, \,\,\, \binom{2}{2}=1$.

At each new level n, there are n+1 values along the row as r ranges from 0 to n.

## A Few Properties

Upon construction of the triangle, we notice that it could have been constructed by

1. Putting 1’s down the diagonals, and then
2. Add the two numbers above to get the number below.

Let’s think about what these mean mathematically.  We’ll begin with number 1. If we think in terms of selecting r things from a total of things, number 1 above means that there is only 1 way of selecting 0 things from n things (vacuous), and there is only 1 way of selecting n things from n things (you must select them all).  This works for any number n.

What can we deduce from number 2?  Let’s choose a specific example to start.  Using the value 15 in the row that begins 1, 6, 15, 20, etc., we see that this is the sum of 5 and the 10 in the previous row.  The 5 and the 10 in that row were results from choosing 1 thing from 5 things, that is $\binom{5}{1}=5$, and choosing 2 things from 5 things, that is $\binom{5}{2}=10$.

The 15 in the row below it is a result of choosing 2 things from 6 things, that is $\binom{6}{2}=15$.  Putting these together, we have

$\displaystyle \binom{6}{2}=\binom{5}{1}+\binom{5}{2}$.

For the more general result, lets pretend the 6 above is n and that the 2 we select from the 6 is r. Then the general result can be written as

$\displaystyle \binom{n}{r}=\binom{n-1}{r-1}+\binom{n-1}{r}$,

which can also be shown algebraically with formulas. But who wants to do that?

This is what mathematicians do. We generalize and look for patterns.  Using this relationship instead of a calculator, try and find $\binom{9}{3}$.  Answer is below.

## An Alternative to the “FOIL” Method

Remember FOIL?  These letters stand for “First, Outer, Inner, Last,” and the mnemonic is used when wanting to multiply expressions such as $(x+2y)(3x-y)$.

First, you multiply the first terms in each expression to get $3x^2$.

Next, you multiply the outer terms of the expression to get $-xy$.

Third, you multiply the inner terms of the expression to get $6xy$.

Finally, you multiply the last terms of the expression to get $-2y^2$.

When you add these together and combine the like terms you get

$\displaystyle 3x^2-xy+6xy-2y^2 = 3x^2+5xy-2y^2.$

Let’s try another that will lead to the usefulness of Yanghui’s Triangle. That is, expanding expressions like $(x+y)^2$.  Writing it as $(x+y)(x+y)$ and following the same procedure above produces $x^2+2xy+y^2.$

If you’ll allow me to write that $1x^2+2xy+1y^2$, it is easier to see that the coefficients of each of the terms matches the specific row when n=2. It is no coincidence that the n=2 matches the power to which $(x+y)$ is raised.

Indeed, Yanghui’s Triangle can be used to quickly expand expressions in the form $(x+y)^n$.  See if you can recognize the pattern in the expansion of $(x+y)^6$:

$\displaystyle x^6+6x^5y+15x^4y^2+20x^3y^3+15x^2y^4+6xy^5+y^6$.

Try to expand the much easier $(x+y)^4$. Answer is below.

Why do these combination values match up with the coefficients in this expansion?  Suppose we were to attempt to expand $(x+y)^6$ manually:

$\displaystyle (x+y)^6 = (x+y)(x+y)(x+y)(x+y)(x+y)(x+y).$

From a counting perspective, you can get a $x^2y^4$ term by multiplying the x from the 1st and the 4th expressions with the y’s in the 2nd, 3rd, 5th, and 6th expressions.  Since there are 6 expressions you are multiplying together, 2 of which need to be x’s, then there are $\binom{6}{2} = 15$ ways of getting the $x^2y^4$ term.

Pretty cool, huh?  Again, this is what mathematicians love.  Seeking and understanding patterns.  For Part II of this post, we will explore some other properties and how the Fibonacci sequence emerges from Yanghui’s Triangle.

### Answers to above posed questions

${}_{52}C_{5} = 2598960$

$\binom{9}{3} = \binom{8}{2}+\binom{8}{3} = 28+56 = 84$ directly from triangle.

$(x+y)^4 = x^4+4x^3y+6x^2y^2+4xy^3+y^4$.