Strategic Cost Management · Assignment
Hungarian Method for Minimization in Assignment Problems
Updated 11 October 2026 · Fact-checked
The Hungarian method finds the minimum-cost one-to-one assignment of jobs to persons in a square cost matrix. Subtract each row's smallest value, then each column's smallest value. Cover all zeros with the fewest lines. If lines equal n, assign on zeros. If not, revise the matrix and repeat.
Understand Hungarian Method for Minimization
An assignment problem has n persons and n jobs. Each person does exactly one job and each job goes to exactly one person. The cost of every pairing is given in a square matrix. You must choose the pairing with the lowest total cost.
The Hungarian method works because of one fact: if you subtract the same amount from every cell in a row or column, the best assignment does not change. Only the total cost shifts by that amount. So you keep subtracting until zeros appear. A zero cell is a free pairing in the reduced matrix.
If you can pick n zeros so that no two share a row or column, those zeros give the optimal assignment. The cost of that assignment is then found from the original matrix, not the reduced one.
Sometimes the zeros are not enough. You may have fewer than n independent zeros. Then you draw the minimum number of straight lines through all zeros. If the lines are fewer than n, you revise the matrix to create new zeros and test again.
The method as written applies to a square matrix and a minimization problem. Unbalanced and maximization cases are first converted into this form.
Key rules to remember
- Row reduction
- New cost = cost − smallest value in that row
- Do this for every row. Each row now has at least one zero.
- Column reduction
- New cost = cost − smallest value in that column
- Do this on the row-reduced matrix. Skip a column that already has a zero, because its minimum is 0.
- Optimality test
- Minimum number of lines covering all zeros = n ⇒ optimal assignment exists
- If the lines are fewer than n, the solution is not yet optimal. Revise the matrix.
- Matrix revision
- k = smallest uncovered element; uncovered cells: subtract k; cells at line intersections: add k; cells covered once: unchanged
- Repeat the line-covering test after each revision.
- Total minimum cost
- Total cost = Σ original cost of the assigned cells
- Read the costs from the original matrix. Never add up the reduced values.
How to solve Hungarian Method for Minimization questions
Use this method for any minimization assignment question. First make sure the matrix is square and the objective is minimum cost.
- 1Check that the number of rows equals the number of columns. If not, add a dummy row or column of zeros. If the objective is maximization, convert it first.
- 2Row reduction: subtract the smallest element of each row from every element of that row.
- 3Column reduction: in the new matrix, subtract the smallest element of each column from every element of that column.
- 4Cover all zeros with the minimum number of horizontal and vertical lines. A tick method helps: tick rows with no assignment, tick columns with zeros in ticked rows, tick rows with assignments in ticked columns, and repeat. Then draw lines through unticked rows and ticked columns.
- 5If the number of lines equals n, go to step 7. If fewer than n, find the smallest uncovered element k.
- 6Subtract k from every uncovered element and add k to every element at a line intersection. Leave the other covered elements as they are. Go back to step 4.
- 7Make the assignment. Start with a row or column that has a single zero, allot it, and strike out the rest of that row and column. Repeat. If there is a tie, choose any zero and continue.
- 8Write the pairings and add their costs from the original matrix to get the minimum total cost.
Quickest way: Single-zero first, then check by reductions
When to use it: Use this in the exam for 4×4 or 5×5 matrices when time is short and you need a reliable check on your answer.
- Do row and column reduction in one pass on rough work. Note the total of all subtracted values.
- Mark zeros and assign single-zero rows and columns first. If you reach n assignments, stop. No lines are needed.
- If you cannot reach n, draw lines with the tick method. Do not guess the lines.
- For each revision, note k × (n − number of lines). Add these amounts to the total of the row and column reductions.
- Use this check: the total of the row and column reductions, plus k × (n − number of lines) for each revision, must equal the minimum cost taken from the original matrix. If they differ, you made an arithmetic slip. With no revision, the sum of the reductions alone equals the cost.
Common mistakes in Hungarian Method for Minimization
Adding up the reduced matrix values to get the total cost.
The assigned cells show zeros or small numbers and students add what they see.
Fix: Go back to the original matrix. Write each pairing with its original cost and add those costs.
Doing column reduction before row reduction, or skipping it altogether.
Students think one round of zeros is enough.
Fix: Do rows first, then columns. Column reduction can create zeros in a column that had none, so it often changes the answer.
Drawing more lines than needed, or lines that miss a zero.
Students cover zeros by eye and do not check whether the count is minimum.
Fix: Use the tick method. Count the lines. Compare with n before deciding whether to revise.
Revising the matrix wrongly: subtracting k from covered cells or forgetting to add k at intersections.
The rule has three cases and students mix them up.
Fix: Uncovered: subtract k. Covered twice (intersection): add k. Covered once: leave unchanged. Check that the total of the matrix is consistent.
Allotting a zero in a row or column that still has other zeros, and then getting stuck.
Students pick the first zero they see.
Fix: Always assign rows or columns that have only one unassigned zero first. Pick freely only when every remaining row and column has two or more zeros.
Applying the method to a non-square matrix.
Students start reducing without counting rows and columns.
Fix: Check the matrix size first. Add a dummy row or column with zero cost to make it square.
Worked examples
Example 1
Four jobs P, Q, R and S are to be assigned to four workers A, B, C and D, one job each. The cost (₹ '000) is: A: 12, 10, 14, 11; B: 15, 13, 16, 14; C: 11, 12, 15, 13; D: 14, 11, 13, 10 (in order P, Q, R, S). Find the assignment with minimum total cost.
Show the solution
- Row minima: A = 10, B = 13, C = 11, D = 10. After row reduction: A: 2, 0, 4, 1; B: 2, 0, 3, 1; C: 0, 1, 4, 2; D: 4, 1, 3, 0.
- Column minima: P = 0, Q = 0, R = 3, S = 0. After column reduction: A: 2, 0, 1, 1; B: 2, 0, 0, 1; C: 0, 1, 1, 2; D: 4, 1, 0, 0.
- Check the zeros. A has one zero (Q). C has one zero (P). B has zeros in Q and R. D has zeros in R and S.
- Assign A to Q and C to P. This leaves B with R only, since Q is taken. Then D gets S. Four independent zeros exist, so four lines are needed and the solution is optimal.
- Costs from the original matrix: A–Q = 10, B–R = 16, C–P = 11, D–S = 10. Total = 10 + 16 + 11 + 10 = 47.
- Check: the sum of reductions is 10 + 13 + 11 + 10 + 3 = 47, which matches.
Answer: A–Q, B–R, C–P, D–S; minimum total cost = ₹47,000.
Example 2
Four machines A, B, C and D are to be allotted to four operations 1, 2, 3 and 4, one each. The cost (₹ '000) is: A: 10, 14, 14, 15; B: 8, 10, 15, 12; C: 15, 12, 13, 14; D: 14, 12, 12, 9 (in order 1, 2, 3, 4). Find the minimum-cost assignment.
Show the solution
- Row minima: A = 10, B = 8, C = 12, D = 9. After row reduction: A: 0, 4, 4, 5; B: 0, 2, 7, 4; C: 3, 0, 1, 2; D: 5, 3, 3, 0.
- Column minima: 1 = 0, 2 = 0, 3 = 1, 4 = 0. Only column 3 changes. After column reduction: A: 0, 4, 3, 5; B: 0, 2, 6, 4; C: 3, 0, 0, 2; D: 5, 3, 2, 0.
- Cover the zeros. Column 1 holds the zeros of A and B. Row C holds its two zeros. Row D holds its zero. Minimum lines = 3, which is less than n = 4. The solution is not optimal.
- The uncovered elements are in rows A and B, columns 2, 3 and 4: 4, 3, 5 and 2, 6, 4. The smallest is k = 2.
- Subtract 2 from the uncovered elements. Add 2 at the intersections (C, column 1) and (D, column 1). The revised matrix is: A: 0, 2, 1, 3; B: 0, 0, 4, 2; C: 5, 0, 0, 2; D: 7, 3, 2, 0.
- Test again. The zeros need four lines, so the solution is optimal. A has a single zero in column 1, so A–1. D has a single zero in column 4, so D–4. B then takes 2, and C takes 3.
- Original costs: A–1 = 10, B–2 = 10, C–3 = 13, D–4 = 9. Total = 10 + 10 + 13 + 9 = 42.
- Check: reductions total 10 + 8 + 12 + 9 + 1 = 40. The revision adds k × (n − lines) = 2 × (4 − 3) = 2. So 40 + 2 = 42.
Answer: A–1, B–2, C–3, D–4; minimum total cost = ₹42,000.
Exam tips
- Show every matrix: after row reduction, after column reduction, and after each revision. Marks are given for method even if the final cost slips.
- Always state the number of lines and compare it with n in one sentence. This is the proof that you have tested optimality.
- Write the final cost from the original matrix as a sum, such as 10 + 10 + 13 + 9 = 42. Do not leave only the pairings.
- If the question gives a case scenario, state the recommendation in words: who should do which job and the total cost. A numerical answer alone loses application marks.
- In the MCQs, the question may give a reduced matrix and ask for the smallest uncovered element or the number of lines. Practise reading these off quickly.
Practice questions from Assignment
- Three workers A, B and C are to be assigned one each to jobs 1, 2 and 3. The cost in ₹ thousand is: A: 8, 6, 10; B: 9, 12, 7; C: 11, 9, 8 (f…
- Three operators W1, W2 and W3 are available for four jobs J1 to J4; each operator can do only one job and one job will remain undone. Costs …
- Three workers W1, W2, W3 are available for four jobs J1 to J4, and each worker can take at most one job; one job stays unassigned. Costs (Rs…
- A firm assigns salesmen P, Q, R one each to territories X, Y, Z to maximise monthly profit (Rs thousand). Profits for X, Y, Z: P: 40, 35, 25…
- A works manager has 5 operators and only 4 jobs, each operator can do any job, and the cost of every operator-job pair is known. Before appl…
Hungarian Method for Minimization in other exams
The same ground in other exams, if you are preparing for more than one or want another angle on it.
Hungarian Method for Minimization: frequently asked questions
What is the Hungarian method in an assignment problem?
It is a step-by-step algorithm for finding the minimum-cost one-to-one assignment in a square cost matrix. You reduce rows and columns to create zeros, test with covering lines, and revise the matrix if needed. It always ends with an optimal assignment.
How do I know the Hungarian method has reached the optimum?
The minimum number of lines needed to cover all zeros must equal n, the order of the matrix. Then you can choose n zeros, one in each row and each column. If the lines are fewer than n, revise the matrix and test again.
Do I find the total cost from the reduced matrix or the original matrix?
Use the original matrix. The reduced matrix only shows where to assign. Add the original costs of the chosen cells to get the total.
What if there are several ways to assign the zeros?
Then the problem has alternative optimal solutions. Each one gives the same total cost. In the exam, one valid assignment is enough unless the question asks for all.