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 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?
How do I know whether to use combinations or permutations?
What is n factorial (n!)?
What are binomial coefficients?
What is the maximum n this calculator supports?
How do I calculate lottery odds?
You might also like
Was this tool helpful?