CalcTune
📐
Math · tools

Permutation & Combination Calculator

Calculate permutations (nPr) and combinations (nCr) instantly. Enter the total number of items and how many to select to find all possible arrangements and selections.

Total number of items

Number of items to select

Example values — enter yours above
PERMUTATION(nPr)
60

Number of arrangements where order matters

Order matters: ABC ≠ BAC ≠ CAB
COMBINATION(nCr)
10

Number of selections where order doesn't matter

Order doesn't matter: ABC = BAC = CAB
💡

Understanding the Difference

Example: Choosing 3 people from 5 for a race (positions matter) = 60 permutations. Choosing 3 people from 5 for a team (positions don't matter) = 10 combinations.

Understanding Permutations and Combinations: A Complete Guide

Permutations and combinations are fundamental concepts in combinatorics, the branch of mathematics concerned with counting. These tools help us answer questions like: how many ways can we arrange books on a shelf, select team members, create passwords, or deal poker hands? Though the terms are often used interchangeably in casual conversation, they represent distinct counting principles. The key difference lies in whether the order of items matters—permutations care about order, while combinations do not.

What Are Permutations?

A permutation is an arrangement of items in a specific order. When calculating permutations, we're asking: "In how many different ways can we arrange r items chosen from a set of n items?" The classic example is determining how many ways three people can finish first, second, and third in a race of five runners. Here, order is critical: Alice finishing first and Bob second is different from Bob finishing first and Alice second.

The permutation formula is nPr = n! / (n - r)!, where n is the total number of items and r is the number of items being arranged. The exclamation mark denotes factorial: n! = n × (n - 1) × (n - 2) × ... × 1. For example, 5P3 = 5! / (5 - 3)! = 120 / 2 = 60. This means there are 60 different ways to arrange 3 items from a set of 5.

What Are Combinations?

A combination is a selection of items where order does not matter. When we calculate combinations, we're asking: "In how many ways can we select r items from a set of n items, regardless of the order?" The classic example is choosing 3 team members from a group of 5 people. Whether we pick Alice, Bob, and Carol or Carol, Bob, and Alice, it's the same team.

The combination formula is nCr = n! / (r! × (n - r)!). Notice this is the permutation formula divided by r!. This division accounts for the fact that in combinations, all the different orders of the same r items count as just one selection. For instance, 5C3 = 5! / (3! × 2!) = 120 / (6 × 2) = 10. There are only 10 different teams of 3 people that can be formed from a group of 5.

The Fundamental Difference: Order Matters or Not

The distinction between permutations and combinations boils down to whether the sequence or position of selected items is important. Imagine you have five books labeled A, B, C, D, and E, and you want to place three of them on a shelf. If you care about the order—book A on the left, book B in the middle, book C on the right is different from book C on the left, book A in the middle, book B on the right—you're dealing with permutations. There are 5P3 = 60 such arrangements.

Now suppose you simply want to know how many different sets of three books you can choose to take on vacation, and you don't care in what order you read them or pack them. In this case, choosing books A, B, and C is the same as choosing C, B, and A. Here, you're calculating combinations, and there are 5C3 = 10 possible selections. In general, for the same values of n and r, nPr will always be greater than or equal to nCr, because permutations account for all possible orderings of each selection.

Real-World Applications

Permutations and combinations appear in countless practical scenarios. In probability and statistics, they're used to calculate odds for lotteries, card games, and dice rolls. For example, the number of possible five-card poker hands from a 52-card deck is 52C5 = 2,598,960 combinations. In password security, permutations determine how many possible passwords exist when choosing characters from a set and order matters—an 8-character password using 26 lowercase letters has 26^8 permutations if repetition is allowed.

In operations research and logistics, combinations help determine how to select teams, assign tasks, or choose items from inventory. In biology, combinations are used in genetics to calculate possible genotypes. In computer science, permutations and combinations underpin algorithms for sorting, searching, and optimizing solutions. Understanding these concepts is essential for fields ranging from data science to cryptography, competitive programming to game theory.

Special Cases and Properties

Several special cases and properties simplify calculations. When r = 0, both nP0 and nC0 equal 1 (there's one way to select or arrange nothing). When r = n, nPn = n! (all possible arrangements of n items) and nCn = 1 (only one way to select all items). When r = 1, nP1 = n and nC1 = n (selecting or arranging one item from n is simply n choices).

Combinations exhibit a symmetry property: nCr = nC(n - r). This makes sense intuitively—choosing 3 items to include from 5 is the same as choosing 2 items to exclude. This property can simplify calculations, as you can always compute the smaller of the two values. Additionally, the sum of all combinations nC0 + nC1 + nC2 + ... + nCn equals 2^n, representing all possible subsets of a set of n items, including the empty set and the full set.

Calculating with Large Numbers

For small values of n and r, permutations and combinations can be calculated by hand or with a simple calculator. However, factorials grow extremely rapidly. For instance, 20! exceeds 2.4 quintillion. When computing large permutations and combinations, it's important to cancel terms before multiplying to avoid overflow errors. For example, to compute 100C2, rather than calculating 100! / (2! × 98!), simplify to (100 × 99) / (2 × 1) = 4,950.

Many scientific calculators, spreadsheets, and programming libraries include built-in functions for permutations and combinations (often labeled nPr and nCr or denoted with P(n, r) and C(n, r) or "n choose r"). These tools handle large numbers efficiently by using optimized algorithms and avoiding unnecessary factorial calculations. When working with very large values where exact computation is impractical, approximations such as Stirling's formula can be used to estimate factorials.

Permutations and Combinations in Probability

In probability theory, permutations and combinations are indispensable. To calculate the probability of an event, you divide the number of favorable outcomes by the total number of possible outcomes. Many problems involve counting these outcomes using permutations or combinations. For example, the probability of drawing exactly 2 aces from a 5-card hand in a standard deck is calculated by dividing the number of hands with 2 aces by the total number of 5-card hands: [4C2 × 48C3] / 52C5.

Understanding when to use permutations versus combinations in probability problems is crucial. If the problem involves distinct positions or sequences (like drawing cards one by one and caring about order), use permutations. If the problem involves selecting a group or set without caring about order (like forming a committee or choosing lottery numbers), use combinations. Misidentifying which method to use is a common source of errors in probability calculations.

Frequently Asked Questions

What is the difference between permutation and combination?

Permutation counts arrangements where order matters (ABC is different from BAC), while combination counts selections where order doesn't matter (ABC is the same as BAC). For the same n and r, there are always more permutations than combinations because each combination corresponds to r! different permutations.

How do I know whether to use permutation or combination?

Ask yourself: does the order or position of items matter? If yes, use permutation (nPr). If no, use combination (nCr). For example, arranging books on a shelf = permutation (order matters). Choosing team members = combination (order doesn't matter).

What does nPr and nCr mean?

nPr means the number of permutations of r items selected from n items, calculated as n! / (n - r)!. nCr means the number of combinations of r items selected from n items, calculated as n! / (r! × (n - r)!). Both require that r ≤ n and both n and r are non-negative integers.

Can r be greater than n in permutation or combination?

No, r cannot be greater than n. You cannot select or arrange more items than you have available. If r > n, both nPr and nCr are undefined (or equal to 0 by convention in some contexts). Always ensure r ≤ n when calculating.

What is the value of 0! (zero factorial)?

By mathematical convention, 0! = 1. This definition makes many formulas work correctly, including permutations and combinations. For example, nC0 = n! / (0! × n!) = 1, which correctly represents that there is exactly one way to select zero items from a set: do nothing.