Skip to content

Combinatorics

Combinatorics is the math of counting: how many ways to arrange, choose or distribute things without listing them all. These are the core rules, with links to practice problems for each.

Practice pages
3
Problems solved
36

Practice problems with solutions

Combinatorics: the essentials

Permutations (order matters)

Arranging nn different objects in a row: n!n! ways. Choosing and arranging rr of them: P(n,r)=n!(n−r)!P(n,r)=\dfrac{n!}{(n-r)!}. Around a circle, only relative order counts: (n−1)!(n-1)!. Practice: circular permutations problems.

Combinations (order does not matter)

Choosing rr of nn different objects: (nr)=n!r! (n−r)!\displaystyle\binom{n}{r}=\frac{n!}{r!\,(n-r)!}.

Combinations with repetition (stars and bars)

Choosing rr items from mm types, repeats allowed, or putting rr identical objects into mm distinct boxes: (r+m−1m−1)\displaystyle\binom{r+m-1}{m-1}. Practice: stars and bars problems.

Inclusion–exclusion

To count what avoids several bad properties, subtract each bad case, add back the overlaps of two, subtract the overlaps of three, and so on:

∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣.|A\cup B\cup C|=|A|+|B|+|C|-|A\cap B|-|A\cap C|-|B\cap C|+|A\cap B\cap C|.

It is the standard way to handle upper bounds in stars and bars problems.

Graph theory

Counting and structure on networks of points and lines: degrees, Euler paths, trees, coloring. Practice: graph theory problems.