PYQ Vault

JEE Mains Maths · Permutations and Combinations

Distributions and Integer Solutions

Sharing objects among people or boxes: identical objects (stars and bars, integer solutions with bounds) and distinct objects (onto maps, groups, partitions).

Why this matters

Seventeen PYQs, and 2024 alone has six. The first question is always whether the objects are identical and whether the boxes are distinct; that decides the method. Eleven share identical objects and six share distinct ones. Two ideas cover the page.

Concept 1 of 2: Identical objects: stars and bars

Sharing nn identical objects among kk people is the number of solutions of x1+⋯+xk=nx_1+\dots+x_k=n in non-negative integers: (n+k−1k−1)\binom{n+k-1}{k-1}. A lower bound is removed by substitution; an upper bound is handled by subtracting the cases that break it. When the boxes are identical too, only the partition of nn matters, so list the partitions.

Definition

  • xi≥0x_i\ge0: (n+k−1k−1)\binom{n+k-1}{k-1}; xi≥1x_i\ge1: (n−1k−1)\binom{n-1}{k-1}.
  • xi≥aix_i\ge a_i: put yi=xi−aiy_i=x_i-a_i.
  • Upper bound xi≤bx_i\le b: subtract solutions with xi≥b+1x_i\ge b+1.
  • A coefficient such as a+b+2c=Na+b+2c=N: fix cc and add.
  • Identical into identical boxes: partitions of nn.

Stars and bars

x1+⋯+xk=n, xi≥0:(n+k−1k−1)x_1+\cdots+x_k=n,\ x_i\ge0:\quad\binom{n+k-1}{k-1}

Animation · stars and bars, sharing identical sweets

Child 1x₁ = 4Child 2x₂ = 3Child 3x₃ = 5123456786 given (2 each), 6 left: y₁ + y₂ + y₃ = 6y = (2, 1, 3), so x = (4, 3, 5)x₁ + x₂ + x₃ = 12, each xᵢ at least 22 bar places out of 8: C(8, 2) = 28 ways
  1. Twelve sweets, three children: The sweets are identical, so only how many each child gets matters: x₁ + x₂ + x₃ = 12, each at least 2.
  2. Give each child 2 first: Put yᵢ = xᵢ − 2. That uses 6 sweets, and the 6 left are shared with no lower limit: y₁ + y₂ + y₃ = 6.
  3. Line them up with 2 bars: Sweets before the first bar go to child 1, between the bars to child 2, after the second bar to child 3. Here y = (2, 1, 3), so x = (4, 3, 5).
  4. Move the bars: Both bars at the front give y = (0, 0, 6): child 3 gets 8, the others 2 each. Each placing of the bars is one share.
  5. Count the placings: 6 sweets and 2 bars fill 8 places, and the 2 places for the bars decide the share: C(8, 2) = 28.

12 identical sweets, 3 children, each at least 2: y₁ + y₂ + y₃ = 6 in whole numbers 0 or more.

Worked example

In how many ways can 12 identical sweets be shared among 3 children, each getting at least 2?
Practise this conceptself-check · 4 quick reps

The same idea in a real exam question:

JEE Mains · 2024 · 31 January 2024 · Q151Moderate

Example 1 · Permutations and Combinations · Distributions and Integer Solutions

The number of ways in which 21 identical apples can be distributed among three children such that each child gets at least 2 apples, is

Distinct values are a separate count

'x,y,zx,y,z distinct' is not built into stars and bars. Count all solutions, then subtract those with two or three equal values, using inclusion–exclusion.

Concept 2 of 2: Distinct objects: onto maps and groups

Each of nn distinct objects chooses one of kk distinct boxes: knk^n ways. If no box may be empty, subtract by inclusion–exclusion: ∑j(−1)j(kj)(k−j)n\sum_{j}(-1)^j\binom kj(k-j)^n. Splitting into groups of given sizes is n!a! b!⋯\frac{n!}{a!\,b!\cdots}, divided by the factorial of the number of equal-sized groups if the groups are unlabelled.

Definition

  • Onto maps: kn−(k1)(k−1)n+(k2)(k−2)n−⋯k^n-\binom k1(k-1)^n+\binom k2(k-2)^n-\cdots.
  • Groups of sizes a,b,ca,b,c (labelled): n!a! b! c!\frac{n!}{a!\,b!\,c!}.
  • Unlabelled equal groups: divide by the factorial of how many are equal.
  • Into kk identical boxes: sum of Stirling numbers S(n,1)+⋯+S(n,k)S(n,1)+\dots+S(n,k).

Onto maps

∑j=0k(−1)j(kj)(k−j)n\sum_{j=0}^{k}(-1)^j\binom kj(k-j)^n

Worked example

In how many ways can 4 different balls go into 2 different boxes with neither empty?
Practise this conceptself-check · 4 quick reps

The same idea in a real exam question:

JEE Mains · 2026 · 8 Apr 2026 Shift 2 · Q59Moderate

Example 2 · Permutations and Combinations · Distributions and Integer Solutions

A person has three different bags and four different books. The number of ways, in which he can put these books in the bags so that no bag is empty, is

Labelled or unlabelled

Cars of different makes are labelled, so which car gets 2 people matters. Unnamed groups of equal size are not: divide by the ways to permute those groups.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (2)

Watch out for (2)

Test yourself on Permutations and Combinations

20 past JEE Mains questions from this chapter, timed at 48 minutes and marked the way the exam marks it. You see your score and every answer the moment you finish. Free to start.