General Aptitude

Permutations and combinations

Part 1 of 3 · 16 min

The counting principle

The concept

Start with something familiar

You are getting ready in the morning. You have 4 shirts and 3 pairs of trousers. How many different outfits can you make?
Pick any shirt, and you can wear it with any of the 3 trousers. That is 3 outfits per shirt, and there are 4 shirts, so 4×3=124 \times 3 = 12 outfits. You did not list them. You counted the choices at each step and multiplied.
Every permutation and combination question is built on that one move, plus its partner, adding. This part teaches both and the habits that stop you from miscounting.

Idea 1: steps one after another multiply

When a task happens in steps, and each choice at step 1 can be followed by every choice at step 2, the counts multiply. Here are the outfits for 2 of the shirts, with the trousers labelled T1, T2 and T3:
T1T2T3
Shirt AA + T1A + T2A + T3
Shirt BB + T1B + T2B + T3
Each row has 3 outfits, and there is one row per shirt. With 4 shirts the table has 4×3=124 \times 3 = 12 cells.
Key idea
If step 1 can be done in mm ways and then step 2 in nn ways, the whole task can be done in m×nm \times n ways.
Example
A canteen thali has one of 3 rice dishes, one of 4 curries and one of 2 sweets. How many different thalis are there?
Three steps: 3×4×2=243 \times 4 \times 2 = 24 thalis.
Picture it
R1R1 S1R1 S2R2R2 S1R2 S2R3R3 S1R3 S2

Every rice dish branches into every sweet: 3 × 2 = 6 ends. Add the 4 curries as a third level and each end splits 4 ways: 3 × 4 × 2 = 24.

Idea 2: separate cases add

Now suppose you travel from Delhi to Jaipur by either one of 3 buses or one of 2 trains. You take only one vehicle. The choices don't combine, they are alternatives, so there are 3+2=53 + 2 = 5 ways.
The task is done...Use
in steps, "and then"×\times
one way or another++
Example
A meal has a main course (5 choices) and then either a starter (4 choices) or a dessert (3 choices), not both. How many meals are there?
The second step has 4+3=74 + 3 = 7 choices, so there are 5×7=355 \times 7 = 35 meals.

Idea 3: fill the most restricted position first

Many questions ask you to build numbers or codes. Treat each position as a step and count its choices, but start with the position that has a rule.
How many 3-digit numbers have all digits different? The hundreds digit can't be 0, so it is the restricted one. Fill it first:
PositionHundredsTensUnits
Choices9 (1 to 9)98
The tens digit can be any of 10 digits except the one already used, so 9, which now includes 0. The units digit has 8 left. Total 9×9×8=6489 \times 9 \times 8 = 648.
Example
How many 3-digit odd numbers have all digits different?
Units is restricted (1, 3, 5, 7, 9): 5 choices. Hundreds: not 0 and not the units digit, so 8. Tens: 8 left. Total 5×8×8=3205 \times 8 \times 8 = 320.

Idea 4: when one choice changes another, split into cases

Sometimes the most restricted positions get in each other's way. For 3-digit even numbers with all digits different, the units digit must be even (0, 2, 4, 6, 8) and the hundreds digit must not be 0. Whether 0 has been used in the units place changes how many choices the hundreds digit has. So split on it, count each case with Idea 1, and add the cases with Idea 2.
CaseHundredsTensCount
Units 0987272
Units 2, 4, 6, 8884×64=2564 \times 64 = 256
The first row is 9×8=729 \times 8 = 72. The second row has 4 choices for the units digit, each with 8×8=648 \times 8 = 64 numbers. Total: 72+256=32872 + 256 = 328.
Example
Why 8 for the hundreds in the second case?
The units digit is, say, 4. The hundreds digit can't be 0 and can't be 4, so it has 10−2=810 - 2 = 8 choices. The tens digit then has 8 left (any digit except the two used).

Idea 5: "at least one" is the total minus "none"

Counting "at least one" directly means adding many cases: exactly one, exactly two, and so on. The opposite, "none at all", is usually a single easy count.at least one=total−none\text{at least one} = \text{total} - \text{none}
Example
How many 4-digit PINs (digits 0 to 9, repeats allowed) contain at least one 0?
All PINs: 104=1000010^4 = 10000. PINs with no 0: 94=65619^4 = 6561. At least one 0: 10000−6561=343910000 - 6561 = 3439.

Idea 6: "to be sure" means count the worst luck

"How many must you pick to be sure?" Picture the unluckiest picks, which dodge the goal as long as possible, then add one.
A box holds 5 red, 7 blue, 8 black and 4 green pens, picked in the dark. For two of the same colour, the worst luck gives one of each colour, 4 pens with no pair. The 5th must match: 5 picks.
Key idea
To be sure: the most picks that can still miss the goal, plus 1. With nn boxes, n+1n + 1 items put two in one box (the pigeonhole principle).
Example
Same box. How many picks to be sure of two green pens?
The worst luck takes all 20 other pens and one green, 21 picks with no green pair. So 22.

How to spot which idea you need

The question says...Use
choose one from each groupIdea 1: multiply
"either ... or", one of several routesIdea 2: add
digits, codes, a position with a ruleIdea 3: restricted first
0 allowed and even, or similar clashesIdea 4: split into cases
"at least one"Idea 5: total minus none
"how many to be sure", "guarantee"Idea 6: worst luck plus 1

Worked example 1warm-up

There are 3 roads from town A to town B and 4 roads from B to C. In how many ways can a person go from A to C and come back to A without using any road twice?
Solution
Step 1. GoingIdea 1
A to B then B to C: 3×4=123 \times 4 = 12 ways.
Step 2. Coming backIdea 3: count what is left at each step
One B to C road is used, so 3 remain. One A to B road is used, so 2 remain. That gives 3×2=63 \times 2 = 6 ways.
Step 3. Whole tripIdea 1
Going and then coming back: 12×6=7212 \times 6 = 72 ways.
Check
Without the rule there would be 12×12=14412 \times 12 = 144 trips, and the rule must cut that down, so 72 is sensible.

Worked example 2GATE level

How many 4-digit numbers with all digits different are divisible by 5?
Solution
Step 1. Find the restricted positionsIdea 3
The units digit must be 0 or 5. The thousands digit must not be 0.
Step 2. Split on the units digitIdea 4
Whether 0 is used up changes the thousands count.
Step 3. Units =0= 0Idea 1
Thousands: 9 choices (1 to 9). Hundreds: 8. Tens: 7. That gives 9×8×7=5049 \times 8 \times 7 = 504.
Step 4. Units =5= 5Idea 1
Thousands: not 0 and not 5, so 8. Hundreds: 8 left. Tens: 7. That gives 8×8×7=4488 \times 8 \times 7 = 448.
Step 5. Add the casesIdea 2
504+448=952504 + 448 = 952.
Check
There are 4536 four-digit numbers with distinct digits (9×9×8×79 \times 9 \times 8 \times 7), and roughly a fifth of them should end in 0 or 5: 45365≈907\dfrac{4536}{5} \approx 907. The answer 952 is close, and a bit higher because 0 is more available in the units place.

All the equations at a glance

IdeaRule
Steps in sequencem×nm \times n
Separate casesm+nm + n
Positions with rulesfill the restricted one first
Choices that clashsplit into cases, then add
At least onetotal −- none