🔢 Permutation & Combination Calculator
Calculate permutations (nPr) and combinations (nCr) for any n and r values.
What is this tool?
A permutation and combination calculator is a mathematical tool that computes the number of ways to arrange or select items from a collection. These calculations are fundamental to combinatorics, probability theory, statistics, and computer science. Permutations count arrangements where order matters. For example, the number of ways to arrange 3 books on a shelf from a collection of 5 is a permutation, calculated as 5 times 4 times 3, which equals 60. Combinations count selections where order does not matter. Choosing 3 people from a group of 5 to form a committee is a combination, calculated as 5 choose 3, which equals 10. The notation nPr represents permutations of r items chosen from n total items, while nCr represents combinations. The key difference is whether the sequence or arrangement matters. A lock code 1-2-3 is different from 3-2-1, making it a permutation problem. But a hand of 3 cards is the same regardless of the order you draw them, making it a combination problem. These calculations appear in lottery odds, password security, team selection, seating arrangements, tournament brackets, and genetic analysis. Computing factorials by hand becomes impractical for large numbers, since 20 factorial is already a 19-digit number.How it works
For permutations nPr, the calculator computes n factorial divided by the quantity n minus r factorial. The formula is nPr equals n factorial divided by n minus r factorial. For example, 5P3 equals 5 factorial divided by 2 factorial, which is 120 divided by 2, giving 60. For combinations nCr, the calculator divides the permutation result by r factorial to account for the fact that order does not matter. The formula is nCr equals n factorial divided by r factorial times n minus r factorial. For example, 5C3 equals 5 factorial divided by 3 factorial times 2 factorial, which is 120 divided by 12, giving 10. The tool computes factorials iteratively to handle large values efficiently and validates that n and r are non-negative integers with n greater than or equal to r.How to use
- Enter the value of n, which is the total number of items in your collection.
- Enter the value of r, which is the number of items you are selecting or arranging.
- Press Calculate to see both the permutation nPr and combination nCr results simultaneously.
- Use nPr when the order of selection matters, such as arranging books or assigning positions.
- Use nCr when the order does not matter, such as choosing team members or drawing cards.
Frequently Asked Questions
Frequently Asked Questions
When do I use permutations vs combinations?
Use permutations when order matters. Arranging 3 people in a line, assigning gold silver bronze medals, or creating a password are permutation problems because the sequence changes the outcome. Use combinations when order does not matter. Selecting a committee, choosing lottery numbers, or picking a hand of cards are combination problems because the same items in any order count as one result.
What does n factorial mean?
N factorial, written as n followed by an exclamation mark, is the product of all positive integers from 1 to n. For example, 5 factorial is 5 times 4 times 3 times 2 times 1, which equals 120. By convention, 0 factorial equals 1. Factorials grow extremely fast, with 10 factorial already exceeding 3.6 million.
Can n be smaller than r?
No. You cannot select more items than you have available. The calculator requires n to be greater than or equal to r. If you enter an r value larger than n, the tool will alert you that the calculation is not valid.
How are these used in lottery calculations?
Lottery odds use combinations. If a lottery draws 6 numbers from 49, the number of possible combinations is 49C6, which equals about 13.98 million. Your chance of matching all 6 with one ticket is 1 in 13.98 million, or about 0.000007 percent. This is why lottery jackpots are so difficult to win.
Tips & Advice
When solving counting problems, first determine whether order matters before choosing permutation or combination. A useful test is to ask whether swapping two items creates a different result. If yes, use permutations. If no, use combinations. For problems involving repetition, where the same item can be selected multiple times, different formulas apply and this calculator handles the standard non-repeating case. Factorials grow astronomically, so for very large values of n, the results may exceed standard number precision. The calculator handles values up to n equals 170 before factorials exceed the floating-point limit. All computations run locally in your browser.