Combinations & Permutations Calculator (nCr & nPr)

Combinations C(n,r)

0

Permutations P(n,r)

0

Steps

How Combinations and Permutations Work

A combination is a selection of items from a larger set where the order of selection does not matter. A permutation is an arrangement of items where order matters. These are the two fundamental counting principles in combinatorics, the branch of mathematics concerned with counting, arrangement, and selection. According to the Wolfram MathWorld reference, the combination formula was first formalized by Blaise Pascal in the 17th century as part of his work on the arithmetic triangle (now known as Pascal's triangle).

The distinction between combinations and permutations comes down to one question: does the order of selection matter? Choosing 3 pizza toppings from a menu of 10 is a combination problem (pepperoni-mushroom-olive is the same as olive-pepperoni-mushroom). Awarding gold, silver, and bronze medals to 3 of 10 runners is a permutation problem (who gets gold matters). Both concepts are essential in probability calculations, statistics, and fields ranging from genetics to cryptography.

The National Council of Teachers of Mathematics (NCTM) includes combinations and permutations in the high school probability and statistics standards. Understanding these concepts is prerequisite knowledge for the binomial distribution, hypothesis testing, and many real-world applications like lottery odds calculation and experimental design.

The Combination and Permutation Formulas

Both formulas use factorials (n! = n × (n-1) × ... × 1). The standard definitions, as found in any introductory combinatorics textbook, are as follows.

Combinations: C(n, r) = n! / (r! × (n − r)!)

Permutations: P(n, r) = n! / (n − r)!

Relationship: P(n, r) = C(n, r) × r!

Worked example: How many ways can you choose 3 committee members from a group of 10? C(10, 3) = 10! / (3! × 7!) = (10 × 9 × 8) / (3 × 2 × 1) = 720/6 = 120 combinations. If instead you need to assign them as president, secretary, and treasurer: P(10, 3) = 10! / 7! = 10 × 9 × 8 = 720 permutations. The permutation is exactly 3! = 6 times larger because each group of 3 people can be arranged in 6 different orderings. Use our Factorial Calculator for computing individual factorials.

Key Terms You Should Know

Combinations vs. Permutations: Quick Reference

Use this table to quickly determine which formula applies to your counting problem.

Scenario Order Matters? Formula C(10,3) / P(10,3)
Committee of 3 from 10NoC(n,r)120
President/VP/Secretary from 10YesP(n,r)720
Lottery 6 from 49NoC(n,r)C(49,6) = 13,983,816
Horse race (Win/Place/Show)YesP(n,r)P(12,3) = 1,320
4-digit PIN (repeats allowed)Yes, with repetitionnr104 = 10,000
Poker hand (5 from 52)NoC(n,r)C(52,5) = 2,598,960

Practical Examples

Lottery odds. In the U.S. Powerball lottery, you choose 5 numbers from 69 and 1 Powerball from 26. The odds of matching all 5 white balls is 1 in C(69, 5) = 11,238,513, and the overall jackpot odds are 1 in 11,238,513 × 26 = 1 in 292,201,338. According to the official Powerball website, these are the exact odds used to calculate prize probabilities.

Card games. The number of possible 5-card poker hands from a standard 52-card deck is C(52, 5) = 2,598,960. The probability of a royal flush is 4/2,598,960 = 1 in 649,740. The probability of any flush (5 cards of the same suit) is C(4, 1) × C(13, 5) = 5,148 hands, or about 1 in 505.

Password security. A password using lowercase letters (26), uppercase letters (26), digits (10), and 10 symbols (72 total characters) of length 8 has 728 = approximately 7.22 × 1014 possible permutations with repetition. If a computer can test 1 billion passwords per second, brute-forcing all combinations would take about 8.3 days. Increasing length to 12 characters raises this to 7212 = 1.94 × 1022, or about 614 years. This exponential growth demonstrates why longer passwords are dramatically more secure.

Tips for Solving Counting Problems

Combinations in the Binomial Theorem

The binomial theorem states that (a + b)n = Σ C(n, k) × an-k × bk for k = 0 to n. The combination C(n, k) serves as the coefficient for each term. For example, (x + 1)4 = C(4,0)x4 + C(4,1)x3 + C(4,2)x2 + C(4,3)x + C(4,4) = x4 + 4x3 + 6x2 + 4x + 1. The binomial coefficients (1, 4, 6, 4, 1) form row 4 of Pascal's triangle.

In probability, the binomial distribution uses C(n, k) to calculate the probability of exactly k successes in n independent trials: P(X = k) = C(n, k) × pk × (1-p)n-k. For example, the probability of getting exactly 3 heads in 5 fair coin flips is C(5, 3) × 0.53 × 0.52 = 10 × 0.03125 = 0.3125 (31.25%). Our Chi-Square Calculator applies similar counting principles to statistical hypothesis testing.

Frequently Asked Questions

What is the difference between combinations and permutations?

Combinations count selections where order does not matter, while permutations count arrangements where order is significant. Choosing 3 friends for a team is a combination (C(10,3) = 120 ways), but assigning them as captain, co-captain, and treasurer is a permutation (P(10,3) = 720 ways). The permutation count is always greater than or equal to the combination count for the same n and r, because P(n,r) = C(n,r) × r!. Each combination of r items can be arranged in r! different orders.

What is a factorial and why is 0! equal to 1?

A factorial (n!) is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. The value 0! = 1 by definition, which ensures consistency in combination and permutation formulas. Without this convention, C(n, 0) = n! / (0! × n!) would be undefined rather than correctly giving 1 (there is exactly one way to choose nothing). Our Factorial Calculator computes factorials up to 170! and displays the full multiplication chain.

How are combinations used to calculate lottery odds?

Lottery odds are calculated using the combinations formula because the order in which numbers are drawn does not matter. For the U.S. Powerball, the odds of matching all 5 white balls are 1 in C(69, 5) = 11,238,513. With the additional Powerball (1 in 26), the jackpot odds become 1 in 292,201,338. For the UK National Lottery (6 from 59), odds are 1 in C(59, 6) = 45,057,474. These enormous numbers explain why jackpots accumulate over many drawings.

What is C(n, 0) and C(n, n)?

C(n, 0) = 1 for any n, because there is exactly one way to choose nothing from any set (the empty selection). Similarly, C(n, n) = 1 because there is exactly one way to choose everything. These are boundary cases that follow directly from the formula: C(n, 0) = n! / (0! × n!) = 1. The symmetry property C(n, r) = C(n, n-r) also holds: choosing 3 items to include from 10 is the same as choosing 7 items to exclude, so C(10, 3) = C(10, 7) = 120.

How do you calculate combinations with repetition allowed?

When items can be selected more than once (like choosing scoops of ice cream where you can repeat flavors), use the "stars and bars" formula: C(n + r − 1, r), where n is the number of types and r is the number of selections. Choosing 3 scoops from 5 flavors with repetition gives C(5 + 3 − 1, 3) = C(7, 3) = 35 possible combinations. This is different from the standard formula because standard combinations assume each item can only be selected once.

What is Pascal's triangle and how does it relate to combinations?

Pascal's triangle is a triangular array where each entry is the sum of the two entries directly above it. Row n of Pascal's triangle contains the values C(n, 0), C(n, 1), ..., C(n, n). Row 4, for example, is 1, 4, 6, 4, 1, corresponding to C(4,0) through C(4,4). The triangle was studied by Blaise Pascal in 1653, though it was known earlier in China (Yang Hui's triangle, 1261) and Persia (Omar Khayyam, 11th century). It provides a quick lookup for small combination values without needing factorial computation.

Related Calculators