Article — Combination Calculator
Combination Calculator: C(n, k) = n! / (k!(n − k)!)
A combination counts how many ways k items can be chosen from n distinct items when order does not matter. The combination formula is C(n, k) = n! / (k! · (n − k)!). For lottery 6/49, C(49, 6) = 13,983,816. For poker, C(52, 5) = 2,598,960 five-card hands from a standard deck. The combination calculator uses exact BigInt arithmetic to give precise results without overflow.
Combinations are the workhorse of counting problems whenever order is irrelevant: lottery odds, sample selections, team rosters, committee assembly, and probability of specific card hands. The math is simple but easy to misapply.
What a combination is
The defining feature of a combination is that order does not matter. Choosing players A, B, and C for a team is the same selection as B, A, C or C, B, A. If the order of selection were meaningful (gold medal, silver medal, bronze medal), that would be a permutation.
For combinations, every distinct subset of size k counts once. For an n-element set, the count of all k-element subsets is the binomial coefficient, written either as C(n, k) or as the "n choose k" notation in brackets.
The combination formula
C(n, k) = n! / (k! · (n−k)!) main formulaC(n, k) = C(n, n−k) symmetryC(n, 0) = C(n, n) = 1 boundary casesThe numerator n! counts ordered arrangements of all n items. The denominator divides out the k! orderings of the chosen items (since order does not matter) and the (n − k)! orderings of the unchosen items. What remains is the count of distinct selections.
Direct computation through factorials overflows quickly. For n = 50, n! has 65 digits. The combination calculator uses BigInt arithmetic and a multiplicative formula C(n, k) = (n × (n−1) ×... × (n−k+1)) / k! that avoids constructing the full factorials.
Combination versus permutation
The permutation P(n, k) counts ordered arrangements: P(n, k) = n! / (n − k)!. The relationship between the two is P(n, k) = C(n, k) × k!, since each combination of k items can be ordered in k! different ways.
| Concept | Formula | Example: choose 3 from 5 |
|---|---|---|
| Combination | C(n, k) = n! / (k! · (n−k)!) | C(5, 3) = 10 |
| Permutation | P(n, k) = n! / (n−k)! | P(5, 3) = 60 |
A permutation always has at least as many outcomes as a combination for the same n and k. They are equal only when k = 0 or k = 1.
Worked combination examples
Lottery odds. In a 6/49 lottery, players choose 6 numbers from 49. The number of equally likely tickets is C(49, 6) = 13,983,816. The probability of matching all six is 1 / 13,983,816, or about 7 × 10−8. Powerball uses 5/69 (C(69, 5) = 11,238,513 outcomes for the five white balls).
Poker hands. A standard 52-card deck has C(52, 5) = 2,598,960 distinct five-card hands. Of these, exactly 4 are royal flushes, 36 are straight flushes (excluding royals), 624 are four-of-a-kind, and 3,744 are full houses. Probabilities are computed as (count of favorable hands) / C(52, 5).
Sports. Selecting a starting lineup of 11 from a squad of 23 gives C(23, 11) = 1,352,078 possible lineups, ignoring positional roles. With positions distinguished (one goalkeeper, four defenders, etc.), the count is much smaller, but the raw combination shows the upper bound.
Pascal's triangle predates Pascal by at least 600 years. Yang Hui documented it in China in 1261, Al-Karaji described it in Persia around 1000 AD, and Omar Khayyam wrote about it in the 11th century. Tartaglia published it in Europe in 1556, nearly a century before Pascal's 1654 work. Pascal earned the naming because of his rigorous mathematical treatment, especially applications to probability theory.
Combinations in probability
The binomial distribution uses combinations directly. If a trial succeeds with probability p, the probability of exactly k successes in n independent trials is C(n, k) · pk · (1−p)n−k. The C(n, k) factor counts the number of ways the k successes can be arranged among the n trials.
Combinations also drive hypergeometric probabilities (sampling without replacement) and many counting problems in statistical inference. Anywhere you have to count favorable outcomes from a fixed set without caring about order, C(n, k) is the right tool.
Pascal's triangle and combinations
Pascal's triangle is the table of combination values: row n contains C(n, 0), C(n, 1), …, C(n, n). Each value is the sum of the two above it, expressing the recurrence C(n, k) = C(n−1, k−1) + C(n−1, k).
The triangle reveals patterns: the sum of row n equals 2n, every row reads the same forward and backward (symmetry of combinations), and prime values appear in regular positions. The numbers also appear as coefficients in the binomial expansion (a + b)n = Σ C(n, k) ak bn−k.
- C(0, 0) = 1 — the empty selection from an empty set
- C(n, 0) = C(n, n) = 1 — only one way to choose nothing or everything
- Sum of row n in Pascal's triangle = 2n (total number of subsets)
- C(n, k) = C(n, n−k) — symmetry, useful for computation
- C(2n, n) grows as the central binomial coefficient, ≈ 4n / √(πn)
Combinations with replacement
When items can be picked more than once, the formula changes. Combinations with replacement (sometimes called multicombinations) use C(n + k − 1, k). Example: choosing 3 ice cream scoops from 5 flavors when repeats are allowed gives C(5 + 3 − 1, 3) = C(7, 3) = 35 possible orders (treating "chocolate, chocolate, vanilla" as one selection).
Most introductory problems use combinations without replacement, which is what the standard C(n, k) formula computes. Double-check the problem statement: is each item drawn from a different position (no replacement) or can the same item appear twice (with replacement)? The right formula depends entirely on this distinction.
Common combination mistakes
The most common error is using a permutation when a combination is needed (or vice versa). If the problem assigns distinct roles (positions, prize levels, ranks), order matters — use permutation. If everyone selected just becomes part of an unordered group (members of a team, items in a sample), order does not matter — use combination.
Other regular mistakes: trying k > n (the formula returns 0 since you cannot choose more than you have), forgetting that C(n, 0) = 1, and computing factorials directly instead of using the multiplicative shortcut, which causes overflow for moderately large n.