Math · Combinatorics
Permutation &
Combination Calculator
Calculate nPr, nCr, permutations with repetition, combinations with repetition, circular permutations, and derangements — with full step-by-step factorial expansion.
—
nPr
—
nCr
Choose n and r
,
Quick Examples
Permutation
₁₀P₃
—
Combination
₁₀C₃
—
nPr (no repeat)
—
nCr (no repeat)
—
Perm w/ repeat
—
Comb w/ repeat
—
📊 All Counting Methods — n=10, r=3
📋 Step-by-Step: nPr and nCr
🔺 Pascal's Triangle — Click any value to set as nCr
Each cell = nCr where n is the row (starting 0) and r is the position (starting 0). Row sums = powers of 2.
💡 Real-World Scenarios — Click to Load
Permutations vs Combinations
The key question is: does order matter? If you're arranging items (passwords, race finishes, podium positions) — use permutations. If you're selecting a group where sequence doesn't matter (committees, card hands, lottery tickets) — use combinations.
All Counting Formulas
Permutation (no repeat): nPr = n! / (n-r)! — order matters
Combination (no repeat): nCr = n! / (r!(n-r)!) — order doesn't matter
Perm with repetition: n^r — like PIN codes
Comb with repetition: C(n+r-1, r) — like ice cream scoops
Circular permutation: (n-1)! — arrangements in a circle
Derangement: D(n) = n!×Σ(-1)^k/k! — no item in original place
nPr = nCr × r! (each combo → r! perms by reordering)
What is a derangement?
A derangement is a permutation where no element appears in its original position. The number of derangements of n items is D(n) = n! × (1/0! − 1/1! + 1/2! − 1/3! + ...) ≈ n!/e. For example, D(3) = 2: if positions are {A,B,C}, the only derangements are BCA and CAB. Famous application: the "hat check" problem — n people check in hats; if hats are returned randomly, D(n)/n! ≈ 1/e ≈ 36.8% chance that no one gets their own hat, regardless of n.
What is a circular permutation?
In a circular permutation, arrangements that can be rotated into each other are considered identical. For n people sitting around a round table, there are (n−1)! distinct arrangements — we fix one person's position and arrange the rest. For a linear arrangement, there are n! ways. For example, 5 people at a round table: (5−1)! = 24 arrangements (vs 5! = 120 for a line). If the table also has reflective symmetry (like a necklace), divide by 2: (n−1)!/2.
How does Pascal's triangle relate to combinations?
Every cell in Pascal's triangle equals a combination C(n,r) where n is the row and r is the position (both starting from 0). Each cell is the sum of the two cells above it, which mirrors the identity C(n,r) = C(n-1,r-1) + C(n-1,r). Row n gives the coefficients of (a+b)^n (binomial theorem). Row sums = 2^n. The triangle is infinite and contains many patterns: Fibonacci numbers appear in diagonal sums, triangular numbers appear in the third diagonal.
How do I calculate the probability of winning the lottery?
A typical lottery picks 6 numbers from 49 without replacement, order doesn't matter. The number of possible tickets = C(49,6) = 13,983,816. Your probability = 1/13,983,816 ≈ 0.0000000715 (about 1 in 14 million). If order mattered (permutation): P(49,6) = 10,068,347,520 — much rarer. The combination formula is used because "1,2,3,4,5,6" and "6,5,4,3,2,1" are the same winning ticket.