liveBook · Manning

Pascal's triangle

As explained in Statistics Every Programmer Needs

Pascal's triangle is a triangular array of numbers in which each interior entry is the sum of the two entries directly above it.

Pascal's triangle is a triangular arrangement of numbers built from the top down. It begins with 1; each interior entry is the sum of the two entries directly above it, while every row begins and ends with 1. section 2.2.3

Use the triangle to support counting and probability calculations:

  • Each number represents a combination of choosing r items from n possibilities, written as “n choose r.” section 2.2.3
  • Find the value at the (n + 1)th row and (r + 1)th position to count combinations without replacement. section 2.2.3
  • The sum of each row doubles relative to the preceding row, providing an additional structural pattern. section 2.2.3

Counting five choose three

For n = 5 and r = 3, use the sixth row and fourth position from the left. The value is 10, so five items contain 10 distinct three-item combinations without replacement. section 2.2.3

Figure 2.1 The top of Pascal’s triangle. The triangle is constructed from the top down, where numbers are derived by adding the two numbers immediately above. It so happens that the sum of numbers for each row is twice the sum of numbers from the row above. The number of combinations without replacement can be found at the intersection of the (n + 1)th row and the (r + 1)th position in that row. When n equals 5 (sixth row down) and r equals 3 (fourth position from the left), the number of combinations without replacement equals 10.
figure

The figure shows the triangle's construction and locates the value for n = 5 and r = 3. section 2.2.3

How Statistics Every Programmer Needs covers it

How deep it goes
Explains construction, row properties, positional lookup, and one worked count without developing a formal proof.
Examples
Demonstrates the sixth-row, fourth-position lookup for five choose three, producing 10 combinations.
What you can do after
Apply it to count combinations without replacement from n possibilities when selecting r items.
How it connects
Connects combinations without replacement with permutations, probability theory, combinatorics, and algebra.

Also explained in

Compare how 2 books explain Pascal's triangle →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.