Math

Combinations & Permutations Calculator

Calculate permutations P(n,r) and combinations C(n,r) with step-by-step factorial expansion. See both formulas, exact results, and detailed explanations.

Quick Answer

Permutations count ordered arrangements: P(n,r) = n!/(n-r)!. Combinations count unordered selections: C(n,r) = n!/(r!(n-r)!). The key difference is whether order matters.

Enter Values

n = total items, r = items chosen. r must be n.

Permutation
P(n,r) = n! / (n-r)!
Combination
C(n,r) = n! / (r!(n-r)!)
Permutations P(10,3)
720
Order matters
Combinations C(10,3)
120
Order does not matter
10!
3,628,800
3!
6
(10-3)! = 7!
5,040

Permutation Step-by-Step

Formula

P(10,3) = 10! / (10-3)! = 10! / 7!

Expand 10!

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × ...

Expand (10-3)! = 7!

7! = 7 × 6 × 5 × 4 × 3 × 2 × 1

Simplify (cancel common terms)

P(10,3) = 10 × 9 × 8

Result

P(10,3) = 720

Combination Step-by-Step

Formula

C(10,3) = 10! / (3! × (10-3)!) = 10! / (3! × 7!)

Expand 3!

3! = 3 × 2 × 1

Simplify

C(10,3) = P(10,3) / 3! = 720 / 6

Result

C(10,3) = 120

About This Tool

The Combinations and Permutations Calculator computes both P(n,r) and C(n,r) for any valid inputs, displaying exact results using BigInt arithmetic to avoid floating-point precision loss. It shows step-by-step factorial expansions, simplifications, and the final answers. This tool is essential for probability students, statisticians, competitive programmers, and anyone solving counting problems in combinatorics.

Permutations: When Order Matters

A permutation is an ordered arrangement of r items chosen from n items. The formula P(n,r) = n!/(n-r)! counts the number of ways to arrange r items where the sequence matters. For example, P(10,3) = 10!/7! = 10 × 9 × 8 = 720, meaning there are 720 different ways to arrange 3 items chosen from 10 in a specific order. Permutations are used when assigning positions (1st, 2nd, 3rd place), creating passwords, seating arrangements, or any scenario where the order of selection is important.

Combinations: When Order Does Not Matter

A combination is an unordered selection of r items from n items. The formula C(n,r) = n!/(r!(n-r)!) counts the number of ways to choose r items where order is irrelevant. For example, C(10,3) = 10!/(3! × 7!) = 120, meaning there are 120 different groups of 3 that can be selected from 10 items. Combinations are used in lottery odds calculations, committee selection, card hands, team formation, and any scenario where you are picking a subset without regard to arrangement.

The Relationship Between P and C

Combinations and permutations are closely related: C(n,r) = P(n,r) / r!. This makes intuitive sense because combinations ignore the r! different orderings of the r chosen items. For every combination of r items, there are r! permutations of those same items. So the number of combinations is always less than or equal to the number of permutations. When r = 0, both equal 1 (there is exactly one way to choose nothing and one way to arrange nothing). When r = n, P(n,n) = n! and C(n,n) = 1.

Pascal's Triangle and Binomial Coefficients

C(n,r) values are also known as binomial coefficients and form Pascal's triangle. Each entry in Pascal's triangle equals C(n,r) = C(n-1,r-1) + C(n-1,r). This recurrence relationship makes it possible to build the triangle row by row. Binomial coefficients appear in the binomial theorem: (a+b) = sum of C(n,k) × aⁿ⁻ᵏ × b for k = 0 to n. They also appear in probability theory, combinatorial identities, and polynomial expansion.

Real-World Applications

Combinatorics is used everywhere: calculating lottery odds (C(49,6) for a 6/49 lottery), determining the number of possible poker hands (C(52,5) = 2,598,960), computing the number of possible passwords, analyzing network routing paths, scheduling tournament brackets, and designing experiments. In computer science, combinations and permutations underlie algorithm analysis (counting possible inputs), hash function design, and coding theory. Understanding these concepts is fundamental to probability, statistics, and discrete mathematics.

Factorial Growth and Practical Limits

Factorials grow extremely fast: 10! = 3,628,800 and 20! = 2,432,902,008,176,640,000. By 170!, the number exceeds 10³, which is the largest factorial that fits in a standard 64-bit floating-point number. This calculator uses BigInt arithmetic to compute exact results beyond that limit, handling values of n up to 170. For even larger values, specialized mathematical software or approximations like Stirling's formula (n! is approximately sqrt(2 pi n) × (n/e)) are used.

Frequently Asked Questions

What is the difference between combinations and permutations?
The key difference is order. Permutations count ordered arrangements (ABC is different from CBA), while combinations count unordered selections (ABC and CBA are the same group). Use permutations when order matters (rankings, passwords, sequences) and combinations when it doesn't (teams, committees, card hands).
How do I know whether to use combinations or permutations?
Ask yourself: 'Does the order of selection matter?' If choosing a committee of 3 from 10 people, the group {Alice, Bob, Carol} is the same regardless of order, so use combinations. If assigning 1st, 2nd, and 3rd place, the order matters, so use permutations. A helpful test: if rearranging the selected items creates a 'different' result, use permutations.
What is n factorial (n!)?
n! (n factorial) is the product of all positive integers from 1 to n: n! = n x (n-1) x (n-2) x ... x 2 x 1. By convention, 0! = 1. Factorials grow extremely rapidly: 10! = 3,628,800 and 20! = 2.43 x 10^18. Factorials count the number of ways to arrange n distinct objects in a sequence.
What are binomial coefficients?
Binomial coefficients are another name for C(n,r) values. They appear as coefficients in the expansion of (a+b)^n. They also form Pascal's triangle, where each entry is the sum of the two entries above it. The notation 'n choose r' or C(n,r) = n!/(r!(n-r)!) is used interchangeably with the binomial coefficient notation.
What is the maximum n this calculator supports?
This calculator supports n up to 170 using BigInt arithmetic for exact integer results. Beyond 170, the numbers become astronomically large (170! has 307 digits). For practical purposes, n = 170 covers virtually all real-world counting problems. For theoretical work with larger values, Stirling's approximation provides useful estimates.
How do I calculate lottery odds?
Lottery odds use combinations because the order of drawn numbers doesn't matter. For a 6/49 lottery, the odds of matching all 6 numbers are 1 in C(49,6) = 13,983,816. For a Powerball-style lottery (5/69 + 1/26), the odds are 1 in C(69,5) x 26 = 292,201,338. Enter the lottery parameters into this calculator to find the exact odds.

Was this tool helpful?