**Example 1**. A customer bought a dozen pieces of fruit, apples and oranges, for ₹132. If an apple costs ₹3 more than an orange and more apples than oranges were purchased, how many pieces of each kind were bought?

**Example 2**. If a cock is worth 5 coins, a hen 3 coins, and three chicks together 1 coin, how many cocks, hens, and chicks, totaling 100, can be bought for 100 coins?

Of course, you can find the solution just below, but it is highly recommended that you first try to solve it on your own.

Just remember the words of Paul Halmos, who says “**the only way to learn mathematics is to do mathematics**”.

**Solution 1**. Let *x* be the number of apples and *y* be the number of oranges purchased; in addition, let *z* represent the cost of an orange. Then the conditions of the problem lead to

(*z* + 3)*x* + *zy* = 132 or equivalently 3*x* + (*x* + *y*)*z* = 132.

Because *x* + *y* = 12, the previous equation may be replaced by 3*x* + 12*z* = 132 which, in turn, simplifies to *x* + 4*z* = 44.

Now, our task is to find integers *x* and *z* satisfying the equation *x* + 4*z* = 44.

Since, gcd (1, 4) = 1 is a divisor of 44, there is a solution to this equation. Multiplying 1 = 1(−3) + 4 · 1 by 44, we get 44 = 1(−132) + 4 · 44, showing that *x*_{0} = −132, *z*_{0} = 44 serves as one solution. All other solutions are given by *x* = −132 + 4*t* and *z* = 44 – *t*, where *t* is an integer.

Since *x* > *y* and *x* + *y* = 12, we get 6 < *x* ≤ 12. It follows that

6 < −132 + 4*t* ≤ 12 or, 138 < 4*t* ≤ 144 or, 34.5 < *t* ≤ 36.

The only integral values of *t* to satisfy both inequalities are *t* = 35 and *t* = 36. When *t* = 35, we get (*x*, *y*, *z*) = (8, 4, 9) and when *t* = 36, we get (*x*, *y*, *z*) = (12, 0, 8). Thus, there can be two possible purchases: a dozen apples costing ₹11 per piece, or 8 apples at ₹12 each and 4 oranges at ₹9 each.

**Solution 2**. If *x* equals the number of cocks, *y* the number of hens and *z* the number of chicks, then5*x* + 3*y* + (*z*/3) = 100 or, 15*x* + 9*y* + *z* = 300 and *x* + *y* + *z* = 100.

Eliminating *z* using *z* = 100 − *x* − *y*, we have

15*x* + 9*y* + (100 − *x* − *y*) = 300 or, 7*x* + 4*y* = 100.

Since, gcd (7, 4) = 1 is a divisor of 100, there is a solution to this equation. Multiplying 1 = 7(−1) + 4 · 2 by 100, we get 100 = 7(−100) + 4 · 200, showing that *x*_{0} = −100, *z*_{0} = 200 serves as one solution.

This equation has the general solution *x* = 4*t*, *y* = 25 − 7*t*, so that *z* = 75 + 3*t*,

where *t* is an arbitrary integer.

For positive integer solutions, *t* must satisfy

4*t* > 0, 25 − 7*t* > 0 and 75 + 3*t* > 0 or, −25 < *t* < 25/7.

Since *t* is positive, we conclude that *t* = 1, 2, 3, leading to precisely the values*x* = 4, *y* = 18, *z* = 78; *x* = 8, *y* = 11, *z* = 81 and *x* = 12, *y* = 4, *z* = 84.