Permutation and Combination Calculator
Permutations and combinations.
Formula
P=n!/(n-r)!; C=n!/[r!(n-r)!]
Example
P(5,3)=60; C(5,3)=10.
Embed this calculator on your site
Add this free calculator to your own website with one line of code. The embedded version is responsive, ad-free, and includes a small attribution link back to CalcNest AI.
<iframe src="https://calcnestai.com/embed/permutation-and-combination-calculator.html" width="100%" height="700" frameborder="0" style="border: 1px solid #e5e5e5; border-radius: 12px; max-width: 720px;" loading="lazy" title="Permutation and Combination Calculator — Free Tool by CalcNest AI"></iframe>
Understanding the Permutation and Combination Calculator
A permutations and combinations calculator counts arrangements and selections from a set. The distinction between them is whether order matters, and confusing the two is the single most common error in introductory probability.
How it actually works
Enter the total items n and the number chosen r. The calculator computes permutations as n factorial over n minus r factorial, and combinations by dividing that by r factorial. Choosing 3 from 10 gives 720 permutations and 120 combinations.
| Question | Count |
|---|---|
| Gold, silver, bronze from 10 | P(10,3) = 720 |
| A committee of 3 from 10 | C(10,3) = 120 |
| Ratio | 3! = 6 |
| Reason | Each committee has 6 orderings |
The deeper context most people miss
The factor of six between them is exactly the number of ways three chosen people can be ordered. Every unordered selection corresponds to r factorial ordered arrangements, which is why dividing permutations by r factorial gives combinations.
Why the binomial coefficient appears everywhere
The combination count is the binomial coefficient, and it recurs far beyond counting problems. It gives the coefficients in the expansion of a binomial raised to a power, which is where the name originates and which explains why Pascal's triangle, whose entries are these coefficients, has the property that each entry is the sum of the two above it: choosing r items from n either includes a particular item or does not, giving the recurrence directly. It appears in the binomial distribution, counting the arrangements of successes among trials, which is why the probability of exactly k successes involves it. It counts lattice paths on a grid, since a path of fixed length is determined by which steps go one way. It counts subsets of a given size, which is why the total over all sizes is two to the n, matching the count of all subsets. It appears in the hockey stick identity, in Vandermonde's identity, and throughout combinatorial proofs, many of which work by counting the same collection two ways and equating the results, which is an elegant proof technique requiring no algebra at all. In practice, computing a binomial coefficient by evaluating three factorials and dividing overflows unnecessarily, since the intermediate values are enormous while the result is not, and multiplying and dividing incrementally keeps everything manageable.
A worked example: the birthday problem
Choosing 3 from 10 gives 120 combinations, and counting problems become interesting when the answer contradicts intuition. The birthday problem is the standard case: in a group of 23 people the probability that two share a birthday exceeds half, which surprises nearly everyone. The reason is that the relevant count is pairs rather than people, and 23 people form 253 pairs, each with a small chance of matching, and those chances accumulate. Calculating it directly is awkward and calculating the complement is easy: the probability that all birthdays differ is the product of each person having a birthday unlike all previous ones, and that product falls below half at 23. Computing the complement is a general technique worth reaching for whenever a problem asks for the probability of at least one occurrence, since the complement is exactly one specific outcome rather than many. The same mathematics underlies birthday attacks in cryptography, where finding any collision in a hash function takes roughly the square root of the output space rather than the full space, which is why a hash needs 256 bits to give 128 bits of collision resistance. That factor of two in exponent terms is a direct consequence of counting pairs rather than items.
Deciding which count a problem needs
Ask whether rearranging the chosen items gives a different outcome. Awarding distinct prizes, filling distinct roles, arranging in a sequence, and forming ordered passwords all use permutations. Forming a committee, dealing a hand of cards, choosing a subset, and selecting toppings all use combinations. The wording frequently signals it: arrange, order, and rank point to permutations while choose, select, and group point to combinations. Several complications change the count further. Repetition allowed rather than forbidden gives different formulas entirely, with ordered selection with repetition being simply n to the power r and unordered selection with repetition given by a stars-and-bars argument. Indistinguishable items reduce the count, which is why arranging the letters of a word with repeated letters divides by the factorial of each repeat count. Circular arrangements have fewer distinct orderings than linear ones, since rotating a circle gives the same arrangement, so n items in a circle give n minus one factorial rather than n factorial. Restrictions requiring certain items together or apart are handled by treating a group as a single unit or by subtracting the forbidden cases. Getting the right formula depends more on reading the problem carefully than on remembering formulas.
Why combinatorial explosion limits computation
Counting problems grow at rates that defeat intuition and computation alike. The number of orderings of a set grows factorially, so 20 items have more orderings than there are grains of sand on Earth, and 52 items, the orderings of a card deck, exceed the number of atoms in the observable galaxy. That is why a properly shuffled deck has almost certainly never appeared in that exact order before. The practical consequence is that any algorithm requiring examination of all permutations is infeasible beyond very small inputs, which is what makes the travelling salesman problem hard: checking every route for 20 cities is already impossible. Subsets grow exponentially at two to the n, which is better than factorial and still defeats brute force by around 50 items. This is why combinatorial optimisation relies on branch and bound, dynamic programming, heuristics, and approximation rather than exhaustive search, and why NP-hardness matters as a practical rather than theoretical concern. The counterpoint is that many such problems have structure that clever algorithms exploit, and modern solvers handle instances with thousands of variables that naive counting says are impossible, which is why the gap between worst-case complexity and practical solvability is one of the more interesting features of the field.
Variations: repetition, multisets, and related counts
Permutations without repetition use n factorial over n minus r factorial. Permutations with repetition are simply n to the power r. Combinations without repetition give the binomial coefficient. Combinations with repetition use a stars-and-bars argument, counting the ways to distribute identical items into distinct categories. Multiset permutations divide by the factorial of each repeat count, which is how anagram counts of words with repeated letters are found. Circular permutations divide by n to account for rotations, and dividing again by two accounts for reflections where a necklace and its mirror image are the same. Derangements count permutations leaving no element in place, answering the classic envelope problem, with the proportion converging to one over e. Partitions count ways of splitting a set or a number, and the integer partition function grows subexponentially in a way that resisted a closed form for centuries. Catalan numbers count balanced bracket sequences, binary trees, and triangulations, appearing across a startling range of problems. Stirling numbers count set partitions into a fixed number of blocks.
Counting arrangements and selections
Ask whether rearranging the chosen items gives a different outcome, since that single question distinguishes permutations from combinations and the two differ by a factor of r factorial. Watch the wording, since arrange, order, and rank indicate permutations while choose, select, and group indicate combinations. Establish whether repetition is allowed, since it changes the formula entirely rather than adjusting it. Divide by the factorial of each repeat count when items are indistinguishable, as in anagrams of words with repeated letters. Use n minus one factorial for circular arrangements, since rotations give the same arrangement. Compute binomial coefficients by multiplying and dividing incrementally rather than evaluating three factorials, which overflows unnecessarily. Reach for the complement whenever a problem asks for the probability of at least one occurrence, since the complement is a single outcome. Expect factorial growth to defeat brute force by around 15 items and exponential growth by around 50. And check an answer's plausibility, since combinations can never exceed permutations for the same n and r.
What people get wrong
- Using permutations where combinations are needed, which overcounts by a factor of r factorial and is the most frequent error in introductory probability.
- Computing a binomial coefficient by evaluating three factorials separately, which overflows on modest inputs while incremental multiplication and division stays in range.
- Applying the no-repetition formulas when repetition is allowed, which changes the count entirely rather than by a correction factor.
- Counting circular arrangements as n factorial, when rotations produce the same arrangement and the correct count is n minus one factorial.
Where the math comes from
Permutations of r from n are n! / (n−r)!, counting ordered arrangements. Combinations are n! / (r!(n−r)!), dividing by r! because each unordered selection corresponds to r! distinct orderings. Combinations therefore never exceed permutations, and the two coincide only when r is zero or one.
Questions and answers
Sample vs population formulas?
Sample variance uses n-1 in the denominator (unbiased estimator); population variance uses n. Most calculators default to sample (correct for most uses).
What if my data is not normal?
Many statistical tests assume normality. Robust alternatives (median, IQR, non-parametric tests) work better for skewed data. Check your data's shape before applying tests.
How many data points do I need?
Depends on the test. For estimating a mean, 30+ is often sufficient. For complex inference (regression, ANOVA), more is needed. Power analysis specifies the required sample size for a given effect.
What is a p-value?
Probability of seeing your result (or more extreme) if the null hypothesis were true. p < 0.05 is the conventional threshold for 'statistically significant', though this convention is increasingly criticized.
Correlation vs causation?
Correlation describes joint variation between variables. Causation requires showing that one variable affects another. Strong correlation does not imply causation; randomized experiments are the gold standard for establishing causality.
What's the difference between them?
Whether order matters. Awarding gold, silver, and bronze from 10 people gives 720 permutations; choosing a committee of 3 from the same 10 gives 120 combinations. They differ by 3 factorial, the number of ways three people can be ordered.
How do I tell which one a problem wants?
Ask whether rearranging the chosen items produces a different outcome. Distinct roles and rankings need permutations; committees, hands of cards, and subsets need combinations. Wording helps, with arrange and rank against choose and select.
Why divide by r factorial?
Because every unordered selection of r items corresponds to r factorial distinct orderings, all of which the permutation count treats separately. Dividing collapses each group of orderings to the single selection they represent.
How should I compute large binomial coefficients?
By multiplying and dividing incrementally rather than evaluating three factorials and combining them. The intermediate factorials overflow on modest inputs while the result itself stays in range, so cancelling as you go keeps everything manageable.
Why is the birthday problem surprising?
Because the relevant count is pairs rather than people. Twenty-three people form 253 pairs, and the accumulated chance of any pair matching exceeds a half. The same counting underlies birthday attacks on hash functions.
What if repetition is allowed?
The formulas change entirely rather than being adjusted. Ordered selection with repetition is n to the power r, and unordered selection with repetition uses a stars-and-bars argument counting distributions of identical items into distinct categories.
Why do circular arrangements differ?
Because rotating a circular arrangement produces the same arrangement, so the n factorial orderings collapse into groups of n. The count is therefore n minus one factorial, and dividing by two again handles reflections where mirror images are equivalent.
Related calculators
Golden Ratio · GCD and LCM · Greatest Common Factor · Volume · Summation Sigma