Statistics Combinations

A combination counts the number of ways to choose items from a group when the order of selection does not matter.

What Is a Combination?

A combination is a selection of items where order does not matter. Choosing 3 books out of 5 to pack for a trip is a combination problem, because packing book A, then B, then C ends up being the exact same trio as packing C, then A, then B — you only care which books end up in the bag, not the order you grabbed them.

The Combination Formula

The number of ways to choose r items from n, when order doesn't matter, is C(n, r) = n! / (r! (n − r)!). Combinations are related to permutations by dividing out the r! ways to order each group: C(n, r) = P(n, r) / r!, since every group of r items would otherwise be counted once for each of its possible orderings.

Example: Choosing 3 Books Out of 5

import math

n = 5  # books available
r = 3  # books chosen for the trip

combinations = math.comb(n, r)
permutations = math.perm(n, r)

print(f"C(5,3) = {combinations}")  # 10
print(f"Check via nPr / r! = {permutations // math.factorial(r)}")  # 10

With 5 books labeled A through E, choosing 3 to pack gives exactly 10 distinct groups. Order never matters here — 'A, B, C' and 'C, A, B' describe the same trio, so both collapse into a single combination.

  1. ABC
  2. ABD
  3. ABE
  4. ACD
  5. ACE
  6. ADE
  7. BCD
  8. BCE
  9. BDE
  10. CDE

Combinations vs Permutations

QuantityValue for n=5, r=3
Permutations P(5,3)60
Combinations C(5,3)10
Ratio (equals r!)6

Example: A Lottery — Choosing 6 Numbers From 49

import math

lottery_combinations = math.comb(49, 6)
print(f"Ways to choose 6 numbers out of 49: {lottery_combinations:,}")
# 13,983,816 — this is exactly why winning a 6/49 lottery is so unlikely!
Note: Spot combination problems by the wording: 'choose', 'select', or 'form a group/committee' usually means order doesn't matter. Words like 'arrange', 'rank', or 'in a row' usually signal a permutation instead.

Combinations are the right tool whenever you're forming a subset rather than a sequence — picking a committee from a pool of candidates, dealing a poker hand, or choosing which toppings go on a pizza, since the final group is what matters, not the order items were added.

Exercise: Statistics Combinatorics

What is the key difference between a permutation and a combination?