General calculator
Combinations and Permutations Calculator
Free online combinations and permutations calculator. Calculate nCr and nPr with or without repetition, with step-by-step factorial formulas.
Introduction
Combinatorics is the branch of mathematics dealing with combinations of objects belonging to a finite set in accordance with specified rules. Our Combinations and Permutations Calculator helps you solve fundamental counting problems by calculating Permutations (nPr) and Combinations (nCr) both with and without repetition. Simply enter the total number of items (n) and the number of chosen items (r) to get started.
How to Use
To use the Combinations and Permutations Calculator, input the total number of items in the set (n) and the number of items you want to choose from that set (r). Ensure that both n and r are non-negative integers and that r is less than or equal to n. Click "Calculate" to view results for combinations, permutations, and versions with repetition permitted.
Formula
Permutations without repetition formula: nPr = n! / (n - r)!. Combinations without repetition formula: nCr = n! / [r! × (n - r)!]. Permutations with repetition formula: n^r. Combinations with repetition formula: (n + r - 1)! / [r! × (n - 1)!]. Here, "!" denotes the factorial function, which is the product of all positive integers less than or equal to that number.
Examples
Example: Suppose you have n = 5 items and want to choose r = 3. Permutations (nPr) = 5! / (5-3)! = 120 / 2 = 60. Combinations (nCr) = 5! / [3! × (5-3)!] = 120 / (6 × 2) = 10. Permutations with repetition = 5^3 = 125. Combinations with repetition = (5+3-1)! / [3! × (5-1)!] = 7! / (6 × 24) = 35.
Results Explained
The results show: (1) Combinations (nCr): the number of ways to choose r items from a set of n where order does not matter. (2) Permutations (nPr): the number of ways to arrange r items chosen from a set of n where order does matter. (3) Versions with repetition: the counts when items can be selected multiple times.
Related Calculators
Combinatorics: The Science of Counting
Combinatorics is a foundational pillar of modern mathematics, computer science, and probability. At its core, it seeks to answer a simple question: "How many ways can we arrange or select objects?" When selecting objects from a larger pool, two fundamental criteria govern the math: whether the **order of selection matters** and whether we can **select the same object more than once (repetition)**.
Statisticians distinguish these concepts using two terms that are frequently confused in everyday speech: **permutations** and **combinations**.
Permutations vs. Combinations: What's the Difference?
The easiest way to remember the difference is through a simple rule of thumb: **order**.
- Permutations (Order Matters): Think of a race podium. If three runners—Alice, Bob, and Charlie—finish in a race, the outcome Alice-first, Bob-second, Charlie-third is different from Bob-first, Alice-second, Charlie-third. Because the order of finish matters, this is a permutation.
- Combinations (Order Does NOT Matter): Think of a fruit salad. If you combine apples, bananas, and grapes in a bowl, the result is the same whether you put the apples in first or last. Because the order of entry does not affect the final group, this is a combination.
A common joke among math students is that a "combination lock" is poorly named. Since the order of numbers you dial matters (e.g. 12-34-56 is not the same as 34-12-56), it should actually be called a **permutation lock**!
Detailed Mathematical Formulas
Let's break down the formulas for each of the four categories calculated by our tool:
1. Permutations without Repetition
This is used when you arrange a subset of items and cannot reuse items. For example, arranging books on a shelf or seating people in chairs.
Formula: nPr = n! / (n - r)!
2. Combinations without Repetition
This is used when you select a group of items and cannot reuse them. For example, drawing lottery numbers or selecting a committee of employees from a pool.
Formula: nCr = n! / [r! × (n - r)!]
3. Permutations with Repetition
This is used when order matters and you can reuse items. For example, creating a digital password of a specific length using numbers 0-9. Since 1-1-1-1 is a valid password, repetition is allowed.
Formula: n^r
4. Combinations with Repetition
This is used when order does not matter and you can choose the same item multiple times. For example, purchasing 5 donuts from a shop that sells 3 flavors. You can choose 5 of the same flavor or a mix.
Formula: (n + r - 1)! / [r! × (n - 1)!]
Three Detailed Worked Examples
Example 1: Seating a Committee (Permutation)
Out of 10 board members, in how many ways can we elect a President, Vice President, and Secretary?
1. Identify total items (n) = 10, and chosen items (r) = 3.
2. Since roles are distinct, order matters → Permutations.
3. Formula: 10P3 = 10! / (10 - 3)! = 10! / 7! = 10 × 9 × 8 = 720.
There are 720 different ways to assign the roles.
Example 2: Selecting a Team (Combination)
Out of the same 10 board members, in how many ways can we select a general committee of 3 members?
1. Identify n = 10, r = 3.
2. Since committee roles are not distinct, order does not matter → Combinations.
3. Formula: 10C3 = 10! / [3! × (10-3)!] = (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120.
There are 120 different ways to form the committee.
Example 3: Safe Combination Lock (Permutations with Repetition)
A safe lock requires a 4-digit code where numbers can repeat. If you can choose from digits 0 to 9, how many possible codes exist?
1. Identify pool size (n) = 10 (digits 0-9), code length (r) = 4.
2. Since order matters and repetition is allowed → Permutations with repetition.
3. Formula: n^r = 10^4 = 10,000.
There are 10,000 possible safe codes.
Frequently Asked Questions
What is a combination?
A combination is a selection of items from a larger set where the order of selection does not matter.
What is a permutation?
A permutation is an arrangement of items from a larger set where the order of selection is important and changes the outcome.
What does nCr mean?
nCr stands for the number of combinations of n items taken r at a time. It represents the formula: n! / [r! × (n-r)!].
What does nPr mean?
nPr stands for the number of permutations of n items taken r at a time. It represents the formula: n! / (n-r)!.
What is a factorial (!)?
A factorial of a positive integer n (written as n!) is the product of all positive integers less than or equal to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Zero factorial (0!) is defined as 1.
Why does order matter in permutations but not combinations?
Permutations track specific positions (like first, second, third place), so changing the order creates a new outcome. Combinations track membership in a group (like a committee), so changing the order of choice does not change who is in the group.
What is combinations with repetition?
Combinations with repetition refers to selecting r items from n options where the order does not matter, but you can select the same item more than once (e.g. buying a dozen cookies of 3 different types).
What is permutations with repetition?
Permutations with repetition refers to arranging r items chosen from n options where order matters and you can reuse items (e.g. standard PIN numbers or passwords).
How do I know whether to use nCr or nPr?
Ask yourself: "Does changing the order of the items change the outcome?" If yes, use nPr (permutations). If no, use nCr (combinations).
What is the value of nCr when n equals r?
When n equals r, nCr is always 1. There is only 1 way to choose all items from a set.
What is the value of nPr when n equals r?
When n equals r, nPr is equal to n!. It represents the number of ways to arrange the entire set of items.
Can n be smaller than r?
In combinations and permutations without repetition, r cannot exceed n because you cannot choose more unique items than exist in the set. However, with repetition, r can be larger than n.
How is combinatorics used in computer science?
It is used to analyze algorithm complexity, compute probabilities in cryptography, optimize database queries, and design network layouts.
What is the connection between combinatorics and probability?
Probability is often calculated as favorable outcomes divided by total outcomes. Combinatorics provides the tools (nCr and nPr) to count those outcomes in complex scenarios.
How does a lottery use combinations?
Lotteries typically draw a set of numbers (e.g. 6 numbers out of 49) where the order drawn does not matter. The total possible ticket combinations are calculated using nCr (e.g. 49C6).