Scroll To Bottom MathBin Diophantine Equation - Farm Animals Member

A farmer spent $100 to buy 100 animals of three different kinds. Each cow cost $10, each pig $3, and each sheep 50 cents. Assuming he bought at least one of each, how many of each animal did the farmer buy?

  Cows Pigs Sheep Total Goal
Count
Cost ($)
Sum ($)

Analysis

Note: Most of this analysis is from the book "Wheels, Life and other Mathematical Amusements" by Martin Gardner. I own this book and many other books by him.

There are two equations in three unknowns, where x is the number of cows, y the number of pigs, and z the number of sheep.

  1. x + y + z = 100
  2. 10x + 3y + z/2 = 100

Solve the first equation for z, and multiply the second equation by 2 to remove the fraction.

  1. z = 100 - x - y
  2. 20x + 6y + z = 200

Eliminate z from the second equation.

  1. z = 100 - x - y
  2. 19x + 5y = 100

Use continued fractions to find integral values of x and y.

  1. Put term with smallest coefficient (5) on left: 5y = 100 - 19x
  2. Divide both sides by 5: y = (100 - 19x)/5
  3. Divide each term and put remainder (if any) over 5 to form a terminal fraction

We now have: y = 20 - 3x - 4x/5. For x and y to be integers, x must have a positive value that makes 4x/5 an integer, so x must be a multiple of 5.

The one and only solution to this problem is when x = 5, y = 1, and z = 94. The means the farmer bought 5 cows, 1 pig, and 94 sheep for a cost of $10 * 5 + $3 * 1 + $0.50 * 94 = $50 + $3 + $47 = $100.

Question: Is there a solution if cows cost $5, pigs are $2, and sheep are $0.50? What if cows are $4, pigs are $2, and sheep are one-third of a dollar?