← 2026 Paper 2

UPSC 2026 Maths Optional Paper 2 Q3c — Step-by-Step Solution

15 marks · Section A

Assignment problem (Hungarian method) · Linear Programming · asked 7× in 14 yrs · Read the full method →

Question

The following table represents the estimated costs of assigning jobs to machines. Solve this assignment problem to minimize the total cost.

Job \ MachineM1M_1M2M_2M3M_3M4M_4
J1J_18242832
J2J_28131719
J3J_38151922

Is the assignment unique for the total minimum cost? Justify your answer and obtain an alternate assignment, if it exists.

Technique

The matrix is 3×43\times4 — unbalanced — so the Hungarian method does not apply until a dummy job (a fourth row of zeros) is added; the machine that receives the dummy job is the one left idle. Then run the Hungarian algorithm proper: row reduction, column reduction, minimum line cover, and the “subtract the smallest uncovered element, add it at the crossings” update, iterating until the minimum number of covering lines equals the order 44. Uniqueness is not answered by “the Hungarian gave one answer” — it is answered by counting the complete matchings available in the zero set of the final reduced matrix, and confirming the second assignment has the same cost.

Solution

Step 1 — Balance the problem.

An assignment problem requires a square matrix: a one-to-one correspondence between rows and columns. Here there are 33 jobs and 44 machines, so one machine must go unused. Introduce a dummy job J4J_4 (fictitious — it represents “no job at all”) with cost 00 against every machine, since a machine that is left idle incurs no assignment cost:

Job \ MachineM1M_1M2M_2M3M_3M4M_4row min
J1J_182428328
J2J_281317198
J3J_381519228
J4J_4 (dummy)00000

Operational meaning: whichever machine ends up paired with J4J_4 does no real work — that machine stays idle, and its “cost” 00 correctly contributes nothing to the total. This is the only legitimate balancing here; adding a dummy machine (a fifth column) would be wrong, since it is machines that are in surplus, not jobs.

Step 2 — Row reduction.

Subtract from each row its row minimum (this changes every assignment’s total by the same constant 8+8+8+0=248+8+8+0=24, hence does not change which assignment is optimal — that is the whole justification for the method, and it is worth one line):

M1M_1M2M_2M3M_3M4M_4
J1J_10162024
J2J_205911
J3J_3071114
J4J_40000

Step 3 — Column reduction.

Column minima are 0,0,0,00,0,0,0 (column M1M_1 from rows J1J_1–J3J_3, and the rest from row J4J_4). The matrix is unchanged. Note why: 88 is simultaneously the constant entry of column M1M_1 and the minimum of each of the first three rows, so the row step has already done the column-M1M_1 step.

Step 4 — Iteration 1: cover the zeros with the minimum number of lines.

M1M_1M2M_2M3M_3M4M_4line?
J1J_10162024—
J2J_205911—
J3J_3071114—
J4J_40000row line
line?col line———N=2N=2

Minimality check (König’s theorem: minimum lines == maximum number of independent zeros). The zeros are {(J1,M1),(J2,M1),(J3,M1)}∪{(J4,Mj)}j=14\{(J_1,M_1),(J_2,M_1),(J_3,M_1)\}\cup\{(J_4,M_j)\}_{j=1}^4. Rows J1,J2,J3J_1,J_2,J_3 each have their only zero in M1M_1, so at most one of them can be assigned; with J4J_4 that gives at most 22 independent zeros. Hence N=2N=2 is minimal, and N=2<4N=2<4: not yet optimal.

Smallest uncovered element (rows J1,J2,J3J_1,J_2,J_3 ×\times columns M2,M3,M4M_2,M_3,M_4): min⁡{16,20,24,5,9,11,7,11,14}=5\min\{16,20,24,5,9,11,7,11,14\}=5. Subtract 55 from every uncovered entry; add 55 at the crossing (J4,M1)(J_4,M_1); leave singly-covered entries alone.

Step 5 — Iteration 2.

M1M_1M2M_2M3M_3M4M_4line?
J1J_10111519—
J2J_20046row line
J3J_30269—
J4J_45000row line
line?col line———N=3N=3

Minimality: a maximum set of independent zeros is (J1,M1),(J2,M2),(J4,M3)(J_1,M_1),(J_2,M_2),(J_4,M_3) — size 33; it cannot be 44, because rows J1J_1 and J3J_3 both have their only zeros in column M1M_1 and cannot both be assigned. So N=3<4N=3<4: not yet optimal.

Smallest uncovered element (rows J1,J3J_1,J_3 ×\times columns M2,M3,M4M_2,M_3,M_4): min⁡{11,15,19,2,6,9}=2\min\{11,15,19,2,6,9\}=2. Subtract 22 from those; add 22 at the two crossings (J2,M1)(J_2,M_1) and (J4,M1)(J_4,M_1).

Step 6 — Iteration 3.

M1M_1M2M_2M3M_3M4M_4line?
J1J_1091317—
J2J_22046—
J3J_30047—
J4J_47000row line
line?col linecol line——N=3N=3

Minimality: maximum independent zeros =(J1,M1),(J2,M2),(J4,M3)=(J_1,M_1),(J_2,M_2),(J_4,M_3), size 33; J3J_3‘s zeros lie only in M1,M2M_1,M_2, both already used, and no rearrangement helps (J1J_1 is confined to M1M_1). So N=3<4N=3<4: not yet optimal.

Smallest uncovered element (rows J1,J2,J3J_1,J_2,J_3 ×\times columns M3,M4M_3,M_4): min⁡{13,17,4,6,4,7}=4\min\{13,17,4,6,4,7\}=4. Subtract 44 from those six entries; add 44 at the crossings (J4,M1)(J_4,M_1) and (J4,M2)(J_4,M_2).

Step 7 — Iteration 4: the optimal reduced matrix.

M1M_1M2M_2M3M_3M4M_4
J1J_109913
J2J_22002
J3J_30003
J4J_411400

Four independent zeros now exist, e.g. (J1,M1),(J2,M2),(J3,M3),(J4,M4)(J_1,M_1),(J_2,M_2),(J_3,M_3),(J_4,M_4), so the minimum cover needs N=4N=4 lines == order of the matrix. The algorithm terminates: this reduced matrix yields an optimal assignment.

Step 8 — Read off the assignment(s) and the cost.

Zero positions of the final matrix, listed by row:

J1:{M1},J2:{M2,M3},J3:{M1,M2,M3},J4:{M3,M4}.J_1:\{M_1\},\qquad J_2:\{M_2,M_3\},\qquad J_3:\{M_1,M_2,M_3\},\qquad J_4:\{M_3,M_4\}.

Row J1J_1 has a single zero, so J1→M1J_1\to M_1 is forced; column M1M_1 is then exhausted, leaving J3:{M2,M3}J_3:\{M_2,M_3\}. Enumerating the complete selections of independent zeros:

So the zero set supports exactly two complete assignments:

(A)J1→M1,  J2→M2,  J3→M3,  (J4→M4: M4 idle),\textbf{(A)}\quad J_1\to M_1,\; J_2\to M_2,\; J_3\to M_3,\; (J_4\to M_4:\ M_4 \text{ idle}), (B)J1→M1,  J2→M3,  J3→M2,  (J4→M4: M4 idle).\textbf{(B)}\quad J_1\to M_1,\; J_2\to M_3,\; J_3\to M_2,\; (J_4\to M_4:\ M_4 \text{ idle}).

Costs from the original table:

(A)  =  8+13+19  =  40,(B)  =  8+17+15  =  40.\text{(A)}\;=\;8+13+19\;=\;\mathbf{40},\qquad\qquad \text{(B)}\;=\;8+17+15\;=\;\mathbf{40}.

Equal, as they must be. Minimum total cost =40=40, with machine M4M_4 left idle in either plan.

Step 9 — Uniqueness: justified independently of the algorithm.

The Hungarian tableau exhibits two optima, but a complete justification should not rest on the bookkeeping. Two short arguments settle it outright.

(i) J1→M1J_1\to M_1 in every optimal assignment. Note c2j<c1jc_{2j}<c_{1j} and c3j<c1jc_{3j}<c_{1j} for every j∈{2,3,4}j\in\{2,3,4\} (row J1J_1 is strictly the dearest on all non-M1M_1 columns), while column M1M_1 is constant at 88. Suppose an optimal assignment gave M1M_1 to J2J_2 and put J1J_1 on some MaM_a, a≠1a\neq1. Exchanging the two changes the total by

(c1,1+c2,a)−(c2,1+c1,a)=(8+c2,a)−(8+c1,a)=c2,a−c1,a<0,\bigl(c_{1,1}+c_{2,a}\bigr)-\bigl(c_{2,1}+c_{1,a}\bigr)=\bigl(8+c_{2,a}\bigr)-\bigl(8+c_{1,a}\bigr)=c_{2,a}-c_{1,a}<0,

a strict improvement — contradicting optimality. The same computation rules out J3→M1J_3\to M_1. Finally, M1M_1 is used: if M1M_1 were the idle machine, move any one of the three jobs onto it from wherever it sits; the cost strictly falls, because in the original 3×43\times4 table every entry outside column M1M_1 is at least 13>813>8. Hence every optimum has J1→M1J_1\to M_1, contributing 88.

(ii) The residual 2×32\times3 problem. With J1J_1 fixed on M1M_1, the remaining choice is to place J2,J3J_2,J_3 on two distinct machines from {M2,M3,M4}\{M_2,M_3,M_4\}:

M2M_2M3M_3M4M_4
J2J_2131719
J3J_3151922

All six possibilities:

13+19=32,13+22=35,17+15=32,17+22=39,19+15=34,19+19=38.13+19=32,\quad 13+22=35,\quad 17+15=\mathbf{32},\quad 17+22=39,\quad 19+15=34,\quad 19+19=38 .

The minimum 3232 is attained exactly twice: (J2→M2, J3→M3)(J_2\to M_2,\ J_3\to M_3) and (J2→M3, J3→M2)(J_2\to M_3,\ J_3\to M_2). Adding the forced 88:

minimum total cost=8+32=40,attained by exactly two assignments.\text{minimum total cost}=8+32=40,\qquad\text{attained by exactly two assignments.} The optimal assignment is NOT unique.■\textbf{The optimal assignment is NOT unique.}\qquad\blacksquare

Step 10 — Why column M1M_1 being constant matters.

Every entry of column M1M_1 equals 88. Three consequences, each worth stating:

  1. 88 is therefore the minimum of every one of the first three rows, so the row-reduction step simultaneously performs the column reduction on M1M_1 — which is exactly why Step 3 produced no change and why the first line cover needed only 22 lines. The algorithm then had to grind through three update iterations.
  2. Because the column is constant, M1M_1 carries no information about which job should be put on it. The cost of an assignment using M1M_1 is 8+(cost of the other two jobs on two of M2,M3,M4)8+(\text{cost of the other two jobs on two of }M_2,M_3,M_4); the identity of the job sent to M1M_1 matters only through which jobs are left over. That is precisely the exchange argument of Step 9(i), and it is what makes J1J_1 — the job that is dearest everywhere else — the one to park on M1M_1.
  3. Since 88 is strictly below every entry outside column M1M_1, M1M_1 is used in every optimum; the idle machine is never M1M_1.

Step 11 — Sensitivity remark (one line, cheap, and shows the structure).

The two optima differ by the transposition of J2,J3J_2,J_3 between M2M_2 and M3M_3, and are tied because

c2,2+c3,3=13+19=32=17+15=c2,3+c3,2,c_{2,2}+c_{3,3}=13+19=32=17+15=c_{2,3}+c_{3,2},

i.e. the 2×22\times2 submatrix on rows {J2,J3}\{J_2,J_3\}, columns {M2,M3}\{M_2,M_3\} has vanishing cross-difference

c2,2+c3,3−c2,3−c3,2=13+19−17−15=0.c_{2,2}+c_{3,3}-c_{2,3}-c_{3,2}=13+19-17-15=0 .

(It is this quantity, not the determinant, that decides a 2×22\times2 assignment tie: the two admissible pairings differ in cost by exactly the cross-difference.) Perturb any one of those four entries and the tie breaks, leaving a unique optimum. This is the algebraic reason the alternate assignment exists — it is not a coincidence of the arithmetic.

Answer

  Minimum total cost=40.  \boxed{\;\text{Minimum total cost}=\mathbf{40}.\;}   (A)  J1→M1 (8),J2→M2 (13),J3→M3 (19);M4 idle(B)  J1→M1 (8),J2→M3 (17),J3→M2 (15);M4 idle  \boxed{\; \begin{aligned} &\textbf{(A)}\ \ J_1\to M_1\ (8),\quad J_2\to M_2\ (13),\quad J_3\to M_3\ (19);\quad M_4\ \text{idle} \\[2pt] &\textbf{(B)}\ \ J_1\to M_1\ (8),\quad J_2\to M_3\ (17),\quad J_3\to M_2\ (15);\quad M_4\ \text{idle} \end{aligned}\;}

The assignment is not unique: there are exactly two optimal assignments, (A) and (B), each of total cost 4040; (B) is the required alternate assignment. In both, machine M4M_4 is left idle.

We post more of this — worked solutions, CSAT trap breakdowns, guide chapters — a few times a week on Telegram. Free, no sign-in. Join

This solution is part of the Maths Coverage Map — 14 years, mapped. Get the take-away PDF free.