On this page
Some counting questions look impossible to list: how many ways to pick 12 doughnuts from 5 varieties, or how many shortest routes cross a grid. You do not list them. You find a second set that is easy to count and match the two, one object to one object. That matching is a bijection.
What is a bijection in counting?
A bijection between two sets is a pairing in which every element of each set has exactly one partner in the other. The Bijection Rule states that if there is a bijection f from A to B, then |A| = |B|, as set out in Chapter 11, "Cardinality Rules", of MIT's Mathematics for Computer Science course notes.
So every bijection argument has two jobs. Pick an easy set, then prove the pairing is perfect.
How do you check that a pairing really is a bijection?
Ask three questions of your rule:
Does every object in the hard set produce a valid object in the easy set?
Can two different objects ever produce the same one? If yes, you are overcounting.
Can you go backwards, rebuilding exactly one hard object from any easy object? If not, you are missing some.
The third question is the easiest to skip. If you can write a reverse rule that undoes the forward rule, and the forward rule undoes it, the pairing is a bijection.
Why does a set with n elements have 2ⁿ subsets?
Take a set X = {x₁, x₂, ..., xₙ}. For any subset, write a string of n bits: a 1 in position i if xᵢ is in the subset, a 0 if it is not. The MIT notes use this exact pairing: in a 10-element set, the subset {x₂, x₃, x₅, x₇, x₁₀} becomes 0110101001. Reading a string back gives exactly one subset, so the reverse rule exists. Each of the n positions is independently 0 or 1, so there are 2ⁿ strings, and therefore 2ⁿ subsets.
The pairing does more. Subsets with exactly r elements match strings with exactly r ones, which is why ⁿCᵣ counts both.
How many shortest paths cross a grid?
Walk from (0, 0) to (5, 3) moving one unit right (R) or one unit up (U) at a time. Every shortest path takes 8 steps, 5 of them R and 3 of them U. Write the steps in order and the path becomes a word: the path in the picture above is RRURRURU. Going back, any word with five Rs and three Us traces exactly one path. So count words instead: choose which 3 of the 8 positions hold a U, giving ⁸C₃ = 56 paths.
In general, the number of lattice paths from (0, 0) to (n, k) equals the binomial coefficient ⁽ⁿ⁺ᵏ⁾Cₙ, as stated in the lattice path entry on Wikipedia. Counting lattice paths in two ways also gives a proof of identities such as the sum of squares of binomial coefficients equalling ²ⁿCₙ.
Why does choosing with repetition match stars and bars?
The MIT notes count the ways to select a dozen doughnuts when five varieties are available (Chapter 11). Write each doughnut as a 0 and put a 1 in each of the four gaps between varieties. Every selection becomes a 16-bit string with exactly four 1s, and every such string decodes into exactly one selection. So the count is ¹⁶C₄ = 1820.
Try it with sweets. You want 6 sweets from 3 kinds: kaju katli, laddoo and barfi. Draw 6 stars and 2 bars. The line ★★|★★★|★ means 2 katli, 3 laddoos and 1 barfi. Any arrangement of 6 stars and 2 bars is one order, and every order is one arrangement, so the answer is ⁸C₂ = 28.
The stars and bars article on Wikipedia) states the general result: the number of k-tuples of non-negative integers whose sum is n is ⁽ⁿ⁺ᵏ⁻¹⁾Cₖ₋₁. The same formula counts the non-negative solutions of x + y + z = 10, worked through in our post on non-negative integer solutions with stars and bars.
A four-step plan for your next counting problem
Work out two or three tiny cases by hand, so you have numbers to check against.
Name an easy target set: binary strings, words in two letters, or stars and bars.
Write the forward rule and the reverse rule, and run the three questions above.
Count the target, then test your formula on a tiny case. For 2 sweets from 2 kinds, ³C₁ = 3, and the list {AA, AB, BB} agrees.
If a count comes out too big, step 3 shows where two objects share a partner. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer, so you can see the matching written out. If ⁿCᵣ itself still feels shaky, the Fermi Concept Library gives each concept in mathematics its own lesson.
For where these ideas sit in exam preparation, read our guide to preparing permutations and combinations for JEE Advanced.



