BL2.ru

Combinatorics Calculator: Permutations, Arrangements, Combinations

Pick a formula or answer three questions, enter n and k, and the calculator returns the exact count (even for 100!) with a worked solution showing factorials and cancellation.

Which formula to use
Does order matter?
Can items repeat?
Are all items used?
Use: Combinations C(n, k)
Order does not matter and nothing repeats (a team, a lottery): C = n!/(k!·(n − k)!). If you take every item, there is exactly one way.
Formula
Choose k of n distinct items, order does not matter, no repeats: n!/(k!·(n − k)!).
Typical problems
Calculate

The three basic formulas

Combinatorics answers the question of how many ways something can be done. Most problems reduce to choosing from n items and two questions: does order matter, and may items repeat.

Permutations P(n) = n! line up all n distinct items. For example, 5 people can be seated on 5 chairs in 5! = 120 ways.

Arrangements A(n, k) = n!/(n − k)! choose k of n items with order mattering. Gold, silver and bronze among 10 runners can be awarded in 10·9·8 = 720 ways.

Combinations C(n, k) = n!/(k!·(n − k)!) choose k of n items when order does not matter. A team of 5 from 12 people can be formed in C(12, 5) = 792 ways. A combination is an arrangement divided by k!, because each set of k items is counted k! times in different orders.

Repetition

If items may be chosen again, arrangements with repetition equal nᵏ: a 4-digit lock code has 10⁴ = 10,000 variants. Combinations with repetition are C(n + k − 1, k): choosing 3 pastries of 3 kinds can be done in C(5, 3) = 10 ways.

If some of the n items are identical (n₁ of one kind, n₂ of another and so on), the number of distinct permutations is n!/(n₁!·n₂!·…·n_m!). This is how anagrams are counted: the word banana has 6 letters, with a three times, n twice and b once, so 6!/(3!·2!·1!) = 60 words.

Telling the formulas apart

Ask yourself whether swapping two chosen items gives a different outcome. If yes, you need arrangements or permutations; if not, combinations. If every item is taken, use permutations. If the same item may be taken again, use the formulas with repetition.

Big numbers

Counts grow extremely fast: 20! already exceeds two quintillion and 100! has 158 digits. The calculator works with exact integers, without rounding, and groups the digits for easier reading.

Link to probability

Classical probability is the number of favourable outcomes divided by the number of equally likely outcomes. Both numbers are usually found with combinations, for example the chance of guessing 6 numbers out of 49 is 1/13,983,816.

FAQ

What is the difference between arrangements and combinations?
In arrangements the order of chosen items matters: AB and BA are different outcomes. In combinations order does not matter, so AB and BA are the same choice. That is why C(n, k) = A(n, k)/k!.
How do I count the anagrams of a word?
Count how many times each letter occurs, then divide the factorial of the word length by the product of those factorials. For the word mama: 4!/(2!·2!) = 6. In the calculator pick permutations with repetition and type the word.
What is 0! and why is C(n, 0) = 1?
By definition 0! = 1. There is exactly one way to choose zero items, namely to choose nothing, so C(n, 0) = C(n, n) = 1 and P(0) = 1.
Can k be greater than n?
Not without repetition: you cannot pick 6 distinct items out of 5. With repetition you can: for arrangements with repetition k is arbitrary, for example 2¹⁰ = 1024 binary words of length 10.
How do I choose the right formula for a problem?
Answer three questions: does order matter, may items repeat, and are all items used. The Which formula to use block on this page selects the formula from your answers.