How to use the combination calculator
- Enter n, the total number of items in your set.
- Enter k, the number of items you want to choose.
- The combination calculator displays the number of possible selections instantly.
- Use the result to evaluate odds, plan experiments, or solve combinatorics problems.
How the combinations formula works
The number of combinations is written as C(n, k) or "n choose k". The standard combinations formula is:
C(n, k) = n! / (k! * (n - k)!)
Here, the exclamation mark denotes a factorial: the product of all positive integers up to that number. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120.
To see this in action, suppose you have 10 items and want to choose 3. Plugging into the formula gives 10! / (3! * 7!) = 3,628,800 / (6 * 5,040) = 120. There are exactly 120 unique groups of three you can form from ten items.
Efficient computation and large numbers
Computing factorials directly causes overflow very quickly. A better approach uses the multiplicative formula, which multiplies only k terms:
C(n, k) = (n * (n-1) * ... * (n-k+1)) / (k * (k-1) * ... * 1)
This combination calculator also applies the symmetry property C(n, k) = C(n, n-k). If you ask for C(100, 97), it computes C(100, 3) instead, reducing the loop from 97 iterations down to 3. Results are computed using JavaScript's native double-precision floats, which represent integers exactly up to 253 (about 9 quadrillion). Beyond that threshold, the displayed value may lose trailing digits of precision, though it remains a close approximation.
Common combination values reference
Below is a table of frequently used binomial coefficient values. These appear often in statistics, card games, and discrete mathematics.
| n (total items) | k (chosen) | C(n, k) |
|---|---|---|
| 5 | 2 | 10 |
| 10 | 3 | 120 |
| 10 | 5 | 252 |
| 13 | 5 | 1,287 |
| 49 | 6 | 13,983,816 |
| 52 | 5 | 2,598,960 |
You can verify any of these by entering the n and k values into the fields above.
Combinations versus permutations
A common point of confusion is the difference between combinations and permutations. In a combination, order does not matter. Choosing Alice and Bob is the same as choosing Bob and Alice; it counts as one selection. In a permutation, order matters, so those would be two distinct outcomes.
The relationship between them is straightforward: P(n, k) = C(n, k) * k!. Permutations are always equal to or greater than combinations for the same n and k. If you need arrangements where sequence is important, you are looking for permutations rather than what this combination calculator provides.
Practical applications
The binomial coefficient shows up across many disciplines. In poker, calculating the number of possible five-card hands from a 52-card deck requires C(52, 5), yielding 2,598,960 unique hands. Lottery odds rely on the same math: a typical 6-from-49 draw has C(49, 6) = 13,983,816 possible tickets.
In statistics, combinations determine the number of ways to select a sample from a population, forming the basis of hypergeometric distributions. Computer scientists use them to analyze algorithm complexity and subset generation. Even everyday tasks like picking team members or menu items involve computing n choose k.
Edge cases and rules
Several boundary conditions are worth noting when working with combinations:
- k equals 0: C(n, 0) is always 1. There is exactly one way to choose nothing from a set.
- k equals n: C(n, n) is always 1. There is exactly one way to choose every item.
- k greater than n: This is undefined in standard combinatorics. You cannot choose more items than exist in the set, so the calculator returns an error.
- Negative inputs: Factorials are defined for non-negative integers, so both n and k must be zero or positive.
These rules ensure the combination calculator produces mathematically valid results for every input.
Worked examples
Each result below was produced by the same code the tool runs, so you can check your own numbers against them.
| Example | Input | Result |
|---|---|---|
| Poker hand (5 cards from 52) | Total items (n): 52; Items to choose (k): 5 | Combinations C(52, 5): 2,598,960 |
| Lottery pick (6 from 49) | Total items (n): 49; Items to choose (k): 6 | Combinations C(49, 6): 13,983,816 |
| Choose 2 from 10 | Total items (n): 10; Items to choose (k): 2 | Combinations C(10, 2): 45 |
| All items chosen | Total items (n): 7; Items to choose (k): 7 | Combinations C(7, 7): 1 |
FAQ
What does a combination calculator do?
It computes the number of ways to choose k items from a set of n items where the order of selection does not matter. This value is known as the binomial coefficient or "n choose k".
What is the formula for combinations?
The combinations formula is C(n, k) = n! / (k! * (n - k)!), where n! represents the factorial of n.
Can k be larger than n?
No. You cannot select more items than the set contains. If k is greater than n, the calculation is invalid and the tool will show an error.
Why is C(n, 0) equal to 1?
There is exactly one way to choose zero items from any set: by selecting nothing at all. Mathematically, n! / (0! * n!) simplifies to 1 because 0! is defined as 1.
Is this the same as a permutation?
No. Permutations account for the order of items, while combinations do not. Permutations will always yield a larger or equal number compared to combinations for the same inputs.
How accurate are the results for very large numbers?
Results are exact for values up to about 9 quadrillion (2^53). Beyond that, JavaScript floating-point arithmetic may round the least significant digits, but the magnitude remains correct.
Does my data get sent to a server?
No. The combination calculator performs all computations locally in your browser. Nothing is transmitted over the network.