Permutations & Combinations

Calculate permutations P(n,r) and combinations C(n,r) — the number of ways to arrange or select r items from a set of n. Also computes factorials.

Permutations & Combinations Formulas
P(n,r) = n! / (n − r)! — ordered arrangements C(n,r) = n! / (r! × (n − r)!) — unordered selections C(n,r) = P(n,r) / r! — combinations are always ≤ permutations
When to use which
PermutationsPasswords, PIN codes, race rankings, seating arrangements
CombinationsLottery tickets, team selection, card hands, committee formation
How to use
Permutations P(n,r)

The number of ways to arrange r items chosen from n, where the order matters. Example: how many 3-letter codes can be made from 10 letters? P(10,3) = 720.

Combinations C(n,r)

The number of ways to choose r items from n, where order does NOT matter. Example: how many 5-card hands from a 52-card deck? C(52,5) = 2,598,960.

When to use which

Use permutations for ordered arrangements (passwords, rankings, race positions). Use combinations for unordered selections (lottery, team selection, card hands).

Formula
P(n,r) = n! / (n−r)! C(n,r) = n! / (r! × (n−r)!) C(n,r) = P(n,r) / r! — combinations are always smaller
Tips
  • C(52,5) = 2,598,960 poker hands. Of these, only 4 are royal flushes — odds of ~1 in 650,000.
  • C(n,r) = C(n, n−r) — choosing 3 from 10 equals choosing 7 from 10.
  • Pascal's triangle rows give the combination values C(n,0), C(n,1), … C(n,n).