Toolvito

Works on this device

Permutation & Combination Calculator

Count the ways to choose or arrange things. Enter how many things there are (n) and how many you take (r), and say whether the order matters. Every result is an exact whole number, and the steps show the formula with your numbers in it.

Enter your values

The number of ways to choose r things out of n when the order of the chosen things does not matter. This is nCr, also written C(n, r) or "n choose r".

Your values

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose the button below them.

How to use this calculator

  1. Choose a calculation. For a plain question choose Combinations when the order does not matter, or Permutations when it does.
  2. Enter n, the number of things to choose from, and r, the number you choose or arrange.
  3. Tick repetition when the same thing may be used more than once, as in a code of digits.
  4. Choose Calculate. You get the count, the formula with your numbers, and the working in steps.
  5. For your own items, choose List every selection or arrangement of my items to see every line.

Permutation or combination?

A permutation is an arrangement: the order matters. The codes 123 and 321 are two permutations. A combination is a selection: the order does not matter. The hands A, B, C and C, B, A are one combination.

Ask two questions: does the order matter, and may a thing repeat? The answers choose one of four formulas.

The four basic counts for choosing r from n
Case Formula Example with n = 10 and r = 3
Order matters, no repetition (nPr) n! ÷ (n − r)! 720
Order does not matter, no repetition (nCr) n! ÷ (r! × (n − r)!) 120
Order matters, with repetition n^r 1,000
Order does not matter, with repetition (n + r − 1)! ÷ (r! × (n − 1)!) 220

The other formulas

  • n! (n factorial) is n × (n − 1) × … × 2 × 1, and 0! is 1.
  • A word with repeated letters: n! ÷ (a! × b! × …), where a, b, … count the letters that are alike. BANANA has 6! ÷ (3! × 2!) = 60 arrangements.
  • Round a table: (n − 1)! for n people, because turning the whole table changes nothing. For r of n people it is P(n, r) ÷ r. For beads on a ring that can be turned over, divide by 2 again.
  • A group that stays together: treat the group as one block. In a row of n with a block of g: (n − g + 1)! × g!. Round a table: (n − g)! × g!.
  • Two things kept apart: all arrangements minus those with the two together. In a row: n! − 2 × (n − 1)!. Round a table: (n − 1)! − 2 × (n − 2)!.
  • No two of a group next to each other in a row: (n − g)! × P(n − g + 1, g).
  • Two groups (for example at least 2 women): add C(a, i) × C(b, r − i) for every number i that fits the rule.
  • Things that must be in or out: C(n − in − out, r − in).
  • Binomial theorem: (A + B)^n is the sum of C(n, k) × A^(n − k) × B^k for k from 0 to n. The numbers C(n, k) form row n of Pascal's triangle.

Worked examples

A committee. Choose 3 people from 10. The order does not matter: C(10, 3) = (10 × 9 × 8) ÷ (3 × 2 × 1) = 720 ÷ 6 = 120.

A podium. First, second and third place among 10 runners. The order matters: P(10, 3) = 10 × 9 × 8 = 720.

A lottery. Choosing 6 numbers from 49 can be done in C(49, 6) = 13,983,816 ways, so one line has a chance of 1 in 13,983,816.

A code. A 4-digit code with digits from 0 to 9 that may repeat has 10^4 = 10,000 forms.

A word. MISSISSIPPI has 11 letters: 1 M, 4 I, 4 S and 2 P. That gives 11! ÷ (4! × 4! × 2!) = 34,650 arrangements.

A round table. 8 people can sit round a table in (8 − 1)! = 5,040 ways. Eight different beads on a ring that can be turned over make 2,520 rings.

Two groups. A committee of 4 from 6 women and 5 men with at least 2 women: 150 + 100 + 15 = 265 of the 330 possible committees.

An expansion. (2x + 3y)^4 = 16x^4 + 96x^3y + 216x^2y^2 + 216xy^3 + 81y^4.

Limits you should know

  • n and r can be whole numbers up to 1,000,000. Results of up to 50,000 digits are worked out exactly.
  • A result of up to 2,000 digits is shown in full in its row. Up to 20,000 digits, all digits are in a text box that you can copy. A longer exact result shows its first 30 digits and its number of digits.
  • Above 50,000 digits the result is not worked out. You get its first 6 digits and its number of digits, from logarithms. As a guide: n! has 1,998 digits for n = 807, 19,998 digits for n = 5,982 and 49,999 digits for n = 13,524.
  • A list of arrangements or selections is made up to 100,000 lines and 700,000 characters. Beyond that only the count is given.
  • Rules are solved only in the forms named above. The tool does not read a problem in words, and it does not combine several rules at one time.
  • A binomial expansion takes powers up to 100, with one letter in each part.
  • It does not multiply out other products of brackets, and it does not factor expressions.

Related tools