An old farmer had 3 sons and 17 horses.

When he died his will was read in the village meeting.

According to the will, the oldest son was to get half of the horses, the middle was to get one third of the horses and the youngest son was to get one ninth of the horses.

None of the villagers were able to divide the horses as the result was coming in fractions.

The sons started fighting on how to divide the horses and did not reach any agreement.

A traveling mathematician rode a horse to the village meeting at this point.

He heard the problem at hand and proposed a solution with which all the sons got their share in the property without harming any animal.

What was the solution and how was the group of horses divided?