HOME/NOTES/CONCEPT

Permutations and Combinations for JEE: Arrangements, Selections, Circular Seating and Derangements

Ritesh Raj · 22 Nov 2026
Aa
59 min read72 sectionsConcept

Permutations and combinations is the chapter of counting without listing. Every question asks the same thing, "in how many ways", and every answer is built from two rules: multiply when the work is done in stages one after another, add when the work splits into separate cases. Arrangements, selections, circular seatings, distributions and derangements are these two rules applied with care about what is distinct, what is identical and what is being ordered.

This note covers the fundamental principles, factorials and the exponent of a prime in n!n!, permutations of distinct objects with and without repetition, permutations with identical objects, the together and gap methods, the rank of a word, circular permutations and necklaces, combinations and the properties of nCr{}^nC_r, selections from identical objects and the number of divisors, integer solutions of equations, division into groups and distribution of distinct and identical objects, inclusion and exclusion, derangements, geometrical counting and the sum of numbers formed with given digits. Each section ends with worked examples from JEE Main, JEE Advanced and IIT JEE papers, graded from easy to hard. Circular seatings, derangements and groupings each get a full run of examples. Counting functions (one-one and onto maps) is done in the Functions note, and sums of binomial coefficients in the Binomial Theorem note.

Fundamental principles of counting

Multiplication principle

If a work is done in two stages, the first in mm ways and, for each of these, the second in nn ways, then the whole work is done in

m×n waysm\times n\ \text{ways}

The rule extends to any number of stages. The word to look for is and: first stage and second stage and so on.

A tree diagram with three branches A1, A2, A3 at stage 1, each splitting into two branches B1, B2 at stage 2, giving six end points

Addition principle

If a work can be done in either of two separate ways, the first in mm ways and the second in nn ways, with no way common to both, then it can be done in

m+n waysm+n\ \text{ways}

The word to look for is or: case I or case II. The cases must not overlap.

Counting with repetition allowed

Filling rr places when each place can take any of nn objects gives nrn^r ways. A number of rr digits from a set containing 00 needs one extra check: the first digit cannot be 00.

SituationCount
rr places, nn choices each, repetition allowednrn^r
rr letters into nn letter boxesnrn^r
rr-digit numbers from {0,1,…,9}\{0,1,\dots,9\}9×10r−19\times10^{r-1}
rr persons leaving a lift at nn floorsnrn^r
Who chooses whom

55 letters into 33 boxes is 353^5, not 535^3: each letter chooses a box. Always ask which objects make the choice. The objects that choose are the exponent; the places they choose from are the base.

Examples

Example 1 (JEE Main 2026, 28 Jan Shift 2). Three persons enter a lift at the ground floor. The lift goes up to the 10th10^{\text{th}} floor. The number of ways in which the three persons can exit the lift at three different floors, if the lift does not stop at the first, second and third floors, is equal to ______.

▸ SHOW SOLUTION

Step 1. Floors available

The lift can stop at floors 4,5,…,104,5,\dots,10, that is 77 floors.

Step 2. Persons choose distinct floors

The first person has 77 choices, the second 66, the third 55:

7×6×5=2107\times6\times5=210

Answer: 210210

Example 2 (JEE Main 2026, 21 Jan Shift 1). Let S={(m,n):m,n∈{1,2,3,…,50}}S=\{(m,n):m,n\in\{1,2,3,\dots,50\}\}. If the number of elements (m,n)(m,n) in SS such that 6m+9n6^m+9^n is a multiple of 55 is pp, and the number of (m,n)(m,n) such that m+nm+n is a square of a prime is qq, then p+qp+q is equal to ______.

▸ SHOW SOLUTION

Step 1. Remainders on division by 55

6≡16\equiv1 and 9≡−1(mod5)9\equiv-1\pmod 5, so

6m+9n≡1+(−1)n(mod5)6^m+9^n\equiv1+(-1)^n\pmod 5

This is 00 exactly when nn is odd, and mm is free.

Step 2. The count pp

nn odd gives 2525 values, mm gives 5050:

p=50×25=1250p=50\times25=1250

Step 3. The count qq

2≤m+n≤1002\le m+n\le100, and the prime squares in this range are 4,9,25,494,9,25,49. For a sum s≤51s\le51 there are s−1s-1 pairs:

q=3+8+24+48=83q=3+8+24+48=83

Answer: 1250+83=13331250+83=1333

Example 3 (JEE Main 2026, 24 Jan Shift 1). The number of numbers greater than 50005000, less than 90009000, and divisible by 33, that can be formed using the digits 0,1,2,5,90,1,2,5,9, if repetition of the digits is allowed, is ______.

▸ SHOW SOLUTION

Step 1. The first digit

A number between 50005000 and 90009000 has first digit 5,6,75,6,7 or 88. Only 55 is available, so the number is 5abc5abc. (50005000 itself is not divisible by 33.)

Step 2. Digits by remainder on division by 33

RemainderDigitsCount
000,90,922
111111
222,52,522

Step 3. The condition

5≡25\equiv2, so we need a+b+c≡1(mod3)a+b+c\equiv1\pmod3. The remainder patterns of (a,b,c)(a,b,c), each in 33 orders, are:

PatternWays for one orderAll orders
0,0,10,0,12⋅2⋅1=42\cdot2\cdot1=41212
0,2,20,2,22⋅2⋅2=82\cdot2\cdot2=82424
1,1,21,1,21⋅1⋅2=21\cdot1\cdot2=266

Answer: 12+24+6=4212+24+6=42

Example 4 (JEE Main 2025, 28 Jan Shift 1). The number of different 55-digit numbers greater than 5000050000 that can be formed using the digits 0,1,2,3,4,5,6,70,1,2,3,4,5,6,7, such that the sum of their first and last digits should not be more than 88, is

Tap an option to check your answer
(1)46084608
(2)57205720
(3)57195719
(4)46074607
▸ SHOW SOLUTION

Step 1. First and last digits

The first digit is 55, 66 or 77, and first ++ last ≤8\le 8:

First digitLast digitPairs
550,1,2,30,1,2,344
660,1,20,1,233
770,10,122

Step 2. The middle three digits

Each of them is free, 88 choices:

9×83=46089\times8^3=4608

Step 3. Remove 5000050000

5000050000 is counted (first 55, rest 00) but it is not greater than 5000050000:

4608−1=46074608-1=4607

Answer: option (4)

Factorials and the exponent of a prime

Factorial

For a natural number nn,

n!=1⋅2⋅3⋯n,0!=1n!=1\cdot2\cdot3\cdots n,\qquad 0!=1

and n!=n (n−1)!n!=n\,(n-1)!. The value 0!=10!=1 keeps this rule true at n=1n=1. Splitting (2n)!(2n)! into its even and odd factors gives

(2n)!=2n n! (1⋅3⋅5⋯(2n−1))(2n)!=2^n\,n!\,\bigl(1\cdot3\cdot5\cdots(2n-1)\bigr)
nn1122334455667788
n!n!1122662424120120720720504050404032040320

Exponent of a prime in n!n!

For a prime pp, the highest power of pp that divides n!n! is

Ep(n!)=[np]+[np2]+[np3]+⋯E_p(n!)=\left[\frac np\right]+\left[\frac n{p^2}\right]+\left[\frac n{p^3}\right]+\cdots

where [ ][\ ] is the greatest integer function. Reason: [np]\left[\frac np\right] of the numbers 1,…,n1,\dots,n are multiples of pp, each gives one factor pp; [np2]\left[\frac n{p^2}\right] of them are multiples of p2p^2 and give one more, and so on.

The number of zeros at the end of n!n! is E5(n!)E_5(n!), because 22 appears more often than 55. For example E5(100!)=20+4=24E_5(100!)=20+4=24.

For a composite base, check every prime

For 40n=23n⋅5n40^n=2^{3n}\cdot5^n dividing m!m! you need 3n≤E23n\le E_2 and n≤E5n\le E_5. The answer is the smaller of [E23]\left[\frac{E_2}{3}\right] and E5E_5. Taking only the largest prime of the base can give the wrong answer when a smaller prime has a high power in the base.

Examples

Example 5 (JEE Main 2026, 21 Jan Shift 2). The largest n∈Nn\in\mathbb N for which 7n7^n divides 101!101! is

Tap an option to check your answer
(1)1616
(2)1818
(3)1515
(4)1919
▸ SHOW SOLUTION

Step 1. The exponent of 77

73=343>1017^3=343>101, so only two terms are needed:

[1017]+[10149]=14+2=16\left[\frac{101}{7}\right]+\left[\frac{101}{49}\right]=14+2=16

Answer: option (1)

Example 6 (JEE Main 2026, 24 Jan Shift 2). The largest value of nn, for which 40n40^n divides 60!60!, is

Tap an option to check your answer
(1)1313
(2)1111
(3)1212
(4)1414
▸ SHOW SOLUTION

Step 1. Prime factors of the base

40n=23n⋅5n40^n=2^{3n}\cdot5^n

Step 2. Exponents in 60!60!

E2=30+15+7+3+1=56E_2=30+15+7+3+1=56E5=12+2=14E_5=12+2=14

Step 3. Both conditions

3n≤563n\le56 gives n≤18n\le18, and n≤14n\le14. So n=14n=14.

Answer: option (4)

Permutations of distinct objects

Arrangements without repetition

A permutation is an arrangement in a definite order. The number of arrangements of rr objects chosen from nn distinct objects is

nPr=n(n−1)⋯(n−r+1){}^nP_r=n(n-1)\cdots(n-r+1) nPr=n!(n−r)!{}^nP_r=\frac{n!}{(n-r)!}

Reason: the first place has nn choices, the second n−1n-1, and the rr-th place n−r+1n-r+1. All nn objects in a row give nPn=n!{}^nP_n=n!.

Arrangements with repetition and with restrictions

SituationCount
rr of nn distinct objects in a rownPr{}^nP_r
all nn in a rown!n!
rr places, repetition allowednrn^r
kk particular objects always includedn−kCr−k⋅r!{}^{n-k}C_{r-k}\cdot r!
kk particular objects never includedn−kPr{}^{n-k}P_r
a particular object in a fixed placen−1Pr−1{}^{n-1}P_{r-1}

For numbers formed from digits, fill the restricted places first: the first digit (not 00), the last digit (for even numbers or multiples of 55), then the rest.

Restricted places first

For a 44-digit even number from 0,1,2,3,4,50,1,2,3,4,5 without repetition, split by the last digit. Last digit 00: 5⋅4⋅3=605\cdot4\cdot3=60. Last digit 22 or 44: first digit has 44 choices (not 00, not the last), then 4⋅34\cdot3, giving 2⋅4⋅4⋅3=962\cdot4\cdot4\cdot3=96. Total 156156. Filling the first place first runs into a case split anyway; starting from the most restricted place keeps it short.

Examples

Example 7 (JEE Main 2026, 6 Apr Shift 1). The number of 44-letter words, with or without meaning, each consisting of two vowels and two consonants that can be formed from the letters of the word INCONSEQUENTIAL, without repeating any letter, is

Tap an option to check your answer
(1)26702670
(2)28402840
(3)29202920
(4)36003600
▸ SHOW SOLUTION

Step 1. Distinct letters

Vowels I,O,E,U,AI,O,E,U,A: 55 distinct. Consonants N,C,S,Q,T,LN,C,S,Q,T,L: 66 distinct. "Without repeating any letter" means each chosen letter is used once.

Step 2. Choose and arrange

5C2⋅6C2⋅4!=10⋅15⋅24=3600{}^5C_2\cdot{}^6C_2\cdot4!=10\cdot15\cdot24=3600

Answer: option (4)

Example 8 (JEE Advanced 2017, Paper 1). Words of length 1010 are formed using the letters A,B,C,D,E,F,G,H,I,JA,B,C,D,E,F,G,H,I,J. Let xx be the number of such words where no letter is repeated, and let yy be the number of such words where exactly one letter is repeated twice and no other letter is repeated. Then y9x\frac{y}{9x} is ______.

▸ SHOW SOLUTION

Step 1. The count xx

All 1010 letters once each:

x=10!x=10!

Step 2. The count yy

Choose the doubled letter (1010 ways) and 88 more letters from the other 99 (9C8=9{}^9C_8=9 ways). The 1010 letters with one pair are arranged in 10!2!\frac{10!}{2!} ways:

y=10⋅9⋅10!2=45⋅10!y=10\cdot9\cdot\frac{10!}{2}=45\cdot10!

Step 3. The ratio

y9x=45⋅10!9⋅10!=5\frac{y}{9x}=\frac{45\cdot10!}{9\cdot10!}=5

Answer: 55

Example 9 (JEE Advanced 2022, Paper 1). The number of 44-digit integers in the closed interval [2022,4482][2022,4482] formed by using the digits 0,2,3,4,6,70,2,3,4,6,7 is ______.

▸ SHOW SOLUTION

Step 1. Repetition is allowed

The digits may repeat. Count by the first digit, which must be 22, 33 or 44.

Step 2. First digit 33

All 63=2166^3=216 numbers 3abc3abc lie in the interval.

Step 3. First digit 22

There are 63=2166^3=216 numbers 2abc2abc. Those below 20222022 are 20002000, 20022002, 20032003, 20042004, 20062006, 20072007, 20202020: 77 numbers. So 216−7=209216-7=209.

Step 4. First digit 44

We need 4abc≤44824abc\le4482. Second digit 0,2,30,2,3: 3⋅36=1083\cdot36=108. Second digit 44: every third digit available is at most 77, so 44bc≤447744bc\le4477 and all 6⋅6=366\cdot6=36 qualify. Second digit 66 or 77 is too large.

108+36=144108+36=144

Step 5. Total

209+216+144=569209+216+144=569

Answer: 569569

Permutations with identical objects

Arrangements of all the objects

If among nn objects pp are alike of one kind, qq alike of a second kind and rr alike of a third kind, the rest distinct, the number of arrangements of all nn is

n!p! q! r!\frac{n!}{p!\,q!\,r!}

Reason: if the alike objects were made different, each arrangement would split into p! q! r!p!\,q!\,r! arrangements.

WordRepeatsArrangements
BANANAA×3A\times3, N×2N\times26!3! 2!=60\frac{6!}{3!\,2!}=60
MISSISSIPPII×4I\times4, S×4S\times4, P×2P\times211!4! 4! 2!=34650\frac{11!}{4!\,4!\,2!}=34650
ASSASSINATIONS×4S\times4, A×3A\times3, I×2I\times2, N×2N\times213!4! 3! 2! 2!\frac{13!}{4!\,3!\,2!\,2!}

Selecting and arranging some of the letters

When only rr of the letters are used, split into cases by the pattern of repeats. For 44-letter words the patterns are:

PatternMeaningCount
44 differentchoose 44 kindskC4⋅4!{}^kC_4\cdot4!
22 alike, 22 differentone pair kind, two single kinds×4!2!\times\frac{4!}{2!}
22 alike, 22 aliketwo pair kinds×4!2! 2!\times\frac{4!}{2!\,2!}
33 alike, 11 differentone triple kind, one single kind×4!3!\times\frac{4!}{3!}
44 alikeone kind with 44 copies11 each
Choose kinds, not letters

In the pattern "22 alike, 22 different" the two different letters must be chosen from the kinds other than the paired kind. Choosing them from all kinds counts words like PPPQPPPQ in the wrong case. Count the available kinds for each part of the pattern separately.

Examples

Example 10 (JEE Main 2026, 23 Jan Shift 1). The number of 44-letter words, with or without meaning, which can be formed using the letters of PQRPQRSTUVP, is ______.

▸ SHOW SOLUTION

Step 1. The kinds

P×3P\times3, Q×2Q\times2, R×2R\times2 and S,T,U,VS,T,U,V once each. There are 77 kinds; P,Q,RP,Q,R can give a pair, only PP can give a triple.

Step 2. The cases

PatternCount
33 alike, 11 different1⋅6C1⋅4!3!=241\cdot{}^6C_1\cdot\frac{4!}{3!}=24
22 alike, 22 alike3C2⋅4!2! 2!=18{}^3C_2\cdot\frac{4!}{2!\,2!}=18
22 alike, 22 different3C1⋅6C2⋅4!2!=540{}^3C_1\cdot{}^6C_2\cdot\frac{4!}{2!}=540
44 different7C4⋅4!=840{}^7C_4\cdot4!=840

Answer: 24+18+540+840=142224+18+540+840=1422

Example 11 (JEE Main 2026, 28 Jan Shift 1). Let S={1,2,3,4,5,6,7,8,9}S=\{1,2,3,4,5,6,7,8,9\}. Let xx be the number of 99-digit numbers formed using the digits of SS such that only one digit is repeated and it is repeated exactly twice. Let yy be the number of 99-digit numbers formed using the digits of SS such that only two digits are repeated and each is repeated exactly twice. Then

Tap an option to check your answer
(1)29x=5y29x=5y
(2)45x=7y45x=7y
(3)21x=4y21x=4y
(4)56x=9y56x=9y
▸ SHOW SOLUTION

Step 1. The count xx

One digit twice and 77 other digits once: choose the doubled digit (99) and 77 of the remaining 88:

x=9⋅8⋅9!2!=36⋅9!x=9\cdot8\cdot\frac{9!}{2!}=36\cdot9!

Step 2. The count yy

Two digits twice and 55 digits once: 9C2=36{}^9C_2=36 for the pairs, 7C5=21{}^7C_5=21 for the singles:

y=36⋅21⋅9!2! 2!=189⋅9!y=36\cdot21\cdot\frac{9!}{2!\,2!}=189\cdot9!

Step 3. The ratio

xy=36189=421⇒21x=4y\frac xy=\frac{36}{189}=\frac{4}{21}\Rightarrow21x=4y

Answer: option (3)

Example 12 (JEE Main 2023, 1 Feb Shift 2). The number of words, with or without meaning, that can be formed using all the letters of the word ASSASSINATION so that the vowels occur together, is ______.

▸ SHOW SOLUTION

Step 1. Vowels and consonants

Vowels: A,A,A,I,I,OA,A,A,I,I,O (66). Consonants: S,S,S,S,N,N,TS,S,S,S,N,N,T (77).

Step 2. The vowel block with the consonants

The block and 77 consonants are 88 units, with S×4S\times4 and N×2N\times2:

8!4! 2!=840\frac{8!}{4!\,2!}=840

Step 3. Inside the block

6!3! 2!=60\frac{6!}{3!\,2!}=60

Answer: 840×60=50400840\times60=50400

Example 13 (JEE Main 2025, 29 Jan Shift 1). The number of 66-letter words, with or without meaning, that can be formed using the letters of the word MATHS such that any letter that appears in the word must appear at least twice, is ______.

▸ SHOW SOLUTION

Step 1. Patterns of 66 with parts at least 22

66, 4+24+2, 3+33+3, 2+2+22+2+2.

Step 2. Count each pattern

PatternKindsArrangementsCount
665C1=5{}^5C_1=51155
4+24+25C1⋅4C1=20{}^5C_1\cdot{}^4C_1=206!4! 2!=15\frac{6!}{4!\,2!}=15300300
3+33+35C2=10{}^5C_2=106!3! 3!=20\frac{6!}{3!\,3!}=20200200
2+2+22+2+25C3=10{}^5C_3=106!2! 2! 2!=90\frac{6!}{2!\,2!\,2!}=90900900

In 4+24+2 the two letters have different roles, so the order of choosing matters; in 3+33+3 and 2+2+22+2+2 it does not.

Answer: 5+300+200+900=14055+300+200+900=1405

Objects together and the gap method

Objects always together

To keep kk particular objects together, tie them into one block. Arrange the block with the other objects, then arrange the objects inside the block:

(n−k+1)!×k!(n-k+1)!\times k!

"Not all together" is the complement: n!−(n−k+1)! k!n!-(n-k+1)!\,k!.

No two together: the gap method

To keep kk particular objects apart (no two side by side), first arrange the other n−kn-k objects. They leave n−k+1n-k+1 gaps, counting the two ends. Put the kk objects into kk different gaps:

(n−k)!×n−k+1Pk(n-k)!\times{}^{n-k+1}P_k Five objects B1 to B5 in a row with dotted lines marking the six gaps, two at the ends and four between, and a cross under each gap
ConditionCount for mm boys and gg girls in a row
all girls together(m+1)! g!(m+1)!\,g!
girls not all together(m+g)!−(m+1)! g!(m+g)!-(m+1)!\,g!
no two girls together (g≤m+1g\le m+1)m!⋅m+1Pgm!\cdot{}^{m+1}P_g
boys and girls alternate, m=gm=g2⋅m! g!2\cdot m!\,g!
boys and girls alternate, m=g+1m=g+1m! g!m!\,g!
Not all together is not no two together

"The girls are not all together" allows two girls side by side; only the arrangement with all of them in one block is removed. "No two girls together" is far stronger and needs the gap method. For 44 boys and 33 girls the two counts are 43204320 and 14401440.

Examples

Example 14 (JEE Main 2026, 4 Apr Shift 1). The number of ways of forming a queue of 44 boys and 33 girls such that all the girls are not together, is

Tap an option to check your answer
(1)50405040
(2)30503050
(3)34103410
(4)43204320
▸ SHOW SOLUTION

Step 1. All arrangements

7!=50407!=5040

Step 2. All three girls together

One block of girls with 44 boys is 55 units:

5!×3!=7205!\times3!=720

Answer: option (4)

Example 15 (JEE Main 2025, 22 Jan Shift 2). In a group of 33 girls and 44 boys, there are two boys B1B_1 and B2B_2. The number of ways, in which these girls and boys can stand in a queue such that all the girls stand together, all the boys stand together, but B1B_1 and B2B_2 are not adjacent to each other, is

Tap an option to check your answer
(1)144144
(2)7272
(3)9696
(4)120120
▸ SHOW SOLUTION

Step 1. The two blocks

The girls' block and the boys' block can be placed in 2!2! orders, and the girls arranged in 3!3! ways.

Step 2. Inside the boys' block

4!4! orders, of which 3!⋅2!=123!\cdot2!=12 have B1,B2B_1,B_2 adjacent:

24−12=1224-12=12

Step 3. Total

2×6×12=1442\times6\times12=144

Answer: option (1)

Example 16 (JEE Main 2025, 23 Jan Shift 2). The number of ways, 55 boys and 44 girls can sit in a row so that either all the boys sit together or no two boys sit together, is ______.

▸ SHOW SOLUTION

Step 1. All boys together

Block of boys with 44 girls is 55 units:

5!×5!=144005!\times5!=14400

Step 2. No two boys together

Arrange the girls (4!4!); they leave 55 gaps for 55 boys (5!5!):

4!×5!=28804!\times5!=2880

Step 3. The cases do not overlap

Answer: 14400+2880=1728014400+2880=17280

Example 17 (JEE Advanced 2015, Paper 1). Let nn be the number of ways in which 55 boys and 55 girls can stand in a queue in such a way that all the girls stand consecutively in the queue. Let mm be the number of ways in which 55 boys and 55 girls can stand in a queue in such a way that exactly four girls stand consecutively in the queue. Then the value of mn\frac mn is ______.

▸ SHOW SOLUTION

Step 1. The count nn

n=6!×5!n=6!\times5!

Step 2. The count mm

Choose the 44 girls of the block and order them: 5C4⋅4!=5!{}^5C_4\cdot4!=5!. Arrange the 55 boys: 5!5!. The block and the fifth girl go into 22 different gaps of the 66 gaps (if they shared a gap, all five girls would be together):

m=5!×5!×6P2=5!×5!×30m=5!\times5!\times{}^6P_2=5!\times5!\times30

Step 3. The ratio

mn=30⋅5!6!=306=5\frac mn=\frac{30\cdot5!}{6!}=\frac{30}{6}=5

Answer: 55

Example 18 (IITianForum). Six different consonants and three different vowels are arranged in a row of nine letters. In how many arrangements are there at least two consonants between any two vowels?

▸ SHOW SOLUTION

Step 1. Consonants first

Arrange the 66 consonants: 6!6! ways. They leave 77 gaps, numbered 0,1,…,60,1,\dots,6.

Step 2. Choose the gaps

At least two consonants between two vowels means the chosen gap numbers differ by at least 22. Choosing 33 of 77 gaps with no two consecutive gives

7−3+1C3=5C3=10{}^{7-3+1}C_3={}^5C_3=10

(Reason: if the gaps are g1<g2<g3g_1<g_2<g_3, then g1<g2−1<g3−2g_1<g_2-1<g_3-2 are any 33 distinct numbers from 00 to 44.)

Step 3. Order the vowels

6!×10×3!=432006!\times10\times3!=43200

Answer: 4320043200

Rank of a word in the dictionary

Method

Write the letters in alphabetical order. Go through the word one position at a time. At each position, count the words that agree with the given word so far but have a smaller letter in this position: (number of smaller unused letters) ×\times (arrangements of the rest). Add all these counts; the rank is that total plus 11.

With repeated letters, the arrangements of the rest are m!p! q!⋯\frac{m!}{p!\,q!\cdots}, and each kind of smaller letter is counted once.

Finding the word at a given position

For the reverse question (which word is at position NN), fill one place at a time. Each starting letter covers a block of (n−1)!(n-1)! words; keep adding blocks until the next one would pass NN, then go to the next place.

Examples

Example 19 (JEE Main 2026, 24 Jan Shift 2). The letters of the word UDAYPUR are written in all possible ways with or without meaning and these words are arranged as in a dictionary. The rank of the word UDAYPUR is

Tap an option to check your answer
(1)15801580
(2)15781578
(3)15791579
(4)15811581
▸ SHOW SOLUTION

Step 1. Alphabetical order

A,D,P,R,U,U,YA,D,P,R,U,U,Y.

Step 2. Position by position

Fixed partSmaller lettersWords
noneA,D,P,RA,D,P,R4⋅6!2!=14404\cdot\frac{6!}{2!}=1440
UUAA1⋅5!=1201\cdot5!=120
UDUDnone00
UDAUDAP,R,UP,R,U3⋅3!=183\cdot3!=18
UDAYUDAYnone00
UDAYPUDAYPRR1⋅1!=11\cdot1!=1

Step 3. The rank

1440+120+18+1+1=15801440+120+18+1+1=1580

Answer: option (1)

Example 20 (JEE Main 2025, 29 Jan Shift 2). If all the words with or without meaning made using all the letters of the word KANPUR are arranged as in a dictionary, then the word at 440th440^{\text{th}} position in this arrangement, is

Tap an option to check your answer
(1)PRNAKU
(2)PRKANU
(3)PRKAUN
(4)PRNAUK
▸ SHOW SOLUTION

Step 1. First letter

Order A,K,N,P,R,UA,K,N,P,R,U. Words starting with AA, KK, NN take 3⋅120=3603\cdot120=360 places, so the word starts with PP.

Step 2. Second letter

PAPA, PKPK, PNPN take 3⋅24=723\cdot24=72 more, up to 432432. The word starts PRPR.

Step 3. Third letter

PRAPRA takes 66 places (433433 to 438438). PRKPRK starts at 439439: PRKANUPRKANU is 439th439^{\text{th}} and PRKAUNPRKAUN is 440th440^{\text{th}}.

Answer: option (3)

Circular permutations

Round table

In a circular arrangement only the relative order matters: turning everyone one seat round gives the same arrangement. Fix one person; the other n−1n-1 fill the remaining seats in a row:

round table: (n−1)!\text{round table}:\ (n-1)! Six persons round a table with A shaded as the fixed person, and two four-bead necklaces abcd and adcb that are mirror images joined by a two-way arrow marked flip

Necklace and garland

A necklace or garland can be turned over, so an arrangement and its mirror image are the same. For n≥3n\ge3 distinct beads each arrangement is counted twice in (n−1)!(n-1)!:

necklace: (n−1)!2\text{necklace}:\ \frac{(n-1)!}{2}

For n=1n=1 or 22 the mirror image is the same arrangement, so the count is 11.

Results table

SituationCount
nn distinct persons, round table(n−1)!(n-1)!
nn distinct beads, necklace (n≥3n\ge3)(n−1)!2\frac{(n-1)!}{2}
rr of nn persons, round tablenPrr\frac{{}^nP_r}{r}
rr of nn beads, necklace (r≥3r\ge3)nPr2r\frac{{}^nP_r}{2r}
two particular persons together2 (n−2)!2\,(n-2)!
two particular persons never together(n−1)!−2 (n−2)!(n-1)!-2\,(n-2)!
nn men, nn women alternately(n−1)! n!(n-1)!\,n!
mm men, ww women, no two women together (w≤mw\le m)(m−1)!⋅mPw(m-1)!\cdot{}^mP_w
nn couples, each pair together(n−1)! 2n(n-1)!\,2^n
seats numbered (or chairs distinct)n!n!
When the circle is not symmetric

Divide by nn only when turning the circle gives the same arrangement. If the seats are numbered, or one seat is special (a head of the table, a window), every rotation is a new arrangement and the count is n!n!. Divide by 22 only for objects that can be turned over (necklace, garland, beads on a ring), never for persons at a table.

Identical beads on a ring

If some beads are alike, (n−1)!(n-1)! divided by the repeats is wrong in general. When one bead is unique, fix it at the top. The others form a row read clockwise from it. For a necklace, a row and its reverse give the same necklace, except a row that reads the same both ways:

necklaces=rows+palindromic rows2\text{necklaces}=\frac{\text{rows}+\text{palindromic rows}}{2}

Examples

Example 21 (IITianForum). The 88 letters of the word EQUATION are written round a circle. In how many of these circular arrangements are the letters QQ and UU not next to each other?

▸ SHOW SOLUTION

Step 1. All circular arrangements

The 88 letters are all different:

(8−1)!=7!=5040(8-1)!=7!=5040

Step 2. QQ and UU next to each other

Tie QUQU into one unit: 77 units round the circle in 6!6! ways, and 22 orders inside the unit:

2×6!=14402\times6!=1440

Answer: 5040−1440=36005040-1440=3600

Example 22 (IITianForum). In how many ways can a garland be made from 77 flowers of different colours?

▸ SHOW SOLUTION

Step 1. Circular arrangements

(7−1)!=720(7-1)!=720

Step 2. A garland can be turned over

Each garland is counted twice:

7202=360\frac{720}{2}=360

Answer: 360360

Example 23 (IITianForum). In how many ways can 55 men and 55 women be seated at a round table so that men and women sit alternately?

▸ SHOW SOLUTION

Step 1. Seat the men

Round table: (5−1)!=24(5-1)!=24 ways. Fixing M1M_1 removes the turning of the table.

Left: ten seats round a table with men M1 to M5 alternating with women W and M1 shaded. Right: the five men seated with the five seats between them marked by crosses

Step 2. Seat the women

The 55 seats between the men are now all different (each has its own pair of neighbours), so the women fill them in 5!5! ways:

24×120=288024\times120=2880

Answer: 28802880

Example 24 (JEE Main 2023, 8 Apr Shift 1). The number of ways, in which 55 girls and 77 boys can be seated at a round table so that no two girls sit together, is

Tap an option to check your answer
(1)720720
(2)7(360)27(360)^2
(3)7(720)27(720)^2
(4)126(5!)2126(5!)^2
▸ SHOW SOLUTION

Step 1. Seat the boys

(7−1)!=720(7-1)!=720

Step 2. Girls in the gaps

The 77 boys leave 77 gaps; the 55 girls take 55 of them in order:

7P5=2520{}^7P_5=2520

Step 3. Match with the options

720×2520=1814400720\times2520=18144001814400=126×14400=126 (5!)21814400=126\times14400=126\,(5!)^2

Answer: option (4)

Example 25 (IITianForum). A host invites 55 guests chosen from his 99 friends, two of whom refuse to attend together. The host and the 55 guests then take seats at a round table. In how many ways can the guests be chosen and the six persons be seated?

▸ SHOW SOLUTION

Step 1. Choose the guests

All choices minus those with both of the two friends (then 33 more from the other 77):

9C5−7C3=126−35=91{}^9C_5-{}^7C_3=126-35=91

Step 2. Seat six persons round the table

(6−1)!=120(6-1)!=120

Step 3. Stages multiply

91×120=1092091\times120=10920

Answer: 1092010920

Example 26 (IITianForum). Three brothers, two sisters and three other persons are to be seated at a round table. In how many ways can this be done if the two sisters are together but no two brothers are next to each other?

▸ SHOW SOLUTION

Step 1. Seat everyone except the brothers

Tie the sisters into one unit. The unit and the 33 other persons are 44 units round the table, and the sisters can change places:

(4−1)!×2!=12(4-1)!\times2!=12

Step 2. Brothers in the gaps

The 44 units leave 44 gaps round the table. The 33 brothers take 33 different gaps in order:

4P3=24{}^4P_3=24

Step 3. Total

12×24=28812\times24=288

Answer: 288288

Example 27 (IITianForum). How many different garlands can be made using 33 identical red flowers, 22 identical blue flowers and 11 white flower?

▸ SHOW SOLUTION

Step 1. Fix the white flower

The white flower is unique; put it at the top. Read the other 55 flowers clockwise as a row of R,R,R,B,BR,R,R,B,B:

5!3! 2!=10 rows\frac{5!}{3!\,2!}=10\ \text{rows}

Step 2. Turning the garland over

Turning over keeps WW at the top and reverses the row. A row equal to its reverse must have RR in the middle, and the first two places hold one RR and one BB: RBRBRRBRBR and BRRRBBRRRB. These 22 are their own mirror images; the other 88 rows pair up into 44 garlands.

Six garlands of six flowers, each with the white flower W at the top and three red R and two blue B flowers in a different pattern

Step 3. Count

10+22=6\frac{10+2}{2}=6

Answer: 66

Example 28 (JEE Advanced 2019, Paper 2). Five persons A,B,C,DA,B,C,D and EE are seated in a circular arrangement. If each of them is given a hat of one of the three colours red, blue and green, then the number of ways of distributing the hats such that the persons seated in adjacent seats get different coloured hats is ______.

▸ SHOW SOLUTION

Step 1. Which colour patterns are possible

The persons are fixed, so no division by 55. Two colours alone cannot alternate round an odd circle of 55. A colour can be used at most twice (three hats of one colour on 55 seats in a circle put two of them side by side). So the colours are used 2,2,12,2,1 times.

Step 2. Place the single colour

Choose the colour used once (33 ways) and the person who gets it (55 ways).

Step 3. The other four

The remaining 44 persons form a row round the circle from one neighbour to the other, and the two remaining colours must alternate along it: 22 ways.

3×5×2=303\times5\times2=30

Answer: 3030

Combinations

Selection without order

A combination is a selection in which order does not matter. The number of ways of selecting rr objects from nn distinct objects is

nCr=n!r! (n−r)!,0≤r≤n{}^nC_r=\frac{n!}{r!\,(n-r)!},\qquad0\le r\le n

Reason: each selection of rr objects can be arranged in r!r! ways, so nPr=nCr⋅r!{}^nP_r={}^nC_r\cdot r!.

SituationCount
rr of nn distinct objectsnCr{}^nC_r
kk particular objects always includedn−kCr−k{}^{n-k}C_{r-k}
kk particular objects never includedn−kCr{}^{n-k}C_r
any number, including none2n2^n
at least one2n−12^n-1
from two groups, aa from mm and bb from nnmCa⋅nCb{}^mC_a\cdot{}^nC_b

At least and at most

"At least kk of a type" is done in one of two ways: add the cases k,k+1,…k, k+1,\dots one by one, or subtract the cases below kk from the total. Use whichever has fewer cases.

Do not fix one and choose the rest freely

For "at least one woman in a committee of 44 from 55 men and 33 women", the count 3⋅7C33\cdot{}^7C_3 is wrong: a committee with two women is counted twice, once for each woman picked first. The right count is 8C4−5C4=70−5=65{}^8C_4-{}^5C_4=70-5=65.

Selection that fixes an order

If the chosen objects must then be put in a forced order (increasing digits, alphabetical order, decreasing values), each selection gives exactly one arrangement. So the count is a combination, not a permutation.

Examples

Example 29 (JEE Main 2025, 22 Jan Shift 1). From all the English alphabets, five letters are chosen and are arranged in alphabetical order. The total number of ways in which the middle letter is 'M' is

Tap an option to check your answer
(1)1495014950
(2)60846084
(3)43564356
(4)51485148
▸ SHOW SOLUTION

Step 1. The order is forced

After choosing 55 letters, alphabetical order gives one arrangement. So only the choice matters.

Step 2. Two letters on each side of M

AA to LL are 1212 letters, NN to ZZ are 1313:

12C2⋅13C2=66⋅78=5148{}^{12}C_2\cdot{}^{13}C_2=66\cdot78=5148

Answer: option (4)

Example 30 (JEE Main 2025, 24 Jan Shift 2). Group A consists of 77 boys and 33 girls, while group B consists of 66 boys and 55 girls. The number of ways in which 44 boys and 44 girls can be invited for a picnic if 55 of them must be from group A and the remaining 33 from group B, is equal to

Tap an option to check your answer
(1)85758575
(2)91009100
(3)89258925
(4)87508750
▸ SHOW SOLUTION

Step 1. Split by the girls from A

Group A gives 55 persons and has only 33 girls. If A gives gg girls and 5−g5-g boys, then B gives 4−g4-g girls and g−1g-1 boys, so g=1,2,3g=1,2,3.

Step 2. Count each case

Girls from AABWays
333C3 7C2=21{}^3C_3\,{}^7C_2=215C1 6C2=75{}^5C_1\,{}^6C_2=7515751575
223C2 7C3=105{}^3C_2\,{}^7C_3=1055C2 6C1=60{}^5C_2\,{}^6C_1=6063006300
113C1 7C4=105{}^3C_1\,{}^7C_4=1055C3 6C0=10{}^5C_3\,{}^6C_0=1010501050

The total is 1575+6300+1050=89251575+6300+1050=8925.

Answer: option (3)

Example 31 (JEE Main 2025, 7 Apr Shift 1). From a group of 77 batsmen and 66 bowlers, 1010 players are to be chosen for a team, which should include at least 44 batsmen and at least 44 bowlers. One batsman and one bowler who are captain and vice-captain respectively of the team should be included. Then the total number of ways such a selection can be made, is

Tap an option to check your answer
(1)165165
(2)155155
(3)145145
(4)135135
▸ SHOW SOLUTION

Step 1. Two players are already in

Choose 88 more from 66 batsmen and 55 bowlers.

Step 2. The team splits

The team of 1010 is (4,6)(4,6), (5,5)(5,5) or (6,4)(6,4) batsmen and bowlers:

6C3 5C5+6C4 5C4+6C5 5C3{}^6C_3\,{}^5C_5+{}^6C_4\,{}^5C_4+{}^6C_5\,{}^5C_3=20+75+60=155=20+75+60=155

Answer: option (2)

Example 32 (JEE Main 2026, 5 Apr Shift 2). A box contains 55 blue, 66 yellow and 44 red balls. The number of ways of drawing 88 balls containing at least two balls of each colour, is

Tap an option to check your answer
(1)41004100
(2)41404140
(3)42304230
(4)42904290
▸ SHOW SOLUTION

Step 1. Colour counts

With b+y+r=8b+y+r=8 and each at least 22, the extra 22 balls give (b,y,r)(b,y,r) as

(4,2,2), (2,4,2), (2,2,4)(4,2,2),\ (2,4,2),\ (2,2,4)(3,3,2), (3,2,3), (2,3,3)(3,3,2),\ (3,2,3),\ (2,3,3)

Step 2. Balls of one colour are different

The options are large, so the balls are taken as different:

(b,y,r)(b,y,r)5Cb 6Cy 4Cr{}^5C_b\,{}^6C_y\,{}^4C_r
(4,2,2)(4,2,2)5⋅15⋅6=4505\cdot15\cdot6=450
(2,4,2)(2,4,2)10⋅15⋅6=90010\cdot15\cdot6=900
(2,2,4)(2,2,4)10⋅15⋅1=15010\cdot15\cdot1=150
(3,3,2)(3,3,2)10⋅20⋅6=120010\cdot20\cdot6=1200
(3,2,3)(3,2,3)10⋅15⋅4=60010\cdot15\cdot4=600
(2,3,3)(2,3,3)10⋅20⋅4=80010\cdot20\cdot4=800

The total is 41004100.

Step 3. Alike or different

If balls of one colour were alike, a draw would be fixed by (b,y,r)(b,y,r) alone and the answer would be 66. Only the reading with different balls matches an option.

Answer: option (1)

Example 33 (JEE Main 2026, 5 Apr Shift 1). Two players AA and BB play a series of games of badminton. The player who wins 55 games first wins the series. Assuming no game ends in a draw, the number of ways in which player AA wins the series is ______.

▸ SHOW SOLUTION

Step 1. The last game

AA wins the last game played. Before it, AA has won 44 games and BB has won kk games, k=0,1,2,3,4k=0,1,2,3,4.

Step 2. Count each case

The 44 wins of AA among the first 4+k4+k games: 4+kC4{}^{4+k}C_4 ways.

4C4+5C4+6C4+7C4+8C4{}^4C_4+{}^5C_4+{}^6C_4+{}^7C_4+{}^8C_4=1+5+15+35+70=126=1+5+15+35+70=126

Answer: 126126

Example 34 (JEE Main 2026, 23 Jan Shift 2). Let SS denote the set of 44-digit numbers abcdabcd such that a>b>c>da>b>c>d, and PP denote the set of 55-digit numbers having product of its digits equal to 2020. Then n(S)+n(P)n(S)+n(P) is equal to ______.

▸ SHOW SOLUTION

Step 1. The set SS

Any 44 distinct digits from 00 to 99 can be written in decreasing order in exactly one way, and the first digit is then not 00:

n(S)=10C4=210n(S)={}^{10}C_4=210

Step 2. The set PP

20=22⋅520=2^2\cdot5, and no digit is 00. The digits are {5,4,1,1,1}\{5,4,1,1,1\} or {5,2,2,1,1}\{5,2,2,1,1\}:

5!3!+5!2! 2!=20+30=50\frac{5!}{3!}+\frac{5!}{2!\,2!}=20+30=50

Answer: 210+50=260210+50=260

Example 35 (JEE Advanced 2020, Paper 2). An engineer is required to visit a factory for exactly four days during the first 1515 days of every month and it is mandatory that no two visits take place on consecutive days. Then the number of all possible ways in which such visits to the factory can be made by the engineer during 11 to 1515 June 20212021 is ______.

▸ SHOW SOLUTION

Step 1. Days not visited first

The 1111 days without a visit are in a row and leave 1212 gaps (between them and at the ends).

Top row: days 1 to 15 with days 2, 5, 9 and 13 shaded. Bottom row: the eleven free days as boxes with the four chosen days placed in four of the twelve gaps

Step 2. Visits go into different gaps

Each visit day takes its own gap, so no two visits are next to each other:

12C4=495{}^{12}C_4=495

Answer: 495495

Example 36 (JEE Advanced 2022, Paper 2). Consider 44 boxes, where each box contains 33 red balls and 22 blue balls. Assume that all 2020 balls are distinct. In how many different ways can 1010 balls be chosen from these 44 boxes so that from each box at least one red ball and one blue ball are chosen?

Tap an option to check your answer
(A)2181621816
(B)8553685536
(C)1209612096
(D)156816156816
▸ SHOW SOLUTION

Step 1. Choices from one box

With at least one red and one blue:

Balls from the boxWays
223⋅2=63\cdot2=6
333⋅1+3⋅2=93\cdot1+3\cdot2=9
441⋅2+3⋅1=51\cdot2+3\cdot1=5

Step 2. Sizes from the four boxes

Each box gives at least 22, so the 22 extra balls give sizes (3,3,2,2)(3,3,2,2) in 4C2=6{}^4C_2=6 orders or (4,2,2,2)(4,2,2,2) in 44 orders.

Step 3. Total

6⋅92⋅62+4⋅5⋅636\cdot9^2\cdot6^2+4\cdot5\cdot6^3=17496+4320=21816=17496+4320=21816

Answer: option (A)

Properties of combinations

Standard results

ResultReason
nCr=nCn−r{}^nC_r={}^nC_{n-r}choosing rr to take is choosing n−rn-r to leave
nCx=nCy⇒x=y{}^nC_x={}^nC_y\Rightarrow x=y or x+y=nx+y=nfrom the result above
nCr+nCr−1=n+1Cr{}^nC_r+{}^nC_{r-1}={}^{n+1}C_rsplit by whether one new object is chosen
r⋅nCr=n⋅n−1Cr−1r\cdot{}^nC_r=n\cdot{}^{n-1}C_{r-1}choose a team, then its captain
nCrnCr−1=n−r+1r\frac{{}^nC_r}{{}^nC_{r-1}}=\frac{n-r+1}{r}from the factorial form
nCr{}^nC_r largest at r=n2r=\frac n2 (nn even)the ratio above is ≥1\ge1 up to the middle
nCr{}^nC_r largest at r=n±12r=\frac{n\pm1}{2} (nn odd)two equal middle terms
nC0+nC2+⋯=nC1+nC3+⋯=2n−1{}^nC_0+{}^nC_2+\cdots={}^nC_1+{}^nC_3+\cdots=2^{n-1}adding or removing one fixed object swaps even and odd selections

The addition rule builds Pascal's triangle: each entry is the sum of the two above it.

Pascal's triangle from row 0 to row 6 with the two entries 10 and 10 of row 5 shaded and arrows to their sum 20 in row 6

Two useful sums

∑k=0NpCk qCN−k=p+qCN\sum_{k=0}^{N}{}^pC_k\,{}^qC_{N-k}={}^{p+q}C_N

Reason: choose NN persons from pp boys and qq girls; split by the number kk of boys.

rCr+r+1Cr+⋯+nCr=n+1Cr+1{}^rC_r+{}^{r+1}C_r+\cdots+{}^nC_r={}^{n+1}C_{r+1}

Reason: choose r+1r+1 numbers from 1,…,n+11,\dots,n+1 and split by the largest one chosen.

Examples

Example 37 (JEE Main 2026, 2 Apr Shift 1). The number of elements in the set S={(r,k):k∈Z and 36Cr+1=6(35Cr)k2−3}S=\left\{(r,k):k\in\mathbb Z\ \text{and}\ {}^{36}C_{r+1}=\frac{6\left({}^{35}C_r\right)}{k^2-3}\right\} is

Tap an option to check your answer
(1)22
(2)44
(3)88
(4)1616
▸ SHOW SOLUTION

Step 1. Reduce 36Cr+1{}^{36}C_{r+1}

36Cr+1=36r+1 35Cr{}^{36}C_{r+1}=\frac{36}{r+1}\,{}^{35}C_r

Step 2. The equation

Cancel 35Cr{}^{35}C_r:

36r+1=6k2−3⇒k2=r+196\frac{36}{r+1}=\frac{6}{k^2-3}\Rightarrow k^2=\frac{r+19}{6}

Step 3. The range of rr

0≤r≤350\le r\le35 gives 196≤k2≤9\frac{19}{6}\le k^2\le9, so k2=4k^2=4 or 99:

k2k^2r=6k2−19r=6k^2-19pairs (r,k)(r,k)
4455(5,2),(5,−2)(5,2),(5,-2)
993535(35,3),(35,−3)(35,3),(35,-3)

Answer: option (2)

Example 38 (JEE Main 2026, 2 Apr Shift 2). If for 3≤r≤303\le r\le30, 30C30−r+3 30C31−r+3 30C32−r+30C33−r=mCr{}^{30}C_{30-r}+3\,{}^{30}C_{31-r}+3\,{}^{30}C_{32-r}+{}^{30}C_{33-r}={}^mC_r, then mm equals

Tap an option to check your answer
(A)3131
(B)3232
(C)3333
(D)3434
▸ SHOW SOLUTION

Step 1. Write s=30−rs=30-r

The left side is 30Cs+3 30Cs+1+3 30Cs+2+30Cs+3{}^{30}C_s+3\,{}^{30}C_{s+1}+3\,{}^{30}C_{s+2}+{}^{30}C_{s+3}.

Step 2. Pascal's rule three times

Add neighbours in pairs:

31Cs+1+2 31Cs+2+31Cs+3{}^{31}C_{s+1}+2\,{}^{31}C_{s+2}+{}^{31}C_{s+3}32Cs+2+32Cs+3=33Cs+3{}^{32}C_{s+2}+{}^{32}C_{s+3}={}^{33}C_{s+3}

Step 3. Compare

s+3=33−rs+3=33-r, and 33C33−r=33Cr{}^{33}C_{33-r}={}^{33}C_r. So m=33m=33.

Answer: option (C)

Selections from identical objects and divisors

Identical objects

From pp alike objects you can take 0,1,…,p0,1,\dots,p of them: p+1p+1 ways. So from pp alike of one kind, qq alike of a second and rr alike of a third, with nn other distinct objects:

selections=(p+1)(q+1)(r+1) 2n\text{selections}=(p+1)(q+1)(r+1)\,2^n

This includes the empty selection; subtract 11 for "at least one".

Number and sum of divisors

Write N=p1a1p2a2⋯pkakN=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k} with distinct primes. A divisor takes each prime 00 to aia_i times, so

d(N)=(a1+1)(a2+1)⋯(ak+1)d(N)=(a_1+1)(a_2+1)\cdots(a_k+1) σ(N)=∏piai+1−1pi−1\sigma(N)=\prod\frac{p_i^{a_i+1}-1}{p_i-1}

Reason for the sum: expanding (1+p1+⋯+p1a1)⋯(1+pk+⋯+pkak)(1+p_1+\dots+p_1^{a_1})\cdots(1+p_k+\dots+p_k^{a_k}) gives every divisor exactly once.

For N=2a 3b 5cN=2^a\,3^b\,5^cCount
all divisors(a+1)(b+1)(c+1)(a+1)(b+1)(c+1)
odd divisors(b+1)(c+1)(b+1)(c+1)
even divisorsa (b+1)(c+1)a\,(b+1)(c+1)
divisors that are multiples of 1010a (b+1) ca\,(b+1)\,c
proper divisors (not 11, not NN)d(N)−2d(N)-2
NN as a product of two factors (unordered)d(N)2\frac{d(N)}{2}, or d(N)+12\frac{d(N)+1}{2} if NN is a square
NN as a product of two coprime factors (unordered)2k−12^{k-1}
Even divisors are not half of all divisors

An even divisor must take the prime 22 at least once, so the power of 22 has aa choices, not a+1a+1. For N=24⋅33⋅52N=2^4\cdot3^3\cdot5^2, all divisors are 6060 and even divisors are 4⋅4⋅3=484\cdot4\cdot3=48.

Examples

Example 39 (JEE Main 2019, 12 Jan Shift 1). The number of ways of choosing 1010 objects out of 3131 objects of which 1010 are identical and the remaining 2121 are distinct is

Tap an option to check your answer
(1)220−12^{20}-1
(2)2202^{20}
(3)2212^{21}
(4)220+12^{20}+1
▸ SHOW SOLUTION

Step 1. Split by the distinct objects taken

If kk distinct objects are taken, the other 10−k10-k are identical ones, in one way:

21C0+21C1+⋯+21C10{}^{21}C_0+{}^{21}C_1+\cdots+{}^{21}C_{10}

Step 2. Half of the full sum

21Ck=21C21−k{}^{21}C_k={}^{21}C_{21-k}, so the terms k=0k=0 to 1010 are exactly half of 2212^{21}:

2212=220\frac{2^{21}}{2}=2^{20}

Answer: option (2)

Example 40 (JEE Main 2021, 26 Feb Shift 2). A natural number has prime factorization given by n=2x 3y 5zn=2^x\,3^y\,5^z where yy and zz are such that y+z=5y+z=5 and y−1+z−1=56y^{-1}+z^{-1}=\frac56, y>zy>z. Then the number of odd divisors of nn, including 11, is

Tap an option to check your answer
(1)66
(2)1212
(3)1111
(4)66
▸ SHOW SOLUTION

Step 1. Find yy and zz

1y+1z=y+zyz=5yz=56\frac1y+\frac1z=\frac{y+z}{yz}=\frac{5}{yz}=\frac56, so yz=6yz=6 and y+z=5y+z=5. With y>zy>z, y=3y=3, z=2z=2.

Step 2. Odd divisors

An odd divisor takes no factor 22:

(3+1)(2+1)=12(3+1)(2+1)=12

Options (1) and (4) are both 66 as printed in the paper; the answer 1212 is option (2).

Answer: option (2)

Example 41 (IITianForum). Let N=10800N=10800. If pp is the number of even divisors of NN and qq is the sum of all the odd divisors of NN, find p+qp+q.

▸ SHOW SOLUTION

Step 1. Prime factors

10800=108⋅100=24⋅33⋅5210800=108\cdot100=2^4\cdot3^3\cdot5^2

Step 2. Even divisors

p=4⋅4⋅3=48p=4\cdot4\cdot3=48

Step 3. Sum of odd divisors

q=(1+3+9+27)(1+5+25)q=(1+3+9+27)(1+5+25)q=40⋅31=1240q=40\cdot31=1240

Answer: 48+1240=128848+1240=1288

Integer solutions and identical objects into boxes

Non-negative and positive solutions

The number of non-negative integer solutions of x1+x2+⋯+xn=rx_1+x_2+\cdots+x_n=r is

r+n−1Cn−1{}^{r+n-1}C_{n-1}

Reason: write rr dots and n−1n-1 bars in a row. The dots before the first bar give x1x_1, those between the first and second bar give x2x_2, and so on. Every row of r+n−1r+n-1 symbols with n−1n-1 bars is one solution.

Seven dots and three bars in a row: two dots, a bar, three dots, two bars together, two dots, read as x1 equals 2, x2 equals 3, x3 equals 0, x4 equals 2

The same number counts the ways of giving rr identical objects to nn distinct persons.

ConditionNumber of solutions of x1+⋯+xn=rx_1+\cdots+x_n=r
xi≥0x_i\ge0r+n−1Cn−1{}^{r+n-1}C_{n-1}
xi≥1x_i\ge1r−1Cn−1{}^{r-1}C_{n-1}
xi≥aix_i\ge a_iput xi=ai+yix_i=a_i+y_i, then yi≥0y_i\ge0
xi≤bx_i\le bsubtract the solutions with some xi≥b+1x_i\ge b+1 (Example 47)
x1<x2<⋯<xnx_1<x_2<\cdots<x_nsubtract the smallest case, then count partitions
one term 2c2c or 3c3cfix that variable and add the cases
Upper limits by a product

The number of solutions with 0≤xi≤k0\le x_i\le k is the coefficient of trt^r in (1+t+⋯+tk)n(1+t+\cdots+t^k)^n, because each bracket picks the value of one xix_i. For small numbers, multiplying out or listing patterns is often quicker than inclusion and exclusion.

Identical or distinct objects

r+n−1Cn−1{}^{r+n-1}C_{n-1} is for identical objects into distinct boxes. Distinct objects into distinct boxes is nrn^r. Before using a formula, settle both: are the objects alike, are the boxes alike.

Examples

Example 42 (JEE Main 2026, 23 Jan Shift 2). The number of ways in which 1616 oranges can be distributed to four children such that each child gets at least one orange, is

Tap an option to check your answer
(1)429429
(2)384384
(3)403403
(4)455455
▸ SHOW SOLUTION

Step 1. Positive solutions

x1+x2+x3+x4=16x_1+x_2+x_3+x_4=16 with each xi≥1x_i\ge1:

16−1C4−1=15C3=455{}^{16-1}C_{4-1}={}^{15}C_3=455

Answer: option (4)

Example 43 (JEE Main 2026, 4 Apr Shift 2). Let A={(a,b,c):a,b,c are non-negative integers and a+b+2c=22}A=\{(a,b,c):a,b,c\ \text{are non-negative integers and}\ a+b+2c=22\}. Then n(A)n(A) is equal to

Tap an option to check your answer
(1)121121
(2)124124
(3)144144
(4)169169
▸ SHOW SOLUTION

Step 1. Fix cc

a+b=22−2ca+b=22-2c has 23−2c23-2c non-negative solutions, and c=0,1,…,11c=0,1,\dots,11.

Step 2. Add

23+21+⋯+1=122=14423+21+\cdots+1=12^2=144

Answer: option (3)

Example 44 (JEE Main 2025, 29 Jan Shift 1). Let PP be the set of seven-digit numbers with the sum of their digits equal to 1111. If the numbers in PP are formed by using the digits 1,21,2 and 33 only, then the number of elements in the set PP is

Tap an option to check your answer
(1)158158
(2)173173
(3)164164
(4)161161
▸ SHOW SOLUTION

Step 1. The extra over 11

Write each digit as 1+ei1+e_i with ei∈{0,1,2}e_i\in\{0,1,2\}. Then e1+⋯+e7=4e_1+\cdots+e_7=4.

Step 2. Patterns of the extras

ExtrasDigitsArrangements
2,22,2five 11, two 337!5! 2!=21\frac{7!}{5!\,2!}=21
2,1,12,1,1four 11, two 22, one 337!4! 2!=105\frac{7!}{4!\,2!}=105
1,1,1,11,1,1,1three 11, four 227!3! 4!=35\frac{7!}{3!\,4!}=35

The total is 21+105+35=16121+105+35=161.

Answer: option (4)

Example 45 (JEE Main 2025, 28 Jan Shift 2). The number of natural numbers, between 212212 and 999999, such that the sum of their digits is 1515, is ______.

▸ SHOW SOLUTION

Step 1. Two digits with a given sum

For y+z=sy+z=s with digits 00 to 99: s+1s+1 pairs if s≤9s\le9, and 19−s19-s pairs if s≥10s\ge10.

Step 2. By the first digit xx

xxy+zy+zpairs
22131366
33121277
44111188
55101099
66991010
778899
887788
996677

For x=2x=2 the numbers run from 249249 to 294294, all above 212212.

Answer: 6464

Example 46 (JEE Main 2022, 28 June Shift 2). The number of ways to distribute 3030 identical candies among four children C1,C2,C3,C4C_1,C_2,C_3,C_4 so that C2C_2 receives at least 44 and at most 77 candies, C3C_3 receives at least 22 and at most 66 candies, is

Tap an option to check your answer
(1)205205
(2)615615
(3)510510
(4)430430
▸ SHOW SOLUTION

Step 1. Fix C2C_2 and C3C_3

If C2C_2 gets aa and C3C_3 gets bb, then C1C_1 and C4C_4 share 30−a−b30-a-b in 31−a−b31-a-b ways.

Step 2. Add over b=2b=2 to 66

For a fixed aa, the five values of bb add to 2020:

∑b=26(31−a−b)=135−5a\sum_{b=2}^{6}(31-a-b)=135-5a

Step 3. Add over a=4a=4 to 77

4⋅135−5⋅22=4304\cdot135-5\cdot22=430

Answer: option (4)

Example 47 (JEE Advanced 2026, Paper 1). The number of ways to distribute 1010 identical red pens and 1414 identical blue pens among four persons such that each person gets 66 pens, is ______.

▸ SHOW SOLUTION

Step 1. Red pens decide everything

If person ii gets rir_i red pens, the other 6−ri6-r_i are blue. So count r1+r2+r3+r4=10r_1+r_2+r_3+r_4=10 with 0≤ri≤60\le r_i\le6; the blue total is then 24−10=1424-10=14 automatically.

Step 2. Without the upper limit

13C3=286{}^{13}C_3=286

Step 3. Remove ri≥7r_i\ge7

If r1≥7r_1\ge7, put r1=7+sr_1=7+s: s+r2+r3+r4=3s+r_2+r_3+r_4=3 has 6C3=20{}^6C_3=20 solutions. Any of the 44 persons can be the one, and two persons cannot both have 77:

286−4⋅20=206286-4\cdot20=206

Answer: 206206

Example 48 (JEE Advanced 2014, Paper 1). Let n1<n2<n3<n4<n5n_1<n_2<n_3<n_4<n_5 be positive integers such that n1+n2+n3+n4+n5=20n_1+n_2+n_3+n_4+n_5=20. The number of such distinct arrangements (n1,n2,n3,n4,n5)(n_1,n_2,n_3,n_4,n_5) is ______.

▸ SHOW SOLUTION

Step 1. Remove the smallest case

The least possible values are 1,2,3,4,51,2,3,4,5, with sum 1515. Put ni=i+yin_i=i+y_i; then 0≤y1≤y2≤⋯≤y50\le y_1\le y_2\le\cdots\le y_5 and ∑yi=5\sum y_i=5.

Step 2. Write 55 as a sum of at most 55 parts

The non-zero yiy_i in decreasing order form a partition of 55:

5,4+1,3+2,3+1+15,\quad 4+1,\quad 3+2,\quad 3+1+12+2+1,2+1+1+12+2+1,\quad 2+1+1+11+1+1+1+11+1+1+1+1

Answer: 77

Division into groups and distribution of distinct objects

Groups of unequal sizes

The number of ways of dividing m+n+pm+n+p distinct objects into three groups of sizes mm, nn, pp (all different) is

(m+n+p)!m! n! p!\frac{(m+n+p)!}{m!\,n!\,p!}

Reason: choose the group of mm, then the group of nn from the rest: m+n+pCm⋅n+pCn{}^{m+n+p}C_m\cdot{}^{n+p}C_n.

Groups of equal sizes

If two or more groups have the same size, the groups have no names, so interchanging them gives the same division. Divide by k!k! for every set of kk equal-size groups:

3m objects into 3 groups of m: (3m)!(m!)3 3!3m\ \text{objects into 3 groups of}\ m:\ \frac{(3m)!}{(m!)^3\,3!} Six objects a to f grouped in pairs ab, cd, ef, and the same pairs listed in the order cd, ef, ab, with an equals sign between the two pictures

Distributing the groups

If the groups go to distinct persons, first form the groups, then give them out: multiply by the number of ways of handing the groups to the persons. For 3m3m objects to 33 persons, mm each:

(3m)!(m!)3 3!×3!=(3m)!(m!)3\frac{(3m)!}{(m!)^3\,3!}\times3!=\frac{(3m)!}{(m!)^3}

The four cases of distribution

ObjectsBoxesCount of ways for rr objects, nn boxes
distinctdistinctnrn^r; no box empty: nr−nC1(n−1)r+nC2(n−2)r−⋯n^r-{}^nC_1(n-1)^r+{}^nC_2(n-2)^r-\cdots
identicaldistinctr+n−1Cn−1{}^{r+n-1}C_{n-1}; no box empty: r−1Cn−1{}^{r-1}C_{n-1}
distinctidenticaladd the group divisions over all size patterns
identicalidenticalnumber of ways of writing rr as a sum of at most nn parts
Divide by k! only for equal groups

99 books into groups of 22, 33, 44 is 9!2! 3! 4!\frac{9!}{2!\,3!\,4!} with no extra division, because the sizes already tell the groups apart. Groups of 22, 22, 55 need a division by 2!2!, and groups of 3,3,33,3,3 by 3!3!. When the groups are then given to persons, multiply by the number of ways of handing them out, not always by 3!3!.

Examples

Example 49 (IITianForum). In how many ways can 1010 different books be distributed among 44 students so that two of the students get 22 books each and the other two get 33 books each?

▸ SHOW SOLUTION

Step 1. Form the groups

Sizes 2,2,3,32,2,3,3: two pairs of equal groups.

10!2! 2! 3! 3!⋅2! 2!=6300\frac{10!}{2!\,2!\,3!\,3!\cdot2!\,2!}=6300

Step 2. Give the groups to the students

The 44 groups go to 44 students in 4!4! ways:

6300×24=1512006300\times24=151200

Answer: 151200151200

Example 50 (JEE Main 2026, 6 Apr Shift 2). A building has a ground floor and 1010 more floors. Nine persons enter a lift at the ground floor. The lift goes up to the 10th10^{\text{th}} floor. The number of ways in which any 44 persons exit at a floor and the remaining 55 persons exit at a different floor, if the lift does not stop at the first and the second floors, is equal to

Tap an option to check your answer
(1)21842184
(2)30643064
(3)70567056
(4)1134011340
▸ SHOW SOLUTION

Step 1. Groups of 44 and 55

9!4! 5!=126\frac{9!}{4!\,5!}=126

Step 2. Floors for the two groups

Floors 33 to 1010 give 88 choices; the group of 44 takes one floor and the group of 55 another: 8⋅7=568\cdot7=56.

126×56=7056126\times56=7056

Answer: option (3)

Example 51 (JEE Main 2023, 10 Apr Shift 2). Eight persons are to be transported from city AA to city BB in three cars of different makes. If each car can accommodate at most three persons, then the number of ways in which they can be transported is

Tap an option to check your answer
(1)11201120
(2)33603360
(3)16801680
(4)560560
▸ SHOW SOLUTION

Step 1. The only size pattern

88 persons with at most 33 in a car: 3,3,23,3,2.

Step 2. Count

Choose the car that takes 22 (33 ways); the cars are different, so the groups are named by their cars:

3×8!3! 3! 2!=3×560=16803\times\frac{8!}{3!\,3!\,2!}=3\times560=1680

Answer: option (3)

Example 52 (IIT JEE 2012, Paper 1). The total number of ways in which 55 balls of different colours can be distributed among 33 persons so that each person gets at least one ball is

Tap an option to check your answer
(A)7575
(B)150150
(C)210210
(D)243243
▸ SHOW SOLUTION

Step 1. Size patterns

5=3+1+15=3+1+1 or 2+2+12+2+1.

Step 2. Groups, then persons

5!3! 1! 1! 2!×3!=10×6=60\frac{5!}{3!\,1!\,1!\,2!}\times3!=10\times6=605!2! 2! 1! 2!×3!=15×6=90\frac{5!}{2!\,2!\,1!\,2!}\times3!=15\times6=90

Step 3. Check by the formula

35−3⋅25+3⋅15=243−96+3=1503^5-3\cdot2^5+3\cdot1^5=243-96+3=150

Answer: option (B)

Example 53 (JEE Main 2024, 29 Jan Shift 2). Number of ways of arranging 88 identical books into 44 identical shelves where any number of shelves may remain empty is equal to

Tap an option to check your answer
(1)1515
(2)1616
(3)1818
(4)1212
▸ SHOW SOLUTION

Step 1. Only the sizes matter

Books and shelves are both identical, so a way is a sum of at most 44 parts equal to 88.

Step 2. List by the number of parts

PartsSumsCount
118811
227+1, 6+2, 5+3, 4+47+1,\ 6+2,\ 5+3,\ 4+444
336+1+1, 5+2+1, 4+3+1, 4+2+2, 3+3+26+1+1,\ 5+2+1,\ 4+3+1,\ 4+2+2,\ 3+3+255
445+1+1+1, 4+2+1+1, 3+3+1+1, 3+2+2+1, 2+2+2+25+1+1+1,\ 4+2+1+1,\ 3+3+1+1,\ 3+2+2+1,\ 2+2+2+255

The total is 1+4+5+5=151+4+5+5=15.

Answer: option (1)

Example 54 (JEE Main 2024, 1 Feb Shift 2). If nn is the number of ways five different employees can sit into four indistinguishable offices where any office may have any number of persons including zero, then nn is equal to

Tap an option to check your answer
(1)4747
(2)5353
(3)5151
(4)4343
▸ SHOW SOLUTION

Step 1. Offices are alike

Only the groups formed matter, with at most 44 non-empty groups.

Step 2. Count by size pattern

SizesDivisions
5511
4,14,15C4=5{}^5C_4=5
3,23,25C3=10{}^5C_3=10
3,1,13,1,15C3=10{}^5C_3=10
2,2,12,2,15!2! 2! 1! 2!=15\frac{5!}{2!\,2!\,1!\,2!}=15
2,1,1,12,1,1,15C2=10{}^5C_2=10

The total is 1+5+10+10+15+10=511+5+10+10+15+10=51.

Answer: option (3)

Example 55 (JEE Advanced 2020, Paper 2). In a hotel, four rooms are available. Six persons are to be accommodated in these four rooms in such a way that each of these rooms contains at least one person and at most two persons. Then the number of all possible ways in which this can be done is ______.

▸ SHOW SOLUTION

Step 1. Size pattern

66 persons in 44 rooms, each 11 or 22: sizes 2,2,1,12,2,1,1.

Step 2. Rooms with two persons

Choose them: 4C2=6{}^4C_2=6.

Step 3. Fill the named rooms

6!2! 2! 1! 1!=180\frac{6!}{2!\,2!\,1!\,1!}=180

Answer: 6×180=10806\times180=1080

Example 56 (JEE Advanced 2024, Paper 1). A group of 99 students, s1,s2,…,s9s_1,s_2,\dots,s_9, is to be divided to form three teams XX, YY and ZZ of sizes 22, 33 and 44, respectively. Suppose that s1s_1 cannot be selected for the team XX, and s2s_2 cannot be selected for the team YY. Then the number of ways to form such teams is ______.

▸ SHOW SOLUTION

Step 1. All divisions

9!2! 3! 4!=1260\frac{9!}{2!\,3!\,4!}=1260

Step 2. The unwanted cases

s1s_1 in XX: 8C1⋅7C3=280{}^8C_1\cdot{}^7C_3=280. s2s_2 in YY: 8C2⋅6C2=420{}^8C_2\cdot{}^6C_2=420. Both: 7C1⋅6C2=105{}^7C_1\cdot{}^6C_2=105.

Step 3. Inclusion and exclusion

1260−280−420+105=6651260-280-420+105=665

Answer: 665665

Inclusion and exclusion

Two and three conditions

For sets AA, BB, CC of arrangements,

n(A∪B)=n(A)+n(B)−n(A∩B)n(A\cup B)=n(A)+n(B)-n(A\cap B)

and for three sets

n(A∪B∪C)=S1−S2+S3n(A\cup B\cup C)=S_1-S_2+S_3

where S1=∑n(A)S_1=\sum n(A) is the sum over single sets, S2=∑n(A∩B)S_2=\sum n(A\cap B) the sum over pairs and S3=n(A∩B∩C)S_3=n(A\cap B\cap C).

To count arrangements with none of the bad properties, subtract n(A∪B∪C)n(A\cup B\cup C) from the total.

Every kind used at least once

The number of words of length rr from kk given letters in which every letter appears at least once (each of rr places chooses a letter, and no letter is left out) is

kr−kC1(k−1)r+kC2(k−2)r−⋯k^r-{}^kC_1(k-1)^r+{}^kC_2(k-2)^r-\cdots

For small numbers, listing the patterns of repeats is just as quick.

Exactly k versus at least k

"At least one of the digits 00 and 11 appears exactly twice" is a union of two sets: 00 exactly twice, 11 exactly twice. Count each, then subtract the overlap. Mixing "at least" and "exactly" in one step is the usual source of a wrong total.

Examples

Example 57 (JEE Main 2026, 2 Apr Shift 1). The number of seven-digit numbers that can be formed by using the digits 1,2,3,51,2,3,5 and 77 such that each digit is used at least once, is

Tap an option to check your answer
(1)1540015400
(2)1780017800
(3)1680016800
(4)2940029400
▸ SHOW SOLUTION

Step 1. Patterns of repeats

77 places, 55 digits each at least once: the 22 extra places give 3,1,1,1,13,1,1,1,1 or 2,2,1,1,12,2,1,1,1.

Step 2. Count each pattern

5×7!3!=5×840=42005\times\frac{7!}{3!}=5\times840=42005C2×7!2! 2!=10×1260=12600{}^5C_2\times\frac{7!}{2!\,2!}=10\times1260=12600

Step 3. Check by inclusion and exclusion

57−5⋅47+10⋅37−10⋅27+55^7-5\cdot4^7+10\cdot3^7-10\cdot2^7+5=78125−81920+21870−1280+5=78125-81920+21870-1280+5=16800=16800

Answer: option (3)

Example 58 (JEE Advanced 2025, Paper 1). Let SS be the set of all seven-digit numbers that can be formed using the digits 00, 11 and 22. For example, 22102222210222 is in SS, but 02102220210222 is NOT in SS. Then the number of elements xx in SS such that at least one of the digits 00 and 11 appears exactly twice in xx, is equal to ______.

▸ SHOW SOLUTION

Step 1. Zero exactly twice (AA)

The first digit is not 00. Place the two zeros in the last 66 places, the other 55 places take 11 or 22:

n(A)=6C2⋅25=480n(A)={}^6C_2\cdot2^5=480

Step 2. One exactly twice (BB)

First digit 11: the other 11 in 66 places, the rest 00 or 22: 6⋅25=1926\cdot2^5=192. First digit 22: two 11s in 6C2{}^6C_2 ways, the rest 00 or 22: 15⋅24=24015\cdot2^4=240.

n(B)=192+240=432n(B)=192+240=432

Step 3. Both (A∩BA\cap B)

Digits 0,0,1,1,2,2,20,0,1,1,2,2,2, first digit not 00:

7!2! 2! 3!−6!2! 3!=210−60=150\frac{7!}{2!\,2!\,3!}-\frac{6!}{2!\,3!}=210-60=150

Step 4. The union

480+432−150=762480+432-150=762

Answer: 762762

Derangements

Definition and formula

A derangement of nn objects is an arrangement in which no object is in its own place, for example no letter in its own envelope. The number of derangements is

Dn=n!(1−11!+12!−⋯+(−1)nn!)D_n=n!\left(1-\frac1{1!}+\frac1{2!}-\cdots+\frac{(-1)^n}{n!}\right)

Reason: by inclusion and exclusion, the arrangements with a chosen set of kk objects in their own places number (n−k)!(n-k)!, and there are nCk{}^nC_k such sets. So Dn=∑(−1)k nCk (n−k)!D_n=\sum(-1)^k\,{}^nC_k\,(n-k)!, which is the formula above.

Two pictures of four letters L1 to L4 sent to four envelopes E1 to E4 with no letter going to its own envelope: the first swaps two pairs, the second sends each letter to the next envelope and L4 to E1
nn1122334455667788
DnD_n001122994444265265185418541483314833

The values satisfy Dn=(n−1)(Dn−1+Dn−2)D_n=(n-1)\left(D_{n-1}+D_{n-2}\right). Reason: object 11 goes to some place jj (n−1n-1 choices); then either object jj goes to place 11 (Dn−2D_{n-2} ways) or it does not (Dn−1D_{n-1} ways).

Exactly kk in the right place

exactly k correct=nCk Dn−k\text{exactly}\ k\ \text{correct}={}^nC_k\,D_{n-k}

Choose the kk objects that are correct; the other n−kn-k must all be wrong.

All wrong is not at least one wrong

"At least one letter in a wrong envelope" is n!−1n!-1: only the arrangement with every letter correct is removed. "All letters wrong" is DnD_n. For 55 letters these are 119119 and 4444. Read whether the question says every, at least one, exactly kk or at least kk.

Examples

Example 59 (JEE Main 2023, 11 Apr Shift 1). In an examination, 55 students have been allotted their seats as per their roll numbers. The number of ways, in which none of the students is seated on the allotted seat, is ______.

▸ SHOW SOLUTION

Step 1. Derangements of 55

D5=5!(12!−13!+14!−15!)D_5=5!\left(\frac1{2!}-\frac1{3!}+\frac1{4!}-\frac1{5!}\right)=60−20+5−1=44=60-20+5-1=44

Answer: 4444

Example 60 (IITianForum). Five balls have five different colours C1,C2,C3,C4,C5C_1,C_2,C_3,C_4,C_5, ball kk having colour CkC_k. After one second each ball takes one of these five colours, and the five balls still have five different colours. In how many ways can this happen if exactly two balls keep their own colour?

▸ SHOW SOLUTION

Step 1. The new colouring is an arrangement

Five different colours on five balls is an arrangement of C1,…,C5C_1,\dots,C_5. A ball that keeps its colour is an object in its own place.

Step 2. Choose the two balls that keep their colour

5C2=10{}^5C_2=10

Step 3. The other three all change

D3=2D_3=2

Answer: 10×2=2010\times2=20

Example 61 (IITianForum). Six cards and six envelopes are numbered 11 to 66. The cards are placed one in each envelope so that no card is in the envelope bearing its own number. In how many ways can this be done if card 11 is in envelope 22 and card 22 is in envelope 33?

▸ SHOW SOLUTION

Step 1. What is left

Cards 3,4,5,63,4,5,6 go into envelopes 1,4,5,61,4,5,6. Envelope 33 is already filled, so card 33 has no forbidden envelope; cards 44, 55, 66 each have one.

Step 2. Inclusion and exclusion on the three barred cards

4!−3⋅3!+3⋅2!−1!4!-3\cdot3!+3\cdot2!-1!=24−18+6−1=11=24-18+6-1=11

Answer: 1111

Example 62 (IITianForum). Let A={a1,a2,a3,a4}A=\{a_1,a_2,a_3,a_4\} and B={1,2,3,4,5,6}B=\{1,2,3,4,5,6\}. Find the number of one-one functions f:A→Bf:A\to B such that f(ai)≠if(a_i)\neq i for i=1,2,3,4i=1,2,3,4.

▸ SHOW SOLUTION

Step 1. One-one functions are arrangements

A one-one ff is an ordered choice of 44 different values: 6P4=360{}^6P_4=360 in all.

Step 2. A chosen set of kk fixed values

If f(ai)=if(a_i)=i for kk chosen indices, the other 4−k4-k elements take different values from the remaining 6−k6-k: 6−kP4−k{}^{6-k}P_{4-k} ways.

Step 3. Inclusion and exclusion

360−4⋅5P3+6⋅4P2−4⋅3P1+1360-4\cdot{}^5P_3+6\cdot{}^4P_2-4\cdot{}^3P_1+1=360−240+72−12+1=181=360-240+72-12+1=181

Answer: 181181

Example 63 (JEE Advanced 2014, Paper 2). Six cards and six envelopes are numbered 1,2,3,4,5,61,2,3,4,5,6 and cards are to be placed in envelopes so that each envelope contains exactly one card and no card is placed in the envelope bearing the same number and moreover the card numbered 11 is always placed in envelope numbered 22. Then the number of ways it can be done is

Tap an option to check your answer
(A)264264
(B)265265
(C)5353
(D)6767
▸ SHOW SOLUTION

Step 1. Card 22 goes to envelope 11

Then cards 3,4,5,63,4,5,6 are deranged: D4=9D_4=9.

Step 2. Card 22 does not go to envelope 11

Think of envelope 11 as card 22's forbidden envelope. Cards 2,3,4,5,62,3,4,5,6 into envelopes 1,3,4,5,61,3,4,5,6 with each card barred from one envelope: D5=44D_5=44.

9+44=539+44=53

Step 3. Check by symmetry

Card 11 goes to each of envelopes 22 to 66 equally often, so the count is D65=2655=53\frac{D_6}{5}=\frac{265}{5}=53.

Answer: option (C)

Example 64 (IITianForum). Eight cards numbered 11 to 88 are placed in eight envelopes numbered 11 to 88, one card in each, so that no card is in the envelope bearing its own number. In how many of these ways is card 22 in envelope 55?

▸ SHOW SOLUTION

Step 1. Symmetry

In the D8D_8 derangements, card 22 goes to each of the 77 envelopes other than envelope 22 equally often (relabelling those envelopes and their cards swaps the cases).

Step 2. Count

D87=148337=2119\frac{D_8}{7}=\frac{14833}{7}=2119

Step 3. Check with the method of Example 63

Card 55 in envelope 22: D6=265D_6=265. Card 55 not in envelope 22: D7=1854D_7=1854. The total 265+1854=2119265+1854=2119 agrees.

Answer: 21192119

Geometrical counting

Points, lines and triangles

GivenCount
nn points, no three collinear: linesnC2{}^nC_2
nn points, no three collinear: trianglesnC3{}^nC_3
nn points with mm collinear: linesnC2−mC2+1{}^nC_2-{}^mC_2+1
nn points with mm collinear: trianglesnC3−mC3{}^nC_3-{}^mC_3
diagonals of an nn-gonnC2−n=n(n−3)2{}^nC_2-n=\frac{n(n-3)}{2}
diagonal crossings inside a convex nn-gonnC4{}^nC_4
mm parallel lines cut by nn parallel lines: parallelogramsmC2 nC2{}^mC_2\,{}^nC_2

Reason for the crossings: any 44 vertices form a quadrilateral whose two diagonals cross at one interior point, and each crossing comes from exactly one such set of 44 (when no three diagonals meet at a point).

Left: a regular hexagon A1 to A6 with all its diagonals drawn. Right: four points on a circle joined as a quadrilateral, its two diagonals crossing at a shaded point

Triangles from the vertices of an nn-gon

Triangles withCount
any verticesnC3{}^nC_3
two sides common with the polygonnn
exactly one side commonn(n−4)n(n-4)
no side commonnC3−n−n(n−4){}^nC_3-n-n(n-4)

Rectangles on a grid and lattice paths

A grid of m×nm\times n unit squares has m+1m+1 lines one way and n+1n+1 the other. A rectangle is fixed by 22 lines of each kind:

rectangles=m+1C2⋅n+1C2\text{rectangles}={}^{m+1}C_2\cdot{}^{n+1}C_2

The squares of side kk number (m−k+1)(n−k+1)(m-k+1)(n-k+1).

A grid of 6 by 3 unit squares with two vertical lines and two horizontal lines drawn thick and the rectangle between them shaded

A path from (0,0)(0,0) to (m,n)(m,n) going one unit right or one unit up at each step has mm right steps and nn up steps in some order:

paths=m+nCm\text{paths}={}^{m+n}C_m A 6 by 3 grid with a staircase path from O at the lower left to Q at the upper right made of six steps right and three steps up

Examples

Example 65 (JEE Main 2026, 2 Apr Shift 2). Let pnp_n denote the total number of triangles formed by joining the vertices of an nn-side regular polygon. If pn+1−pn=66p_{n+1}-p_n=66, then the sum of all distinct prime divisors of nn is

Tap an option to check your answer
(A)77
(B)88
(C)55
(D)66
▸ SHOW SOLUTION

Step 1. Pascal's rule

pn+1−pn=n+1C3−nC3=nC2p_{n+1}-p_n={}^{n+1}C_3-{}^nC_3={}^nC_2

Step 2. Solve

n(n−1)2=66⇒n(n−1)=132\frac{n(n-1)}{2}=66\Rightarrow n(n-1)=132

so n=12n=12.

Step 3. Prime divisors

12=22⋅312=2^2\cdot3, and 2+3=52+3=5.

Answer: option (C)

Example 66 (JEE Main 2019, 10 Apr Shift 2). Suppose that 2020 pillars of the same height have been erected along the boundary of a circular stadium. If the top of each pillar has been connected by beams with the top of all its non-adjacent pillars, then the total number of beams is

Tap an option to check your answer
(1)180180
(2)170170
(3)190190
(4)210210
▸ SHOW SOLUTION

Step 1. All joins minus neighbours

The pillars are vertices of a 2020-gon, and the beams are its diagonals:

20C2−20=190−20=170{}^{20}C_2-20=190-20=170

Answer: option (2)

Example 67 (JEE Main 2025, 3 Apr Shift 2). Line L1L_1 of slope 22 and line L2L_2 of slope 12\frac12 intersect at the origin OO. In the first quadrant, P1,P2,…,P12P_1,P_2,\dots,P_{12} are 1212 points on line L1L_1 and Q1,Q2,…,Q9Q_1,Q_2,\dots,Q_9 are 99 points on line L2L_2. Then the total number of triangles, that can be formed having vertices at three of the 2222 points O,P1,…,P12,Q1,…,Q9O,P_1,\dots,P_{12},Q_1,\dots,Q_9, is

Tap an option to check your answer
(1)10801080
(2)11341134
(3)10261026
(4)11881188
▸ SHOW SOLUTION

Step 1. Two collinear sets

L1L_1 carries OO and the 1212 points PiP_i: 1313 points. L2L_2 carries OO and the 99 points QjQ_j: 1010 points.

Two lines L1 and L2 from the origin O with twelve points on L1 and nine on L2, and a shaded triangle with one vertex on L1 and two on L2

Step 2. Remove the collinear triples

22C3−13C3−10C3{}^{22}C_3-{}^{13}C_3-{}^{10}C_3=1540−286−120=1134=1540-286-120=1134

Answer: option (2)

Example 68 (IITianForum). A rectangular board is divided into 55 rows and 77 columns of unit squares. How many rectangles on the board are not squares?

▸ SHOW SOLUTION

Step 1. All rectangles

66 horizontal and 88 vertical lines:

6C2⋅8C2=15⋅28=420{}^6C_2\cdot{}^8C_2=15\cdot28=420

Step 2. Squares

Side kk gives (6−k)(8−k)(6-k)(8-k) squares, k=1k=1 to 55:

35+24+15+8+3=8535+24+15+8+3=85

Answer: 420−85=335420-85=335

Example 69 (IITianForum). A path from (0,0)(0,0) to (6,4)(6,4) goes one unit right or one unit up at each step. How many such paths do not pass through the point (3,2)(3,2)?

▸ SHOW SOLUTION

Step 1. All paths

66 right and 44 up steps:

10C4=210{}^{10}C_4=210

Step 2. Paths through (3,2)(3,2)

(0,0)(0,0) to (3,2)(3,2), then (3,2)(3,2) to (6,4)(6,4):

5C2⋅5C2=100{}^5C_2\cdot{}^5C_2=100

Answer: 210−100=110210-100=110

Sum of numbers formed

Count each digit in each place

Add the numbers place by place. In a given place, find how many of the numbers have each digit there; the sum of that place is ∑(digit×count)\sum(\text{digit}\times\text{count}), and every place has the same sum when all arrangements are used.

DigitsSum of all numbers using all the digits once
nn distinct non-zero digits(n−1)! (sum of digits) (11⋯1)(n-1)!\,(\text{sum of digits})\,(11\cdots1) with nn ones
nn distinct digits including 00the above minus (n−2)! (sum of digits) (11⋯1)(n-2)!\,(\text{sum of digits})\,(11\cdots1) with n−1n-1 ones

Reason: with nn distinct digits, each digit is in a given place in (n−1)!(n-1)! numbers. With 00 among them, the arrangements that start with 00 are (n−1)(n-1)-digit numbers whose sum is the second term.

Example

Example 70 (JEE Main 2023, 10 Apr Shift 2). The sum of all the four-digit numbers that can be formed using all the digits 2,1,2,32,1,2,3 is equal to ______.

▸ SHOW SOLUTION

Step 1. How often each digit is in one place

Fix a place. Digit 22 there: the rest 1,2,31,2,3 in 3!=63!=6 ways. Digit 11 there: the rest 2,2,32,2,3 in 33 ways. Digit 33 there: the rest 2,2,12,2,1 in 33 ways.

Step 2. Sum of one place

2⋅6+1⋅3+3⋅3=242\cdot6+1\cdot3+3\cdot3=24

Step 3. All four places

24×1111=2666424\times1111=26664

Answer: 2666426664

Standard counts

CountValue
rr of nn distinct in a rownPr=n!(n−r)!{}^nP_r=\frac{n!}{(n-r)!}
rr of nn distinct, selectionnCr=n!r! (n−r)!{}^nC_r=\frac{n!}{r!\,(n-r)!}
nn objects, p,q,rp,q,r aliken!p! q! r!\frac{n!}{p!\,q!\,r!}
nn distinct round a table(n−1)!(n-1)!
nn distinct beads in a necklace (n≥3n\ge3)(n−1)!2\frac{(n-1)!}{2}
rr of nn round a tablenPrr\frac{{}^nP_r}{r}
derangements D1D_1 to D6D_60,1,2,9,44,2650,1,2,9,44,265
exactly kk in placenCk Dn−k{}^nC_k\,D_{n-k}
3m3m distinct into 33 equal groups(3m)!(m!)3 3!\frac{(3m)!}{(m!)^3\,3!}
3m3m distinct to 33 persons equally(3m)!(m!)3\frac{(3m)!}{(m!)^3}
rr distinct into nn distinct boxesnrn^r
rr distinct into 33 distinct boxes, none empty3r−3⋅2r+33^r-3\cdot2^r+3
rr identical into nn distinct boxesr+n−1Cn−1{}^{r+n-1}C_{n-1}
rr identical into nn distinct boxes, none emptyr−1Cn−1{}^{r-1}C_{n-1}
selections from p,q,rp,q,r alike, at least one(p+1)(q+1)(r+1)−1(p+1)(q+1)(r+1)-1
divisors of pa qbp^a\,q^b(a+1)(b+1)(a+1)(b+1)
lattice paths to (m,n)(m,n)m+nCm{}^{m+n}C_m
kk of nn in a row, no two consecutiven−k+1Ck{}^{n-k+1}C_k

Which counting rule to use

The question saysStart with
stages one after anothermultiply
separate cases (or)add, and check the cases do not overlap
arrange, order mattersnPr{}^nP_r, n!n! or nrn^r
choose, order does not matternCr{}^nC_r
chosen objects then put in a fixed ordernCr{}^nC_r only
repeated lettersn!p! q!\frac{n!}{p!\,q!}, or cases by the pattern of repeats
always togetherone block, then inside the block
never together, no two adjacentarrange the others, then the gaps
dictionary rank or positioncount words beginning with smaller letters
round tablefix one person, (n−1)!(n-1)!
necklace, garland(n−1)!(n-1)!, then halve
at least, at mostadd cases, or total minus the complement
identical objects to personsdots and bars r+n−1Cn−1{}^{r+n-1}C_{n-1}
distinct objects in groupsn!∏mi!\frac{n!}{\prod m_i!}, divide by k!k! for equal sizes
identical objects, identical boxeslist the partitions
every kind at least oncepatterns of repeats, or inclusion and exclusion
nobody in their own placederangement DnD_n
points, lines, polygonsnCr{}^nC_r, then remove the collinear cases
grid, shortest pathschoose lines, choose steps

What JEE asks

JEE Main asks one or two counting questions in every shift. In 2026 the frequent types were the lift and floors questions (Examples 1 and 50), the exponent of a prime in a factorial (Examples 5 and 6), words from a given word with or without repeats (Examples 7 and 10), digits with a divisibility condition (Examples 2 and 3), together and not together (Example 14), dictionary rank (Example 19), distributions of identical objects and integer solutions (Examples 42 and 43), properties of nCr{}^nC_r (Examples 37 and 38), every digit used at least once (Example 57) and triangles in a polygon (Example 65). The 2025 papers added numbers between two limits (Examples 4 and 45), the gap method (Examples 15 and 16) and selections with a forced order (Example 29).

JEE Advanced asks fewer but more careful questions: ratios of two counts (Examples 8 and 17), digits in an interval (Example 9), hats round a circle (Example 28), selections from boxes with conditions (Example 36), non-consecutive days (Example 35), rooms and teams with restrictions (Examples 55 and 56), distributions with an upper limit (Example 47), increasing integer solutions (Example 48), inclusion and exclusion on digits (Example 58) and derangements with one card fixed (Example 63).

Quick recall

ResultStatement
Multiplication, additionand multiplies, or adds
Exponent of pp in n!n![np]+[np2]+⋯\left[\frac np\right]+\left[\frac n{p^2}\right]+\cdots
Permutation, combinationnPr=nCr⋅r!{}^nP_r={}^nC_r\cdot r!
Togetherblock, (n−k+1)! k!(n-k+1)!\,k!
No two together(n−k)!⋅n−k+1Pk(n-k)!\cdot{}^{n-k+1}P_k
Round table, necklace(n−1)!(n-1)!, (n−1)!2\frac{(n-1)!}{2}
Pascal's rulenCr+nCr−1=n+1Cr{}^nC_r+{}^nC_{r-1}={}^{n+1}C_r
Divisors(a1+1)(a2+1)⋯(a_1+1)(a_2+1)\cdots
Integer solutionsr+n−1Cn−1{}^{r+n-1}C_{n-1}, positive r−1Cn−1{}^{r-1}C_{n-1}
Equal groupsdivide by k!k!
Onto, 33 boxes3r−3⋅2r+33^r-3\cdot2^r+3
DerangementDn=n!∑(−1)kk!D_n=n!\sum\frac{(-1)^k}{k!}
Exactly kk in placenCk Dn−k{}^nC_k\,D_{n-k}
Diagonals, crossingsn(n−3)2\frac{n(n-3)}{2}, nC4{}^nC_4
Lattice pathsm+nCm{}^{m+n}C_m
Before you leave this chapter

Without a pen, answer these four: the arrangements of the letters of LEVEL; the ways to seat 66 persons at a round table; the non-negative solutions of x+y+z=5x+y+z=5; and D4D_4. If 3030, 120120, 2121 and 99 came quickly, the chapter is in place.

Practise these methods on real exam questions in the doMath Permutations and Combinations chapter. Counting one-one and onto functions is worked out in the Functions note, subsets and the number of relations are in the Sets and Relations note, and sums of nCr{}^nC_r with powers of xx appear in the Binomial Theorem note.

[ SHARE ] WhatsApp
[ practice these chapters ]
Reinforce this post with live problems on doMath.
Sequences & SeriesPermutations & CombinationsProbability
← Back to all notes