Question 7008
 A farmer buys 100 animals at a cost a total of $100. He buys hens for $0.50, 
pigs for $2.00, and sheep for $10.00 each.

 First of all, don't feel too bad because you could not solve it.

 Sol: Let x: # of hens, y: # of pigs, z = # of sheeps
      x + y + z =100 ...(1)
      0.5x + 2y + 10z = 100 ...Convert it to [No decimals ]
      x + 4y + 20 z = 200 ...(2) 

  This is a system of linear equations in 3 variables, while only two equations 
  of constraints are given. According to linear algebra, there are infinitely many solutions generally. (the solution space is a line)

 But, since x,y and z here are non-negative integers, so the possible 
 solutions must be finite (or no solutions. Note: 0 <= x,y,z <= 100 from eq. (1)

 Fortunately, you don't have to try all those 101 triples of possible solutions
 and so you would not be crazy.


  Now let's begin to look for nnenegative integer solutions for (1) and (2).

  Focus on the variable z (with the largest coefficient 10) , 
  By 0 <= 10 z <= 100,we see that 0 <= z <= 9 (cannot be 10,why ?)
  
  And, from (2) -(1), we get
  3y + 19 z = 100
  Thus, we have 3 y = 100 - 19z ...(3)
  So, 0 <= z <=5

 Begin to try:

 Try z = 0 , 3 y = 100
            we get y = 100/3. No,illegal

 Try z = 1, 3 y = 81
            So, y = 27, x = 72. Positive integers, OK 

 Try z = 2, 3 y = 100 - 38 = 62. No,illegal
 
 Try z = 3, 3 y = 100 - 57 = 43. No,illegal  
 
 Try z = 4, 3 y = 100 - 76 = 24. 
            So, y = 8, and x = 100 - y - z = 100 - 12 = 88. (OK)
 
 Try z = 5, 3 y = 100 - 95 = 5. No,illegal  

 Therefore, we obtain two sets of integer solutions (72,27,1) and (88, 8, 4).

 By the way, if you could not get equation as 3y + 19 z = 100, and so the  
 restriction 0 <= z <= 5.
 Then,you may have to exhaust trying all z from 0 to 9. 
 Anyway,be smart to have some basic feeling about integers, then you can solve 
 this question faster.

  If you have learned something related to linear algebra,then after you get
  one set of solution ,say (72, 27, 1)

 Then, use the following prametric equations concerning determinant:
  x -72    y -27    z -1
  ------ = ----- = -----  = t,
   16       -19     3  

 Or equivalently :
  x = 72 + 16 t,
  y = 27 - 19 t,
  z = 1 + 3 t.
 Since, 0 <= z <= 9, we have  0 <= t <= 2
  Also,note that y = 27 - 19 t >= 0, so 0 <= t <= 1.
  Try  t = 1, x = 88, y = 8, z = 4.  (OK.. and no more solutions)

 Kenny