# How to Use the Hungarian Algorithm

The Hungarian algorithm allows a "minimum matching" to be found. This can be used in instances where there are multiple quotes for a group of activities and each activity must be done by a different person, to find the minimum cost to complete all of the activities.

## Steps

- 1
**Arrange your information in a matrix with the "people" on the left and the "activity" along the top, with the "cost" for each pair in the middle.** - 2
- 3
**Reduce the rows by subtracting the minimum value of each row from that row.** - 4
- 5
**Cover the zero elements with the minimum number of lines it is possible to cover them with.**(If the number of lines is equal to the number of rows then go to step 9) - 6
- 7
- 8
- 9
- 10
**Apply the matching to the original matrix, disregarding dummy rows.**This shows who should do which activity, and adding the costs will give the total minimum cost.

## Tips

- If you wish to find a maximum matching rather than a minimum, multiply each number by -1 in step 1, then follow the steps as written.

## Things You'll Need

- Paper
- Pen/pencil

## Article Info

Featured Article

Categories: Featured Articles | Mathematics