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?
An 8x8 checkerboard containing an image of a rook chess piece in the top left corner. The square in the third row, third column contains the number 6.
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). Find the other 5.
In the 1653, Blaise Pascal, concerned with questions that would lay the foundation of probability theory, collected a number of 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 the themselves the centerpiece of the work of Pythagoras and his followers.
So what is this remarkable triangle that holds the secrets of so many different mathematical problems? Behold, Pascal’s Triangle:
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 to ensure the path is the shortest possible, each move must be either to the right or up. Additionally, in this case, note that no matter what path we take, we must make three steps right and two steps up. No matter 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 draw 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 end point, and add the number of paths to the point directly below the end point, . 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 adds one to the length, but adds zero to 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 adds one to the length, but adds one to 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. So 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 overdue 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 now know ho to 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 triangl 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 a sage can do this easily.
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.
When we collect like terms, to find the coefficient for the term, for example, we collect 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 .
Compute the following sums of the rows of Pascal’s triangle: Now based on your work in the above calculations, give a guess for the sum of the 10th row of Pascal’s triangle.
A pizza parlor offers 10 different toppings, one of which is pineapple. How many 4-toppings pizzas are there that have pineapple as one of their toppings? How many 4-topping pizzas are there that do not have pineapple as a topping? How many 4-topping pizzas are there in total?
Consider the lattice paths from (3,4) to (8,10). How long is each such path? How many steps are in the x-direction? How many different paths are there?
subsets. We need to select yes/no for each of the 7 elements.
subsets. We need to select yes/no for each of the remaining 4 elements.
subsets. We subtract the number of subsets which do not contain any odd numbers (-select yes or no for each even element) from the total number of possible subsets.
subsets. First pick the even number. Then say yes or no to each of the odd numbers.
How many subsets of contain an even number of elements?
Solution.
There are subsets. This is , which makes sense because we are deciding yes or no on whether to include each element of in the subset.
Of the 5 elements in , we must choose 4 of them to be in the subset. So .
For each of the 5 elements from , we must decide yes or no on whether to include them in the subset. However, for the odd numbers, we only have one choice: no. So there are only 2 elements we have two choices for, so the answer is . (Note, if you wish to exclude the empty set - it does not contain odd numbers, but no evens either - then you could subtract 1).
Count the number of subsets with each possible even cardinality:
How many -bit strings (that is, bit strings of length 11) are there which:
Start with the sub-string 011?
Have weight 8 (i.e., contain exactly 8 1’s) and start with the sub-string 011?
Either start with or end with (or both)?
Have weight 8 and either start with or end with (or both)?
Solution.
. You have 2 choices for each of the remaining 8 bits.
. You need to choose 6 of the remaining 8 bits to be 1’s.
704. There are strings that start with 011, and another which end with 01 (we choose 1 or 0 for 9 bits). However, we count the strings that start with 011 and end with 01 twice - there are such strings. So using PIE, we have
58. There are strings of weight 8 which start with 011, and another which end with 01. We have over counted again - there are weight 8 strings which both start with 011 and end with 01, in fact of them. So all together we have strings.
You break your piggy-bank to discover lots of pennies and nickels. You start arranging these in rows of 10 coins.
You find yourself making rows containing an equal number of pennies and nickels. For fun, you decide to lay out every possible such row. How many coins will you need?
How many coins would you need to make all possible rows of 10 coins (not necessarily with equal number of pennies and nickels)?
Solution.
We can think of each row as a 10-bit string of weight 5 (since of the 10 coins, we require 5 to be pennies). Thus there are rows possible. Each row requires 10 coins, so if we want to make all the rows at the same time, we will need 2520 coins, half of them nickels and half of them pennies.
Now there are rows possible, which is also , if you break them up into rows containing 0, 1, 2, etc. pennies. Thus, since there are 10 coins in each row, we need total coins.
This is the same as a question about 7-bit strings, since we can think of each subset as a 7-bit string with a 1 representing that we include that element in the subset. subsets.
To get an , we must pick 14 of the 19 factors to contribute an , leaving the other 5 to contribute a 3. There are ways to select these 14 factors. So the term containing an will be . In other words, the coefficient of is .
To get an from the first term, we must pick 5 of the 19 factors to contribute an , leaving the other 14 to contribute a 2. There are ways to select these 5 factors, so the coefficient will be . Now we must choose 1 of the factors in the second term to contribute an , leaving the other 19 terms to contribute a 3. This gives us for the coefficient resulting from this term. In total, the term containing an will be .
Gridtown USA, besides having excellent donut shops, is known for its precisely laid out grid of streets and avenues. Streets run east-west, and avenues north-south, for the entire stretch of the town, never curving and never interrupted by parks or schools or the like.
Suppose you live on the corner of 4th and 4th and work on the corner of 18th and 18th. Thus you must travel 28 blocks to get to work as quickly as possible.
How many different routes can you take to work, assuming you want to get there as quickly as possible?
Now suppose you want to stop and get a donut on the way to work, from your favorite donut shop on the corner of 17th ave and 14th st. How many routes to work, stopping at the donut shop, can you take (again, ensuring the shortest possible route)?
Disaster Strikes Gridtown: there is a pothole on 5th ave between 7th st and 8th st. How many routes to work can you take avoiding that unsightly (and dangerous) stretch of road?
The pothole has been repaired (phew) and a new donut shop has opened on the corner of 5th ave and 7th st. How many routes to work drive by one or the other (or both) donut shops? Hint: the donut shops serve PIE.
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 differnt 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.