Combinations & Permutations Calculator

Calculate nCr and nPr.

Examples:

Enter n and r values to calculate combinations and permutations

What Are Combinations and Permutations?

Combinations and permutations are fundamental concepts in combinatoricsβ€”the mathematics of counting. They answer the question: "In how many ways can we select or arrange items from a set?"

The key distinction is whether order matters:

  • Permutations: Order matters (ABC β‰  BAC)
  • Combinations: Order doesn't matter (ABC = BAC)

Understanding when to use each is crucial for probability calculations, statistical sampling, and countless real-world applications.

Permutations

Without Repetition

When arranging rr items from nn distinct items, where each item can only be used once:

P(n,r)=n!(nβˆ’r)!P(n,r) = \frac{n!}{(n-r)!}

Example: How many ways can 3 runners finish in 1st, 2nd, and 3rd place from a race of 10 runners?

P(10,3)=10!7!=10Γ—9Γ—8=720P(10,3) = \frac{10!}{7!} = 10 \times 9 \times 8 = 720

With Repetition

When items can be repeated:

nrn^r

Example: How many 4-digit PINs are possible using digits 0-9?

104=10,00010^4 = 10,000

Combinations

Without Repetition

When selecting rr items from nn distinct items, where order doesn't matter:

C(n,r)=(nr)=n!r!(nβˆ’r)!C(n,r) = \binom{n}{r} = \frac{n!}{r!(n-r)!}

This is called "n choose r" and is denoted (nr)\binom{n}{r}.

Example: How many ways can you choose 3 team members from 10 candidates?

C(10,3)=10!3!Γ—7!=7206=120C(10,3) = \frac{10!}{3! \times 7!} = \frac{720}{6} = 120

With Repetition

When items can be selected multiple times:

C(n+rβˆ’1,r)=(n+rβˆ’1r)C(n+r-1, r) = \binom{n+r-1}{r}

Example: How many ways can you choose 5 donuts from 3 flavors (chocolate, glazed, strawberry)?

C(3+5βˆ’1,5)=C(7,5)=21C(3+5-1, 5) = C(7,5) = 21

The Relationship

Notice that:

P(n,r)=C(n,r)Γ—r!P(n,r) = C(n,r) \times r!

This makes sense: to get permutations from combinations, multiply by the number of ways to arrange the rr selected items.

Practical Applications

Lottery Probability

Most lotteries use combinations since the order of drawn numbers doesn't matter. If a lottery draws 6 numbers from 49:

C(49,6)=13,983,816C(49,6) = 13,983,816

So your odds of matching all 6 are about 1 in 14 million.

Card Games

A poker hand is 5 cards from a 52-card deck:

C(52,5)=2,598,960 possible handsC(52,5) = 2,598,960 \text{ possible hands}

Password Security

If passwords must be exactly 8 characters using 62 possible characters (a-z, A-Z, 0-9):

628=218,340,105,584,896 possible passwords62^8 = 218,340,105,584,896 \text{ possible passwords}

Sampling Theory

In statistics, combinations underlie sample size calculations and probability distributions like the hypergeometric distribution.

Committee Selection

Choosing a committee of 5 from 20 people: C(20,5)=15,504C(20,5) = 15,504 ways.

But choosing a president, vice president, and secretary from 20: P(20,3)=6,840P(20,3) = 6,840 ways.

Factorial Growth

Factorials grow extraordinarily fast:

nn!
5120
103,628,800
151,307,674,368,000
202,432,902,008,176,640,000

This rapid growth explains why brute-force solutions to combinatorial problems quickly become computationally infeasible.

Common Formulas Summary

ScenarioFormula
Permutations (no repetition)n!(nβˆ’r)!\frac{n!}{(n-r)!}
Permutations (with repetition)nrn^r
Combinations (no repetition)n!r!(nβˆ’r)!\frac{n!}{r!(n-r)!}
Combinations (with repetition)(n+rβˆ’1)!r!(nβˆ’1)!\frac{(n+r-1)!}{r!(n-1)!}

Connection to Probability

Combinations are essential for calculating probabilities. The binomial probability formula uses combinations:

P(X=k)=(nk)pk(1βˆ’p)nβˆ’kP(X=k) = \binom{n}{k} p^k (1-p)^{n-k}

Similarly, the hypergeometric distribution relies heavily on combinations for sampling without replacement.

Related Calculations

Summary

Combinations and permutations form the foundation of counting theory and probability. The choice between them depends on whether order matters in your specific problem. Permutations count arrangements where sequence is significant; combinations count selections where it isn't. Mastering these concepts unlocks the ability to calculate probabilities and enumerate possibilities across countless applications.