Combinatorics
Counting the ways…
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Combinatorics
Counting the ways…
Multiplying out (a + b)ⁿ means picking a or b from every bracket. The coefficient of aⁿ⁻ᵏbᵏ counts the picks with k b's — and that is C(n, k).
(a + b)² is the area of a square with side a + b. Split each side into a piece of length a and a piece of length b, and the square falls into four rectangles.
Each term is coloured by its number of b's, as in the picture. The second line puts the numbers in: the terms always add up to (a + b)ⁿ.