Mathematics
Combinatorics calculator
Choose the kind of grouping, enter n and k, and get the exact count with the formula applied to your numbers. If you are not sure which to pick, the guide below starts from the two questions that settle it.
Which formula to use: two questions are enough
Combinatorics has six formulas that are easy to confuse, but choosing the right one takes only two questions. First: does order matter? If swapping two items produces a different grouping — a ranking, a password, a sequence — order matters and you are dealing with arrangements or permutations; if it does not — a team, a hand of cards, a set of numbers — you are dealing with combinations. Second: can an item appear more than once? If so, use the “with repetition” variant.
The difference between arrangements and permutations is only how many items you take: permutations are the case where all n items are used, so they are arrangements with k = n and the count reduces to n!. Combinations come from arrangements by dividing by k!, the number of ways the k chosen items could be reordered: dividing by that number is exactly what “order does not matter” means.
The binomial coefficient “n choose k” is not a different formula from combinations: it is the same one under another name and notation. It appears in the expansion of a binomial power and in Pascal's triangle, where each row lists the combinations of n items taken 0, 1, 2… n at a time. It is also why C(n; k) = C(n; n−k): choosing who is in is the same as choosing who is left out.
Common mistakes
- Using arrangements where combinations are needed: if the exercise asks how many teams of 5 from 12 players, order does not matter and the answer is C(12; 5) = 792, not D(12; 5) = 95,040. The second number is 120 times larger, that is 5!.
- Forgetting that in arrangements with repetition k may exceed n: 26 letters make 8-character passwords, and 26⁸ is perfectly well defined. The constraint k ≤ n applies only without repetition.
- Counting the anagrams of a word with repeated letters as a plain factorial: MATHEMATICS has 11 letters, but 11! counts the permutations of the two M's among themselves as different. You must divide by the factorials of the repeats.
Frequently asked questions
What is the difference between arrangements and combinations?
In arrangements order matters, in combinations it does not. From three letters A, B, C the arrangements of two items are six (AB, BA, AC, CA, BC, CB), the combinations are three (AB, AC, BC). Combinations come from arrangements by dividing by k!.
Why does 0! equal 1?
Because there is exactly one way to order zero objects: do nothing. The convention is not arbitrary, it is what keeps every formula consistent: without it C(n; 0) and C(n; n) would not equal 1 as they must.
How do you calculate the binomial coefficient?
“n choose k” equals n! / (k! · (n−k)!) and is the same thing as combinations of n items taken k at a time. The symmetry C(n; k) = C(n; n−k) often halves the work.
How many anagrams does a word with repeated letters have?
Divide the factorial of the total number of letters by the product of the factorials of the repeats. MATHEMATICS has 11 letters with M, A and T appearing twice each: 11!/(2!·2!·2!) = 4,989,600.
How this calculation works
Factorial: n! = n·(n−1)·…·2·1, with 0! = 1. Permutations of n items: Pₙ = n!. Permutations with repetition, with items repeating n₁, n₂, … times: n!/(n₁!·n₂!·…). Arrangements without repetition: D(n; k) = n!/(n−k)! = n·(n−1)·…·(n−k+1), requires k ≤ n. Arrangements with repetition: D′(n; k) = nᵏ, with no constraint between n and k. Combinations, that is the binomial coefficient: C(n; k) = n!/(k!·(n−k)!), with C(n; k) = C(n; n−k). Combinations with repetition: C′(n; k) = C(n+k−1; k). The counts are carried out in exact integer arithmetic, because beyond 20! the numbers exceed the precision of floating-point decimals.