How many different lottery tickets are there? How many ways can eight runners fill a podium? How many four-digit PIN codes exist? All of these are counting questions, and they come down to two choices: does the order matter, and can an item be picked more than once?
This calculator answers all four cases at once:
| Order does not matter | Order matters | |
|---|---|---|
| No repetition | combinations | permutations |
| Repetition allowed | multisets | sequences |
Enter the number of available items and the number you pick . The headline shows the case you selected; the three other counts are listed underneath so you can compare them. Results are exact integers computed with arbitrary-precision arithmetic — even , which has 3,009 digits, is given digit by digit in a table. For the calculator also prints the matching row of Pascal’s triangle.
The number is also called the binomial coefficient and read "n choose r"; it is the coefficient of in the expansion of , which is why it appears in the binomial probability distribution.
How to use this calculator
- Choose whether order matters: No for groups, hands, committees or lottery draws; Yes for rankings, codes and arrangements.
- Switch on repetition if the same item can be chosen again (digits of a PIN, scoops of the same flavour).
- Enter n, the number of items available, and r, how many you pick (both whole numbers up to 10,000).
- Read the count, its number of digits and the other three variants. Open the steps for the formula with your numbers.
The formula
With items and picks:
Permutations and combinations are linked by : each unordered group of items can be ordered in ways. When and repetition is not allowed, both counts are 0.
Rather than computing huge factorials, the calculator uses the multiplicative form , in which every intermediate value is an integer (Knuth, The Art of Computer Programming, vol. 1, §1.2.6). Pascal’s rule builds the triangle row by row.
Worked example
- Lottery, 6 numbers out of 49 (order irrelevant, no repetition): possible tickets.
- Poker hands: .
- Podium, 8 runners (gold, silver, bronze): .
- 3 scoops from 5 flavours, the same flavour allowed twice: .
- 4-digit PIN codes: .
- Choosing 50 out of 100: = 100,891,344,545,564,193,334,812,497,256, a 30-digit number the calculator still prints in full.
Binomial coefficients and Pascal’s triangle
Each number in Pascal’s triangle is the sum of the two above it, and row lists . Row 4 is 1, 4, 6, 4, 1, which gives . The entries of a row add up to — the number of subsets of a set of items — and the triangle is symmetric because : choosing who is in is the same as choosing who is out.
Combinations in probability
Counting is the first step in many probability questions: the chance of winning the 6/49 lottery with one ticket is . The binomial distribution, , uses the binomial coefficient to count the orders in which successes can occur. To describe a set of measured values rather than count arrangements, see the standard deviation calculator.
Frequently asked questions
What is the difference between a combination and a permutation?
A combination is a selection where order does not matter (a hand of cards); a permutation is an arrangement where it does (a race podium). There are always at least as many permutations as combinations: P(n, r) = r! × C(n, r).
What does "n choose r" mean?
It is the binomial coefficient C(n, r): the number of ways to choose r items out of n when order does not matter. For example, 5 choose 2 is 10.
What happens if r is larger than n?
Without repetition there is no way to pick more items than exist, so the count is 0. With repetition allowed, r can be larger than n: three scoops from two flavours gives C(4, 3) = 4 options.
Why is C(n, 0) equal to 1?
There is exactly one way to choose nothing: the empty selection. Likewise 0! = 1 by convention, which keeps the formula consistent.
How large can n be?
Up to 10,000. The result is computed exactly; when it has more than 30 digits, the headline shows scientific notation and a table lists every digit.
Sources
- NIST Digital Library of Mathematical Functions, §26.3 Lattice Paths: Binomial Coefficients
- OpenStax, Precalculus, §11.5 Counting Principles
- D. E. Knuth, The Art of Computer Programming, vol. 1, §1.2.6 Binomial Coefficients
Last updated: