In chess, a rook can move only in straight lines (not diagonally). How many ways can the rook in the top-left corner travel to the bottom-right corner of the board, moving only down and to the right?
The 6 in the square in the 3rd row and column represents that there are 6 different paths to that square, even though there are only four squares the rook must move through to get there. One path is DDRR (down down right right). List all 6 paths.
Continue filling in the chessboard, either counting D/R strings directly or using your observation from the previous task. What is the number in the lower right corner of the chessboard?
In 1653, Blaise Pascal, concerned with questions that would lay the foundation of probability theory, collected several facts about a triangular array of numbers in his Treatise on Arithmetical Triangle. This arrangement of numbers appeared as early as the 10th century in China, India, and Persia. The Chinese and Persian treatment of the triangle was in service of what we would now consider algebra: finding th roots, essentially solving polynomial equations. The numbers in the triangle appear as solutions to counting problems in Indian texts: from six tastes, how many combinations of one, or two, or three,... can you make? European mathematicians in the 14th century presented the triangle as a table of figurate numbers (numbers that can be arranged in a geometric shape), which were themselves the centerpiece of the work of Pythagoras and his followers.
The first 17 rows of Pascalβs triangle. A triangular array of hexagons, each row containing one more hexagon that the row above it. In each hexagon is an integer: 1βs on the border of the triangle, and every integer inside the triangle the sum of the two integers above it.
Spend some time gazing at the beauty of this triangle. What do you notice? What do you wonder? Look specifically at the 5th row (we call the 1 on the top row 0, so row 5 is 1, 5, 10, 10, 5, 1). How do the numbers in this row relate to the numbers above them? Notice that and . Does this occur anywhere else in the triangle?
Indeed, every number in the triangle is the sum of the two numbers above it. Letβs take this as our definition of Pascalβs triangle. We can then generate as many rows of the triangle as we like. It is this additive definition that was used in China and Persia to find th roots, and we will briefly mention this use at the end of this section. However, we are interested in counting questions, so our main goal now is to observe how the numbers of Pascalβs triangle are answers to a variety of counting questions.
Here are some apparently different discrete objects we can count: lattice paths, bit strings, subsets, and pizzas. We will give an example of each type of counting problem (and say what these things even are). As we will see, the numbers in Pascalβs triangle are the answers to all of these questions.
Before we jump in, a little bit of notation. Letβs give each number in Pascalβs triangle a name, based on its position. Think of each number as being in a row and a column: rows are counted down, starting at 0, and columns are counted in from the left, also starting at 0. The entry in row and column will be denoted . For example, the , since that is the value in row 6, column 3. For reasons that will become clear soon, we pronounce as β choose .β We can rewrite the triangle with these names:
The integer lattice is the set of all points in the Cartesian plane for which both the and coordinates are integers. If you like to draw graphs on graph paper, the lattice is the set of all the intersections of the grid lines.
A lattice path is one of the shortest possible paths connecting two points on the lattice, moving only horizontally and vertically. For example, here are three possible lattice paths from the point to :
Notice that to ensure the path is the shortest possible, each move must be either to the right or up. Additionally, in this case, no matter what path we take, we must make three steps right and two steps up. No matter in what order we make these steps, there will always be five steps. Thus each path has length five.
The counting question we will ask is this: how many lattice paths are there between and ? In this case, drawing all the paths wouldnβt take too long. Or we could list each path as a string of βdirectionsβ such as ,, or , which correspond to the three paths drawn above, where an means travel one unit in the direction, and similarly for . We would get the following ten paths:
Any lattice path from (0,0) to (3,2) must pass through exactly one of and . The point is 4 steps away from (0,0) and two of them are in the direction. The last step is also in the direction, so the paths from (0,0) to (3,2) that pass through are exactly the six strings we listed above that end in an . For the paths that pass through point , the last step will be in the direction, so the paths from (0,0) to (3,2) that pass through are exactly the four strings we listed above that end in a . So the total number of paths to (3,2) is just .
The general observation here is that to find the number of paths that start at and end at , we can find the number of paths to the point directly to the left of the endpoint, and add the number of paths to the point directly below the endpoint, . This is exactly the same way that Pascalβs triangle is generated! Indeed, if we rotate the lattice appropriately, so the point is at the top of the triangle and the axes along the sides of the triangle, we see that the numbers in Pascalβs triangle give us exactly the number of paths to each lattice point.
To make this observation helpful for actually finding the number of paths from the origin to a given point, we note that it is the length of the path that determines the row of Pascalβs triangle, and the number of steps in the direction that says how far into the triangle we are -- the column of Pascalβs triangle.
βBitβ is short for βbinary digit,β so a bit string is a string of binary digits. The binary digits are simply the numbers 0 and 1. All of the following are bit strings:
The number of bits (0βs or 1βs) in the string is the length of the string; the strings above have lengths 4, 1, 4, and 10 respectively. We also can ask how many of the bits are 1βs. The number of 1βs in a bit string is the weight of the string; the weights of the above strings are 2, 0, 4, and 5 respectively.
For example, the elements of the set are the bit strings 011, 101, and 110. Those are the only strings containing three bits, exactly two of which are 1βs.
Great. Ten of them. Actually, I have a confession: I didnβt type all of these from scratch. Instead I just modified the list of 10 lattice paths from (0,0) to (3,2) that we found earlier. Each became a 1 and each became a 0. After all, any lattice path with length that requires steps in the direction can be represented by a string of symbols of two types, with of those symbols being of one type. Whether we call the two symbols and or we call them and will not change how many strings we get.
It is not surprising then that the same relationship between Pascalβs triangle and lattice paths holds for bit strings. Look at the 10 strings above. The first row contains all the bit strings of that end in a 0. Before that ending 0, we have a string in , since it must have length 4 and weight 3 (the ending 0 increases the length, but not the weight). The second row contains all the bit strings of that end in a 1. Before that ending 1, we have a string in , since it must have length 4 and weight 2 (the ending 1 increases the length and the weight). So the number of 5-bit strings of weight 3 is the sum of the number of 4-bit strings of weight 3 and the number of 4-bit strings of weight 2. In symbols:
Now we have two good reasons to believe that Pascalβs triangle tells us the number of bit strings of a given weight: There is a one-to-one correspondence between lattice paths and bit strings, and the same recursive relationship holds for bit strings as it does for generating Pascalβs triangle. So we can now use the triangle to count bit strings.
A subset of a set is any set all of whose elements are also in . Think of starting with the set and removing some (or none or all) of its elements: the resulting set is a subset of . (More information about sets can be found in Section 0.2 and Section 5.1.)
Again, we see there are ten. In fact, we have listed them in the same order as we listed the ten 5-bit strings of weight 3 and the ten lattice paths from (0,0) to (3,2). Wait, does this even make sense? In what way is a subset the same as a bit-string?
Think of each bit in a bit string as representing one of the elements in a set. The set has five elements, so we need five bits to represent a subset of . If the bit in position is a 0, that means we do not include in our subset, while a 1 in that position tells us that is in the subset. Three 1βs means we have said, βyesβ to three elements.
What we have done here is give a bijection between the set of 5-bit strings of weight 3 and the set of 3-element subsets of . A bijection is a function such that each element of is the image of exactly one element from . You can prove that if there is a bijection between two sets, then they have the same number of elements. This is a common counting technique we will use in the upcoming sections.
This example illustrates that, once again, Pascalβs triangle can give us the answer to a counting question. The number of -element subsets of a set with elements is the same as the number of -bit strings of weight , and that is the number in row , column of the triangle: .
At this point Iβm sure we are all getting pretty hungry, so letβs get some pizza. But which pizza shall we order? Letβs not overdo it and just choose three toppings from the ten available. How many different pizzas can we order?
Aha! So thatβs why we care about counting subsets!! Each pizza choice is nothing more than a 3-element subset of the set of 10 toppings. We now know how to count this: different pizzas.
What if we want an Italian soda with dinner? Letβs say we want to add two different flavored syrups from the 13 available. How many different sodas are possible? This is just the number of 2-element subsets of a set with 13 elements: .
This is why we pronounce as β choose β. It is the number of ways to choose items from a collection of items, since choosing elements is exactly how you build a -element subset.
We can view counting lattice paths as choosing out of things: Of the steps on the path, we choose of them to be in the direction. Bit strings can also be thought of in this way: Of the bits in the string, we choose of them to be 1βs.
We can now answer all sorts of real-world counting problems, as long as they are really nothing more than asking for the number of subsets of a set. Pascalβs triangle contains all these answers.
The number of -element subsets of a set with elements is the number in row , column of Pascalβs triangle: , which we read as β choose .β This is the number of ways to choose items from a collection of items.
Earlier we said that one of the original uses for Pascalβs triangle was to solve problems in algebra. What does counting subsets (or bit strings or lattice paths) have to do with algebra?
Suppose you expand the binomial expression (i.e., multiply the binomial by itself six times). This can be tedious to do by hand, but a computer algebra system such as SageMath can do this easily.
This means we must distribute the binomials, which looks like the following. (We will use a different typeface for each version of the and to keep track of where everything comes from.)
This repeated distribution results in a sum of terms, each the product of three variables. We see that each term is the result of choosing either the or the from each of the binomials. For example, the term is the result of choosing the from the first binomial, the from the second, and the from the third.
Say we want to find the coefficient of the therm. We collect like terms, collecting all the terms in which we have chosen two times (and the other one time). Alternatively, the term comes from all the strings with two and one , just like a bit string or lattice path. No matter how you think of it, the result is that we have terms with the form .
How many lattice paths are there from to . How many lattice paths are there from to ? Why does it make sense that these two numbers are the same? Explain your reasoning.
Suppose you are counting lattice paths from to . We know that the number of such paths is . Here is another way to count these paths: Consider the cases for where your first step in the -direction is. There are five different options here; compute the number of paths for each case.
How many paths are there from to that first move one step in the -direction, then one step in the -direction (so they pass through the points and then )?
Verify that the sum of the paths in each case is 35. Then describe where all these numbers are in Pascalβs triangle. Find another instance of this pattern and verify that it works.