Formula Bro

Math and physics formulas, explained like you are new.


Combinations

In one sentence: A combination counts the different groups you can pick from a set of items when the order of the picks does not matter.

C(n,k)=(nk)=n!k!(n−k)!C(n,k) = \binom{n}{k} = \frac{n!}{k!\,(n-k)!}

Read it out loud: “C of n, k, also written n choose k, equals n factorial, divided by k factorial times n minus k factorial. Here n is the total number of items you can pick from, and k is how many you pick. The order of the picks does not matter, so the answer counts groups, not lists.”

Before you start

The ideas and signs this page uses, explained from zero. For powers of ten, Greek letters and other notation in general, see Math basics.

Factorial, n!n!

n!n! is read ‘n factorial’. It means multiply nn by every whole number below it, down to 1: 4!=4×3×2×1=244! = 4 \times 3 \times 2 \times 1 = 24. A factorial counts orders, the number of ways to line up nn different items in a row. By convention 0!=10! = 1, which means there is exactly one way to line up nothing.

Ordered and unordered

Ordered means the sequence matters, like first place and second place. Unordered means only the chosen items matter, like the members of a team. Ana, Ben and Cy form the same team in any order. Combinations are unordered, and permutations are ordered.

Binomial notation (nk)\binom{n}{k}

(nk)\binom{n}{k} is read ‘n choose k’. The stacked numbers show the total nn on top and the number picked kk below. It counts the groups of kk items you can choose from nn items. Another name for this count is the binomial coefficient, and it is the same number that appears in Pascal’s triangle.

Canceling factors in a fraction

A fraction with factorials often simplifies, because the same factors appear on the top and the bottom. In 5!3!2!\frac{5!}{3!\,2!}, the factors 3, 2 and 1 in 3!3! cancel against the same factors in 5!5!. What is left is 5⋅42⋅1=202=10\frac{5 \cdot 4}{2 \cdot 1} = \frac{20}{2} = 10.

Pascal’s triangle (background)

Pascal’s triangle is a pattern of numbers in rows, where each number is the sum of the two numbers above it. The row for n=5n = 5 reads 1, 5, 10, 10, 5, 1. Those numbers are the combinations (50),(51)\binom{5}{0}, \binom{5}{1} up to (55)\binom{5}{5}, so the triangle is a table of combinations.

What each symbol means

SymbolMeaning

C(n,k)C(n,k)

The number of combinations, read ‘n choose k’. It counts groups, so it has no unit. The same number is also written (nk)\binom{n}{k}. For 5 friends and a team of 3, C(5,3)=10C(5,3) = 10 different teams.

nn

The total number of items you can pick from, a whole number 0 or more. For example, n=5n = 5 means there are five friends to choose from. Every item can be picked once, and the count has no unit.

kk

The number of items you pick for the group, a whole number from 0 to nn. For a team of three friends, k=3k = 3. It counts the members of the group, not the order in which they were picked.

n!n!

The factorial of nn, the product of every whole number from nn down to 1. For example 4!=244! = 24, and by convention 0!=10! = 1. It counts the ways to line up nn items in a row, so it has no unit.

The formula piece by piece

nn

The total number of items you can choose from. In the team example, n=5n = 5 friends. Every friend is available to pick once, so nn counts the whole pool of people, toppings or cards.

kk

How many items you pick for the group. Here k=3k = 3, a team of three. It is a whole number from 0 up to nn, and it counts the members of the group, not the order they were picked in.

k!k!

The number of ways to line up the kk picked items. Each group of kk items appears this many times in the ordered count, so dividing by k!k! removes the repeats. For a team of 3, 3!=63! = 6.

(n−k)!(n-k)!

The factorial of the items you leave out. When n!n! is divided by (n−k)!(n-k)!, the factors for the leftover items cancel, and only the kk spots remain. This gives the count of ordered picks, before the repeats are removed.

C(n,k)=(nk)=n!k!(n−k)!C(n,k) = \binom{n}{k} = \frac{n!}{k!\,(n-k)!}

In one plain sentence: the number of groups of kk items you can pick from nn items, where order does not matter, equals nn factorial divided by kk factorial times (n−k)(n-k) factorial.

What the formula is doing, and why

What goes in and what comes out. You put in nn, the number of items you can choose from, and kk, the number you want in the group. You get out a whole number of different groups. The result has no unit, because it counts groups. Picking Ana and then Ben gives the same group as picking Ben and then Ana, so only one of those counts.

Why divide by k!k!? Start with the ordered case. The first pick has nn choices, the second has n−1n-1, and so on down to n−k+1n-k+1 for the last pick. That gives n!(n−k)!\frac{n!}{(n-k)!} ordered picks. But each group of kk items shows up in k!k! different orders, so the ordered count repeats every group k!k! times. Dividing by k!k! removes those repeats, which leaves n!k!(n−k)!\frac{n!}{k!\,(n-k)!}.

Why do the factorials make sense? The (n−k)!(n-k)! part cancels the factors for the items you did not pick. A useful fact follows from the formula: (nk)=(nn−k)\binom{n}{k} = \binom{n}{n-k}. Choosing the kk items you want is the same as choosing the n−kn-k items you leave out, so both choices give the same count.

When should you use it? Use combinations when a group matters and a list does not, such as a team, a set of toppings or a poker hand. When the order does matter, for example for first, second and third place, use permutations instead. For the same nn and kk, permutations always give at least as many answers, because each group can be ordered in k!k! ways.

Edge cases. If k=0k = 0, there is exactly one way to pick nothing, and the count is 1. If kk is bigger than nn, there are no groups at all, so the count is 0.

An everyday picture

Think of picking a team of three friends from five for a board game. Ana, Ben and Cy is the same team as Cy, Ben and Ana, so the order you chose them in does not count. A combination counts the teams, not the orders in which each team was picked. There are 10 different teams, even though there are 60 ordered ways to make the picks.

Worked example: Picking a team of 3 from 5 friends

You have 5 friends and want a team of 3 for a board game. The order you pick them in does not matter, so we want the number of combinations C(5,3)C(5, 3), read ‘5 choose 3’. Name the friends A, B, C, D and E to follow the steps.

  1. Count the ordered picks. The first pick has 5 choices, the second has 4 left, and the third has 3 left. So there are 5⋅4⋅3=605 \cdot 4 \cdot 3 = 60 ordered picks. This count treats ‘first Ana, then Ben, then Cy’ and every other order as separate picks.
  2. Count the orders inside one team. A team of 3 people can be lined up in 3!=3⋅2⋅1=63! = 3 \cdot 2 \cdot 1 = 6 ways. So each team of three shows up 6 times among the 60 ordered picks.
  3. Divide out the repeats. Every team is counted 6 times, so divide the ordered count by 6. That gives C(5,3)=606=10C(5,3) = \frac{60}{6} = 10 teams.
  4. Check with the formula. The standard formula for combinations gives the same answer. Compute the factorials first: we have 5!=1205! = 120, 3!=63! = 6 and 2!=22! = 2, so the value is 1206⋅2=12012=10\frac{120}{6 \cdot 2} = \frac{120}{12} = 10. Both methods agree.
  5. List the teams to see the result. The 10 teams are ABC, ABD, ABE, ACD, ACE, ADE, BCD, BCE, BDE and CDE. Each team is written once, in alphabetical order, so no team is counted twice.
  6. Notice the symmetry. Choosing the 3 people for the team is the same as choosing the 2 people who stay off it. So C(5,3)=C(5,2)=5⋅42⋅1=10C(5,3) = C(5,2) = \frac{5 \cdot 4}{2 \cdot 1} = 10, which matches the count.

Answer: There are 10 different teams of 3 friends. The ordered count of 60 is six times too big, because each team appears in six different orders.

The numbers in this example are recomputed by script every time the site is built.

Common mistakes

Where you will meet it

Questions people ask

What is the difference between combinations and permutations?

A permutation counts ordered arrangements, such as first, second and third place. A combination counts groups where the order is ignored. For the same nn and kk, the permutation count is k!k! times the combination count. For 8 runners and 3 places, that is 336=6×56336 = 6 \times 56.

Why do the factorials always give a whole number?

Every group is counted k!k! times in the ordered count, so dividing by k!k! leaves exactly one count per group. A count of groups must be a whole number, so the result is always whole.

What are $C(n,0)$ and $C(n,n)$?

Both equal 1. There is exactly one way to pick nothing, and exactly one way to pick everything. For example, C(5,0)=5!0!5!=1C(5,0) = \frac{5!}{0!\,5!} = 1.

Sources

  1. Combination, Wikipedia
  2. Binomial coefficient, Wikipedia

| All Computer Science formulas |

Published 2026-10-22. Plain-text copy for AI agents and readers: computer-science/combinations.md.