Permutation & Combination Calculator — nPr and nCr
Compute nPr (order matters) and nCr (order does not) for integers n and r. Formulas, domain checks, and worked examples — free math tool.
Inputs
nPr
—
Where this formula comes from
Permutations count ordered selections: nPr = n! / (n−r)!. Combinations ignore order: nCr = n! / (r!(n−r)!), which equals nPr / r!.
Both require integers with 0 ≤ r ≤ n. Factorials grow quickly; the engine uses multiplicative loops suited to typical classroom values.
Use permutations for ranked assignments or codes; use combinations for unordered committees or hands of cards.
Common mistakes
- Swapping nPr and nCrIf order does not matter, divide by r! (combinations).
- Allowing r > nUndefined in the standard school formulas — rejected here.
- Non-integer n or rClassic nPr/nCr are defined for non-negative integers.
How to use this calculator
Enter integers n and r with 0 ≤ r ≤ n. nPr counts ordered selections; nCr counts unordered ones and equals nPr / r!. Typical classroom values stay well inside the factorial limits of the engine.
Examples: choosing a president/VP/secretary from 10 people is a permutation; choosing a 3-person committee from 10 is a combination. If order on the roster does not matter, divide by r!.
Reject paths cover r > n and non-integers for the classic school definitions. Larger n needs log-gamma or big-integer libraries — this tool targets ordinary combinatorics homework and quick checks.
Related counting problems (with repetition, circular permutations, multinomial coefficients) need different formulas. Do not force them into plain nPr/nCr without adjusting the model.
With repetition allowed (order matters, items replaceable), the count is n^r, not nPr. With repetition in combinations, the count is C(n+r−1, r). Those are different tools — do not reuse nPr/nCr labels for them.
Password or PIN estimates that allow repetition and ordered digits should use n^r style counting. Using nPr underestimates the space when digits can repeat.
Poker hands are combinations because suit order in the hand usually does not create a different hand category for counting purposes in introductory problems. Seating arrangements around a labeled table are permutations. Write one sentence stating whether order matters before picking nPr or nCr.
When some items are identical, ordinary nPr/nCr overcount. Divide by factorials of repetition counts (multinomial style) or use a specialized generator. The plain calculator assumes distinct items.
Binomial coefficients C(n,r) are the building blocks of binomial probability. After you compute nCr here, multiply by p^r(1−p)^{n−r} only when trials are independent with constant success probability — that second step is outside this combinatorics page.
Frequently asked questions
- When do I use nPr vs nCr?
- Use nPr when order matters (rankings, codes). Use nCr when order does not (committees, hands of cards).
- What are the formulas?
- nPr = n!/(n−r)! and nCr = n!/(r!(n−r)!). Also nCr = nPr/r!.
- What if r is greater than n?
- Classic school nPr/nCr are undefined for r > n. The calculator rejects that input.
- Do n and r need to be integers?
- Yes for the factorial definitions used here. Non-integers are rejected.