Inputs

The size of the group you are choosing from (0–170)
How many items are chosen or arranged
With replacement: items can be chosen more than once
C(n, r) — Both Modes
Enter n and r above
Permutations (nPr)
Combinations (nCr)
nPr = n! / (n−r)! nCr = n! / (r! × (n−r)!)

Real-World Scenarios

Select a scenario to auto-populate n and r, see the result, and get a plain-English explanation.

Pascal's Triangle

Every entry at row n, position r equals C(n,r). The currently selected C(n,r) is highlighted in cyan.

Binomial Expansion

Expand (a + b)n using the Binomial Theorem. Coefficients are C(n,k) values from Pascal's Triangle.

📋

How to Use This Calculator

1

Enter n and r

Set n (the total number of items) and r (how many you are selecting or arranging). For example, n = 10 players, r = 3 positions.

2

Choose Mode and Replacement

Select Permutation when order matters (seating, race rankings), Combination when it does not (committees, lottery), or Both to see both at once. Toggle With Replacement if items can repeat (passwords, dice rolls).

3

Read the Step-by-Step Work

The result card shows factorial expansions — e.g. 5! = 5 × 4 × 3 × 2 × 1 = 120 — so you can follow every step. Switch to the Scenarios tab for real-world examples, or Pascal's Triangle to visualise C(n,r) on the triangle.

Formulas & Methodology

Permutation (without replacement)
nPr = n! / (n − r)!
Ordered arrangements of r items chosen from n. Divide n! by the factorial of the leftover (n − r) items.
Combination (without replacement)
nCr = n! / (r! × (n − r)!)
Unordered selections of r items from n. Divide by r! as well to cancel the r! orderings we no longer care about.
With Replacement
nPr (repl) = nʳ  |  nCr (repl) = C(n+r−1, r)
When items can repeat: permutations grow exponentially (n choices per slot), combinations use the stars-and-bars formula C(n+r−1, r).
📖

Key Terms

Permutation An ordered arrangement of r items from a set of n. ABC and BAC are different permutations. Symbol: nPr or P(n,r).
Combination An unordered selection of r items from n. {A,B,C} and {B,A,C} are the same combination. Symbol: nCr, C(n,r), or "n choose r".
Factorial (n!) The product of all positive integers up to n. 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention, 0! = 1.
n (population) The total number of distinct items available in the set you are choosing from.
r (sample) The number of items selected or arranged. Must satisfy 0 ≤ r ≤ n for counting without replacement.
With vs Without Replacement Without replacement: each item appears at most once. With replacement: items can repeat (like rolling a die multiple times).
📊

Worked Examples

🏛️

Committee of 3 from 5 people

n = 5, r = 3, no replacement, combination

Result
C(5,3) = 5! / (3! × 2!) = 120 / (6 × 2) = 10

There are 10 different committees of 3 people from a group of 5. Because membership is what matters — not the order in which people were picked — we use a combination.

📄

Counting in the Real World

Passwords and Security

When you create an 8-character password from 94 printable ASCII characters with repetition allowed, there are 94⁸ ≈ 6.1 trillion possible passwords. This is a permutation with replacement. Without repetition (each character appears at most once), you get P(94, 8) = 94!/86! ≈ 5.5 trillion — only slightly fewer, because 8 out of 94 characters is a small fraction. Increasing password length by even one character multiplies the possibilities by ~94×, which is why length matters far more than character-set variety alone.

Poker Hands

In a 52-card deck there are C(52, 5) = 2,598,960 distinct 5-card poker hands. Because a hand is a set of cards — not a sequence — order does not matter and we use combinations. Of those hands, only 4 are royal flushes (one per suit), giving a probability of 4/2,598,960 ≈ 1 in 650,000. Recognising that hands are combinations, not permutations, is the first step in calculating precise poker odds.

Tournament Brackets

In a single-elimination bracket of 64 teams, the number of possible outcomes is 2⁶³ ≈ 9.2 × 10¹⁸ — roughly 9.2 quintillion. Each of the 63 games has two possible winners, and results are ordered (winning the first round is not the same as winning the final), making this a permutation-style calculation. This is why a "perfect bracket" is statistically near-impossible even with domain knowledge.

Frequently Asked Questions

What is the difference between permutation and combination?

A permutation counts ordered arrangements — ABC differs from BAC. A combination counts unordered selections — {A,B,C} equals {B,A,C}. As a shortcut: if you can swap two items and get the same result, use a combination; if swapping changes the result, use a permutation.

What does 0! equal and why?

By convention, 0! = 1. This ensures formulas like C(n, 0) = 1 are consistent — there is exactly one way to choose zero items from any set (the empty selection). It also follows from the recursive relationship n! = n × (n−1)!, which gives 1! = 1 × 0!, so 0! must equal 1.

When do I use permutations versus combinations?

Use permutations when sequence or position matters: assigning prizes (1st, 2nd, 3rd), generating PIN codes, scheduling tasks in order. Use combinations when only membership matters: forming a committee, dealing poker hands, buying lottery tickets. A quick test: would rearranging the items give a different valid outcome? If yes, permutation; if no, combination.

How do I handle very large n values?

This calculator uses standard floating-point arithmetic, which supports n up to 170 (171! overflows to infinity). For n above about 20, factorials become astronomically large but the ratio nPr or nCr remains manageable. The step-by-step display is omitted for n > 12 to keep output readable, but the result is still computed accurately via cancellation.

What is the relationship between nPr and nCr?

nPr = nCr × r!. Combinations count unordered groups; multiplying by r! reintroduces all the orderings, giving permutations. Equivalently, nCr = nPr / r! — every combination corresponds to r! permutations that have the same members. This is why nPr ≥ nCr for all valid n and r.