How to use this calculator
- Enter total objects n, selected objects k.
- Review the assumptions and units shown beside the fields.
- Read the live result, calculation note, and worked examples before using the answer.
Deciding whether order creates a new outcome
Combinations and permutations begin with the same question: choose k distinct objects from a pool of n distinct objects without selecting an object twice. They differ in what counts as a new outcome. A combination records only membership in the selected group. A permutation also records the order or role assigned to each selected object.
From five people, choosing Alice and Bob for an undifferentiated two-person committee is the same group as choosing Bob and Alice. That is one combination. Assigning one as chair and the other as secretary creates two arrangements because swapping the roles changes the outcome. The first problem ignores order; the second preserves it.
A reliable test is to imagine swapping two selected objects. If the swap leaves the outcome unchanged, use combinations. If it changes a sequence, rank, code, or role assignment, use permutations. Words such as choose or select do not settle the issue on their own; the structure of the outcome does.
Factorial as the count of full orderings
The factorial n! multiplies every positive integer from n down to 1. For n = 5, 5! = 5 × 4 × 3 × 2 × 1 = 120. This counts the ways to order all five distinct objects: five choices for the first position, four remaining choices for the second, then three, two, and one.
The boundary value 0! is defined as 1. That convention keeps the counting formulas consistent. With n = 0 and k = 0, the function returns factorial 1, permutations 1, and combinations 1: there is one empty ordering and one empty selection. With n = 10 and k = 0, it returns 10! = 3,628,800 but still one zero-length permutation and one empty combination.
Factorial grows rapidly. The calculator restricts n to at most 170, and its returned values use JavaScript numbers. Large mathematical integers can therefore be displayed in scientific notation and can exceed exact integer precision even though the counting formula is valid. Small examples are best for learning and manual verification; large results should be interpreted with the output format and precision limit in mind.
Permutations for ordered selections
The permutation formula is P(n,k) = n!/(n−k)!. Cancelling the factorials leaves k descending factors: n × (n−1) × ... × (n−k+1). For n = 5 and k = 2, that is 5 × 4 = 20. There are five choices for the first role and four remaining choices for the second.
The result assumes no repetition. After an object fills one position, it is unavailable for the next. A two-character code that allows the same symbol twice follows a different model and should not use this calculator's no-replacement permutation count. Likewise, indistinguishable objects require adjustments because swapping identical objects does not create a visible new arrangement.
When k = n, permutations become n! because all objects are being ordered. For n = 5 and k = 5, P(5,5) = 120. When k = 0, the product contains no factors and equals 1. These boundary cases provide quick checks that the inputs and formula are being interpreted correctly.
Combinations remove duplicate orders
The combination formula is C(n,k) = n!/[k!(n−k)!]. It can also be read as P(n,k)/k!. The division by k! removes the internal orderings of each selected group. For five objects chosen two at a time, P(5,2) = 20 and 2! = 2, so C(5,2) = 20 ÷ 2 = 10.
Each unordered pair appears twice among the ordered pairs: AB and BA. Dividing by 2 collapses those duplicates. For a selection of three objects, each group appears 3! = 6 times in the permutation list, once for each internal ordering. The k! denominator is therefore not an arbitrary algebraic addition; it corrects a specific overcount.
Choosing all five objects gives C(5,5) = 1 because there is only one group containing every object, even though that group has 120 possible orders. Choosing none also gives C(5,0) = 1. These results distinguish the number of subsets from the number of sequences built from their members.
Worked case: choosing three from eight
For n = 8 and k = 3, the full factorial is 8! = 40,320. The ordered count is P(8,3) = 8 × 7 × 6 = 336. The unordered count is C(8,3) = 336 ÷ 3! = 336 ÷ 6 = 56. These are three different answers to three different questions about the same pool.
Suppose eight finalists are available. Ordering first, second, and third place uses the 336 permutations because each position is distinct. Choosing three finalists for an equal-status panel uses the 56 combinations because rearranging the names does not produce a new panel. The factorial 40,320 would apply only if all eight finalists were placed in a complete order.
The relative sizes provide a check. Factorial counts all eight positions, so it is larger than the three-position permutation count. Combinations remove the six internal orders of every three-person group, so 56 is exactly one-sixth of 336. If a result reverses those relationships for this case, either n and k were swapped or the wrong counting model was selected.
Symmetry of combinations, not permutations
Combinations obey C(n,k) = C(n,n−k). Choosing three objects to include from eight uniquely determines the five objects left out, so C(8,3) and C(8,5) both equal 56. This complement relationship is a useful independent check and can make hand calculations shorter when k is close to n.
Permutations do not share that symmetry. The function returns P(8,3) = 336 but P(8,5) = 6,720. An ordered list of five positions contains more information than an ordered list of three positions, so the counts should differ. Applying combination symmetry to permutations would discard the role of sequence length.
The symmetry also clarifies wording. Selecting five winners from eight is equivalent to selecting three non-winners only when both groups are unordered and the labels winner and non-winner are fixed. If the five winners are then ranked, the second step introduces order and requires additional counting.
Valid inputs and model boundaries
The function accepts integers satisfying 0 ≤ k ≤ n ≤ 170. A fractional n or k does not describe a count of selected discrete objects in this model, so it returns no result. Negative counts and k greater than n are also rejected. Zero is valid and should not be excluded by a rule that says only positive integers are allowed.
The formulas assume the objects are distinct and selection occurs without replacement. If repetition is allowed, an object can reappear and the number of choices does not shrink in the same way. If some objects are identical, simply permuting their labels can overcount arrangements. Circular arrangements, constrained positions, and selections split into categories also need more specialized formulas.
The calculator reports n!, P(n,k), and C(n,k) together so their meanings can be compared. It does not determine which output answers the original question. State the outcome clearly, decide whether a swap changes it, and confirm whether reuse is allowed before selecting the relevant number.
Checking large and small counts
Small cases can often be listed. With n = 3 and k = 2, the ordered outcomes AB, AC, BA, BC, CA, and CB total 6, while the unordered groups AB, AC, and BC total 3. Listing confirms that every combination corresponds to 2! permutations and makes the order distinction concrete.
For a larger verified case, choosing 5 objects from 52 gives C(52,5) = 2,598,960, while P(52,5) = 311,875,200. Their ratio is 5! = 120, exactly the number of ways to arrange each five-object group. The full 52! value is far larger and is not needed to understand that relationship.
Use identities as checks rather than recomputing the same expression. Confirm C(n,k) = P(n,k)/k!, C(n,k) = C(n,n−k), P(n,n) = n!, and C(n,0) = C(n,n) = 1. When the input is large enough to exceed exact JavaScript integer precision, avoid treating every displayed final digit as exact; the conceptual identity and intended precision should be documented.
Reference and example table
| Case | Meaning |
|---|---|
| Example 1 | For n=5 and k=2, permutations are 20 and combinations are 10. |
| Example 2 | 5! equals 120. |
| Example 3 | Choosing all 5 of 5 objects gives one combination and 120 orderings. |
Frequently asked questions
What is the difference between a permutation and a combination?
A permutation treats a change in order as a new outcome. A combination counts only the selected group, so rearranging its members does not create another result.
What do n and k represent?
n is the total number of distinct available objects, and k is the number selected without repetition. The calculator requires integers with 0 ≤ k ≤ n ≤ 170.
Why do 5 objects chosen 2 at a time give 20 permutations but 10 combinations?
There are 5 × 4 = 20 ordered pairs. Every unordered pair appears in two orders, so dividing by 2! gives 10 combinations.
What happens when k equals n?
There is one combination containing all objects, while the permutations equal n!. For n = 5, that means 1 combination and 120 permutations.
Is zero a valid input?
Yes. The function uses 0! = 1, and selecting zero objects gives one empty permutation and one empty combination.
Does the calculator allow an object to be selected more than once?
No. Its permutation and combination formulas model selection without replacement. Problems with repetition require different formulas.
Why are C(8,3) and C(8,5) both 56?
Choosing the three included objects uniquely determines the five excluded objects, and vice versa. This complement symmetry applies to combinations, not permutations.
Are very large results exact?
The function builds counts with integer arithmetic but returns JavaScript numbers. Results beyond the safe-integer range can lose exact final digits or use scientific notation, even though n is capped at 170.