Math

Permutation & Combination

nPr and nCr calculations. Fast, accurate, and completely free.

Favorites

Recent Tools

Results
n! (Factorial):
nPr (Permutations):
nCr (Combinations):

Mathematical Formula

P(n,r) = \frac{n!}{(n-r)!} \quad C(n,r) = \frac{n!}{r!(n-r)!}

n = total number of items in the set

r = number of items being chosen

n! = n factorial = n × (n-1) × (n-2) × ... × 1

P(n,r) = number of permutations (order matters)

C(n,r) = number of combinations (order does not matter)

How to Use this Calculator

  1. Enter the total number of items (n) in your set.

  2. Enter how many items (r) you want to select from the set.

  3. The calculator instantly shows nPr (permutations), nCr (combinations), and n! (factorial).

  4. Review the step-by-step formula expansion to understand how each value is computed.

Understanding Permutations and Combinations

Permutations and combinations are fundamental concepts in combinatorics, the branch of mathematics that deals with counting, arrangement, and selection of objects. These concepts are essential in probability theory, statistics, computer science, and countless real-world applications ranging from lottery calculations to password security analysis. The key distinction between them is whether the order of selection matters.

What Are Permutations?

A permutation is an arrangement of objects where the order matters. The number of ways to arrange r items out of n items is given by nPr = n! / (n-r)!. For example, if you have 5 books and want to arrange 3 of them on a shelf, the number of possible arrangements is 5P3 = 5! / (5-3)! = 120 / 2 = 60. Changing the order of the same 3 books creates a different arrangement, which is why permutations produce larger numbers than combinations for the same n and r values.

What Are Combinations?

A combination is a selection of objects where the order does not matter. The number of ways to choose r items from n items is given by nCr = n! / [r!(n-r)!]. Using the same example, if you simply want to choose 3 books from 5 without caring about their order on the shelf, the number of ways is 5C3 = 5! / (3! × 2!) = 120 / 12 = 10. Combinations are always less than or equal to permutations because multiple permutations map to the same combination.

Understanding Factorials

The factorial function (denoted n!) is the product of all positive integers up to n. For instance, 5! = 5 × 4 × 3 × 2 × 1 = 120. By convention, 0! = 1, which is mathematically consistent and necessary for the permutation and combination formulas to work correctly when r equals n or r equals 0. Factorials grow extremely rapidly: 10! = 3,628,800, 15! = 1,307,674,368,000, and 20! = 2,432,902,008,176,640,000. This rapid growth is why large combinatorial problems quickly become computationally intensive.

Relationship Between nPr and nCr

There is a direct relationship between permutations and combinations: nPr = nCr × r!. This makes intuitive sense because each combination of r items can be rearranged in r! different ways to form different permutations. For example, 5P3 = 5C3 × 3! = 10 × 6 = 60. This relationship provides a useful shortcut and deepens understanding of how order affects counting.

Real-World Applications

  • Lottery Probability: Calculating the odds of winning a lottery involves combinations since the order of drawn numbers typically does not matter. For a 6/49 lottery, the number of possible combinations is 49C6 = 13,983,816.
  • Password Security: The number of possible passwords of a given length is a permutation problem. A 4-digit PIN from digits 0-9 has 10P4 = 5,040 arrangements if no repeats are allowed, or 10^4 = 10,000 if repeats are allowed.
  • Team Selection: Choosing a committee of 4 people from 20 candidates is a combination problem: 20C4 = 4,845 possible committees.
  • Tournament Scheduling: Determining the number of unique matchups in a round-robin tournament uses combinations: nC2 gives the total number of games needed.
  • Card Games: The number of possible 5-card poker hands from a standard 52-card deck is 52C5 = 2,598,960. Calculating poker hand probabilities relies heavily on combinatorial mathematics.

Permutations with Repetition

When items can be repeated, the formula changes. The number of permutations of r items from n items with repetition allowed is nr. For example, a 3-digit code using digits 0-9 with repeats has 103 = 1,000 possibilities. Combinations with repetition use a different formula: (n+r-1)! / [r!(n-1)!], also written as (n+r-1)Cr. These variations extend the basic concepts to more complex counting scenarios.

Tips for Problem Solving

When facing a counting problem, first determine whether order matters. If rearranging the same items creates a different outcome, use permutations. If only the selection itself matters, use combinations. Next, check whether repetition is allowed. These two decisions direct you to the correct formula. Practice with real examples to build intuition: arranging letters in a word uses permutations, while choosing toppings for a pizza uses combinations. Mastering these concepts provides a solid foundation for probability, statistics, and algorithmic thinking.

Frequently Asked Questions (FAQ)

What is the difference between permutation and combination?

In permutations, the order of selection matters (ABC is different from BCA), while in combinations, the order does not matter (ABC and BCA are the same selection). Permutations count arrangements, combinations count selections.

Why is 0 factorial equal to 1?

By mathematical convention, 0! = 1. This is consistent with the combinatorial interpretation: there is exactly one way to arrange zero objects (do nothing). It also ensures that formulas like nCn = n! / (n! × 0!) correctly yield 1.

What is the maximum value of n this calculator supports?

This calculator supports n values up to 170, because 171! exceeds the maximum value representable by JavaScript floating-point numbers (approximately 1.7 × 10^308), resulting in Infinity.

When should I use permutations vs combinations in probability?

Use permutations when the problem involves ordering or arranging items (such as race placements, seating arrangements, or sequential codes). Use combinations when the problem involves selecting a group without regard to order (such as choosing committee members or lottery numbers).

Can r be greater than n?

No, r cannot be greater than n when calculating standard permutations or combinations without repetition. You cannot select more items than are available. If r exceeds n, both nPr and nCr are zero.

What is the formula for permutations with repetition?

When repetition is allowed, the number of permutations of r items from n is n^r (n raised to the power r). For example, a 4-digit PIN using digits 0-9 with repetition has 10^4 = 10,000 possibilities.

Explore more tools you might find useful