Category: Discrete Math Level: 301
paths to a corner = paths from the left + paths from above; C(5, 2) = 10
Count the shortest paths across a grid that only move right or down. The count at each corner is the sum of the counts from the left and from above, which builds Pascal's triangle.
Walk from the top-left corner to the bottom-right corner, one block at a time, only right or down. Every such path takes 3 rights and 2 downs.
path = 3 R and 2 D in some order
Corners on the top edge or the left edge can be reached one way only: straight along the edge. Write 1 at each.
top edge and left edge: 1
Any path into an inside corner arrives from the left or from above, never both. So add those two counts, the same rule as Pascal's triangle.
1 + 1 = 2, 2 + 1 = 3, …
The far corner shows 10. A path is 5 moves, and choosing which 2 are downs fixes it, so the count is C(5, 2). Read the badges along each diagonal and you get pieces of the rows of Pascal's triangle.
C(5, 2) = 10
cd svg-generator python3 -m svgmath render pascals-grid-paths --out /tmp/pascals-grid-paths
Source: svgmath/diagrams/counting.py