These problems belong to the hundred-animal family: buying a fixed number of animals of three types while spending exactly a given amount. Finding numbers that match the cost is not enough: the counts must be integers, non-negative, and also match the required total. We will develop a procedure that finds every solution or proves that there are none.
The general method, explained step by step
To understand when ax + by = c has integer solutions, how to find Bézout’s identity and how to obtain every solution, read Linear Diophantine equations: theory and example with extended Euclid.
Open the general Diophantine-equation laboratory: enter the three integer coefficients a, b and c and follow the divisions, substitutions and constraints without skipping any steps.
For hundred-animal problems, after eliminating z and clearing denominators, enter A, B and C from Ax + By = C in the laboratory’s a, b and c fields. Then recover z = N - x - y and also check z ≥ 0, or z ≥ 1 if at least one animal of each type is required: the general laboratory only imposes constraints on x and y.

1. From a story to two equations
Let N be the total number of animals, S the available sum, a, b, c the three unit prices, and x, y, z the corresponding counts. The order matters: always read a triple (x, y, z) in the same order as the prices.
x + y + z = Nax + by + cz = S
The first equation gives z = N - x - y. Substitute into the second:ax + by + c(N - x - y) = S(a - c)x + (b - c)y = S - cN.
Here is the practical idea: buying all N animals at price c would cost cN. Each animal of the first type adds a - c to that cost, and each animal of the second adds b - c. These increases must cover exactly S - cN.
If fractions appear, multiply the entire equation by the least common multiple of the price denominators and, if needed, the denominator of S. This gives A x + B y = C with integer coefficients, without rounding. Finally, always recover z = N - x - y.
Collection rule: all 20 problems have N = S = 100. Non-negative integer counts are allowed. If we require at least one animal of each type, impose x, y, z ≥ 1 instead: some solutions will be excluded. Do not confuse these two requirements.
2. Gcd, congruences and bounds: the systematic method
- Check the budget first. For positive prices, we must have
N × min(a,b,c) ≤ S ≤ N × max(a,b,c). Outside that interval the problem is impossible; being inside it does not yet guarantee a solution. - Eliminate z and fractions. Obtain
A x + B y = C. - Calculate d = gcd(|A|,|B|). If
ddoes not divideC, no integer pair exists. Otherwise divide byd:A′x + B′y = C′, with coprime coefficients. - Find the residue class of x. For
B′ > 0, considerA′x ≡ C′ (mod B′). Two numbers are congruent when they have the same remainder on division byB′. The termB′ydisappears because it is a multiple ofB′. - Use an inverse or Euclid’s algorithm. Since the coefficients are coprime, the extended Euclidean algorithm finds
u, vwithA′u + B′v = 1. Multiply the congruence byuto getx ≡ uC′ (mod B′). If the remainder isr, all candidates arex = r + kB′. IfB′ = 1, every integer belongs to the same class: the congruence does not restrictx. - Apply the constraints. Calculate
y = (C - Ax)/Bandz = N - x - y, then impose the required non-negativity or positivity. Parameter bounds, not random trial and error, decide which candidates remain. - Check both equations. For each triple, check the total number of animals and the exact cost. The parameter interval ensures that no other solutions have been missed.
How do we actually find the inverse? If the reduced coefficients are 31 and 7, divide with remainders: 31 = 4 × 7 + 3, then 7 = 2 × 3 + 1. Work backwards, substituting for the remainder 3: 1 = 7 - 2 × 3 = 7 - 2 × (31 - 4 × 7) = 9 × 7 - 2 × 31. Thus -2, or equivalently 5, is an inverse of 31 modulo 7. It is not guessed: it is obtained by working backwards through Euclid’s divisions.
In this collection a > b > c, hence A > B > 0. From Ax + By = C we obtain an initial bound 0 ≤ x ≤ ⌊C/A⌋. The symbol ⌊ ⌋ means rounding down. We must also check z: the reduced cost equation alone does not automatically enforce every constraint.
Want a complete example? Open problem 1’s solution: it shows every step of the hundred-pig problem, from substitution to checking the triple. We keep it hidden with the others so you can try first.
3. The general solution: a family and an interval
When (A,B) ≠ (0,0) and d divides C, the extended Euclidean algorithm finds u, v such that Au + Bv = d. A particular solution is x₀ = u(C/d), y₀ = v(C/d). It does not matter if it is negative: it is a starting point.
All integer pairs, and only those pairs, are:x = x₀ + (B/d)ky = y₀ - (A/d)kz = N - x₀ - y₀ + ((A - B)/d)k
where k is an integer. Varying k traverses the whole family, not just a sample.
Set m = 0 if an absent type is allowed, or m = 1 if all three types are required. Each constraint has the form q + tk ≥ m. If t > 0, it gives k ≥ ⌈(m - q)/t⌉; if t < 0, it gives k ≤ ⌊(m - q)/t⌋. If t = 0, we must already have q ≥ m. The symbol ⌈ ⌉ means rounding up.
Take the largest lower bound and the smallest upper bound. If k_min > k_max, no triple is admissible. Otherwise use every integer from k_min to k_max: there are k_max - k_min + 1 solutions. This general criterion also works when the prices are not listed in order.
Equal prices: do not divide by zero. If B = 0 and A ≠ 0, solve Ax = C: C/A must be an integer at least m. Then distribute N - x between y and z, each at least m. If A = 0 and B ≠ 0, do the same with y fixed. If A = B = 0, all three prices are equal: for C ≠ 0 there are no solutions; for C = 0, every integer triple with x + y + z = N and the required bounds works. In this last case there are two free quantities, not just one parameter.
4. When no solution exists
First obstacle: the gcd. A variant with 100 animals, 100 coins and prices 7/2, 2, 1/2 gives 6x + 3y = 100. The left side is always a multiple of 3; 100 is not. Therefore no integer solution is possible.
Second obstacle: the counts. Consider horses at 15 coins, donkeys at 5 and sheep at 1/2, again with 100 animals and 100 coins. We obtain 29x + 9y = 100. The gcd is 1, so integer pairs exist. However, 2x ≡ 1 (mod 9) implies x ≡ 5 (mod 9), while y ≥ 0 requires 0 ≤ x ≤ 3. No integer in that class lies in the interval: there is no admissible solution.
For example, x = 5 would give y = -5 and z = 100: both equations hold, but buying minus five donkeys makes no sense. The gcd decides existence among integers; the constraints decide existence in the actual problem.
5. The 20 problems: try first, then reveal the solution
In every problem, buy exactly 100 animals and spend exactly 100 coins. Each listed price is for one animal. Find every non-negative triple, in the stated type order; then check which remain if you want at least one of each type. Press “Show solution and method” to open or close an answer: JavaScript is not required.
The hundred pigs
The three types are boars, sows, piglets. Their unit prices, in the same order, are
10, 5, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10010 × x + 5 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
19x + 9y = 100. The gcd is 1; dividing by 1 leaves19x + 9y = 100.20x + 10y + 1z = 20020x + 10y + 1(100 - x - y) = 2003. Reduce modulo 9: 19x ≡ 100 (mod 9). Bézout’s identity
19 × (1) + 9 × (-2) = 1shows that(1)is an inverse of 19 modulo 9. Hence x ≡(1)× 100 ≡ 1 (mod 9). All candidates are x = 1 + 9k, with integer k.4. From y ≥ 0 we obtain x ≤ 5. Substituting the family into the other counts gives
x = 1 + 9k,y = 9 - 19k,z = 90 + 10k. The constraints become1 + 9k ≥ 0 → k ≥ 0;9 - 19k ≥ 0 → k ≤ 0;90 + 10k ≥ 0 → k ≥ -9. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are1. This interval exhausts all possibilities.5. Every solution, in the stated order
boars (x) sows (y) piglets (z) Total animals Cost check 1 9 90 100 1 × 10 + 9 × 5 + 90 × 1/2 = 100(1, 9, 90)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
The hundred chickens
The three types are roosters, hens, chicks. Their unit prices, in the same order, are
5, 3, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1005 × x + 3 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
14x + 8y = 200. The gcd is 2; dividing by 2 leaves7x + 4y = 100.15x + 9y + 1z = 30015x + 9y + 1(100 - x - y) = 3003. Reduce modulo 4: 7x ≡ 100 (mod 4). Bézout’s identity
7 × (3) + 4 × (-5) = 1shows that(3)is an inverse of 7 modulo 4. Hence x ≡(3)× 100 ≡ 0 (mod 4). All candidates are x = 0 + 4k, with integer k.4. From y ≥ 0 we obtain x ≤ 14. Substituting the family into the other counts gives
x = 0 + 4k,y = 25 - 7k,z = 75 + 3k. The constraints become0 + 4k ≥ 0 → k ≥ 0;25 - 7k ≥ 0 → k ≤ 3;75 + 3k ≥ 0 → k ≥ -25. Intersecting the three bounds gives0 ≤ k ≤ 3. The allowed x values are0, 4, 8, 12. This interval exhausts all possibilities.5. Every solution, in the stated order
roosters (x) hens (y) chicks (z) Total animals Cost check 0 25 75 100 0 × 5 + 25 × 3 + 75 × 1/3 = 1004 18 78 100 4 × 5 + 18 × 3 + 78 × 1/3 = 1008 11 81 100 8 × 5 + 11 × 3 + 81 × 1/3 = 10012 4 84 100 12 × 5 + 4 × 3 + 84 × 1/3 = 100(0, 25, 75); (4, 18, 78); (8, 11, 81); (12, 4, 84)There are 4 non-negative solutions. If we require at least one animal of each type, 3 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Cows, sheep, goats
The three types are cows, sheep, goats. Their unit prices, in the same order, are
10, 3, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10010 × x + 3 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
19x + 5y = 100. The gcd is 1; dividing by 1 leaves19x + 5y = 100.20x + 6y + 1z = 20020x + 6y + 1(100 - x - y) = 2003. Reduce modulo 5: 19x ≡ 100 (mod 5). Bézout’s identity
19 × (4) + 5 × (-15) = 1shows that(4)is an inverse of 19 modulo 5. Hence x ≡(4)× 100 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.4. From y ≥ 0 we obtain x ≤ 5. Substituting the family into the other counts gives
x = 0 + 5k,y = 20 - 19k,z = 80 + 14k. The constraints become0 + 5k ≥ 0 → k ≥ 0;20 - 19k ≥ 0 → k ≤ 1;80 + 14k ≥ 0 → k ≥ -5. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are0, 5. This interval exhausts all possibilities.5. Every solution, in the stated order
cows (x) sheep (y) goats (z) Total animals Cost check 0 20 80 100 0 × 10 + 20 × 3 + 80 × 1/2 = 1005 1 94 100 5 × 10 + 1 × 3 + 94 × 1/2 = 100(0, 20, 80); (5, 1, 94)There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Peacocks, pigeons, sparrows
The three types are peacocks, pigeons, sparrows. Their unit prices, in the same order, are
8, 2, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1008 × x + 2 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
31x + 7y = 300. The gcd is 1; dividing by 1 leaves31x + 7y = 300.32x + 8y + 1z = 40032x + 8y + 1(100 - x - y) = 4003. Reduce modulo 7: 31x ≡ 300 (mod 7). Bézout’s identity
31 × (5) + 7 × (-22) = 1shows that(5)is an inverse of 31 modulo 7. Hence x ≡(5)× 300 ≡ 2 (mod 7). All candidates are x = 2 + 7k, with integer k.4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives
x = 2 + 7k,y = 34 - 31k,z = 64 + 24k. The constraints become2 + 7k ≥ 0 → k ≥ 0;34 - 31k ≥ 0 → k ≤ 1;64 + 24k ≥ 0 → k ≥ -2. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are2, 9. This interval exhausts all possibilities.5. Every solution, in the stated order
peacocks (x) pigeons (y) sparrows (z) Total animals Cost check 2 34 64 100 2 × 8 + 34 × 2 + 64 × 1/4 = 1009 3 88 100 9 × 8 + 3 × 2 + 88 × 1/4 = 100(2, 34, 64); (9, 3, 88)There are 2 non-negative solutions. If we require at least one animal of each type, 2 remain.
Tuna, sea bream, sardines
The three types are tuna, sea bream, sardines. Their unit prices, in the same order, are
12, 4, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10012 × x + 4 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
23x + 7y = 100. The gcd is 1; dividing by 1 leaves23x + 7y = 100.24x + 8y + 1z = 20024x + 8y + 1(100 - x - y) = 2003. Reduce modulo 7: 23x ≡ 100 (mod 7). Bézout’s identity
23 × (4) + 7 × (-13) = 1shows that(4)is an inverse of 23 modulo 7. Hence x ≡(4)× 100 ≡ 1 (mod 7). All candidates are x = 1 + 7k, with integer k.4. From y ≥ 0 we obtain x ≤ 4. Substituting the family into the other counts gives
x = 1 + 7k,y = 11 - 23k,z = 88 + 16k. The constraints become1 + 7k ≥ 0 → k ≥ 0;11 - 23k ≥ 0 → k ≤ 0;88 + 16k ≥ 0 → k ≥ -5. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are1. This interval exhausts all possibilities.5. Every solution, in the stated order
tuna (x) sea bream (y) sardines (z) Total animals Cost check 1 11 88 100 1 × 12 + 11 × 4 + 88 × 1/2 = 100(1, 11, 88)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Horses, donkeys, lambs
The three types are horses, donkeys, lambs. Their unit prices, in the same order, are
4, 3, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1004 × x + 3 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
15x + 11y = 300. The gcd is 1; dividing by 1 leaves15x + 11y = 300.16x + 12y + 1z = 40016x + 12y + 1(100 - x - y) = 4003. Reduce modulo 11: 15x ≡ 300 (mod 11). Bézout’s identity
15 × (3) + 11 × (-4) = 1shows that(3)is an inverse of 15 modulo 11. Hence x ≡(3)× 300 ≡ 9 (mod 11). All candidates are x = 9 + 11k, with integer k.4. From y ≥ 0 we obtain x ≤ 20. Substituting the family into the other counts gives
x = 9 + 11k,y = 15 - 15k,z = 76 + 4k. The constraints become9 + 11k ≥ 0 → k ≥ 0;15 - 15k ≥ 0 → k ≤ 1;76 + 4k ≥ 0 → k ≥ -19. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are9, 20. This interval exhausts all possibilities.5. Every solution, in the stated order
horses (x) donkeys (y) lambs (z) Total animals Cost check 9 15 76 100 9 × 4 + 15 × 3 + 76 × 1/4 = 10020 0 80 100 20 × 4 + 0 × 3 + 80 × 1/4 = 100(9, 15, 76); (20, 0, 80)There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Oxen, goats, chicks
The three types are oxen, goats, chicks. Their unit prices, in the same order, are
7, 2, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1007 × x + 2 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
13x + 3y = 100. The gcd is 1; dividing by 1 leaves13x + 3y = 100.14x + 4y + 1z = 20014x + 4y + 1(100 - x - y) = 2003. Reduce modulo 3: 13x ≡ 100 (mod 3). Bézout’s identity
13 × (1) + 3 × (-4) = 1shows that(1)is an inverse of 13 modulo 3. Hence x ≡(1)× 100 ≡ 1 (mod 3). All candidates are x = 1 + 3k, with integer k.4. From y ≥ 0 we obtain x ≤ 7. Substituting the family into the other counts gives
x = 1 + 3k,y = 29 - 13k,z = 70 + 10k. The constraints become1 + 3k ≥ 0 → k ≥ 0;29 - 13k ≥ 0 → k ≤ 2;70 + 10k ≥ 0 → k ≥ -7. Intersecting the three bounds gives0 ≤ k ≤ 2. The allowed x values are1, 4, 7. This interval exhausts all possibilities.5. Every solution, in the stated order
oxen (x) goats (y) chicks (z) Total animals Cost check 1 29 70 100 1 × 7 + 29 × 2 + 70 × 1/2 = 1004 16 80 100 4 × 7 + 16 × 2 + 80 × 1/2 = 1007 3 90 100 7 × 7 + 3 × 2 + 90 × 1/2 = 100(1, 29, 70); (4, 16, 80); (7, 3, 90)There are 3 non-negative solutions. If we require at least one animal of each type, 3 remain.
Deer, hares, rabbits
The three types are deer, hares, rabbits. Their unit prices, in the same order, are
8, 6, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1008 × x + 6 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
15x + 11y = 100. The gcd is 1; dividing by 1 leaves15x + 11y = 100.16x + 12y + 1z = 20016x + 12y + 1(100 - x - y) = 2003. Reduce modulo 11: 15x ≡ 100 (mod 11). Bézout’s identity
15 × (3) + 11 × (-4) = 1shows that(3)is an inverse of 15 modulo 11. Hence x ≡(3)× 100 ≡ 3 (mod 11). All candidates are x = 3 + 11k, with integer k.4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives
x = 3 + 11k,y = 5 - 15k,z = 92 + 4k. The constraints become3 + 11k ≥ 0 → k ≥ 0;5 - 15k ≥ 0 → k ≤ 0;92 + 4k ≥ 0 → k ≥ -23. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are3. This interval exhausts all possibilities.5. Every solution, in the stated order
deer (x) hares (y) rabbits (z) Total animals Cost check 3 5 92 100 3 × 8 + 5 × 6 + 92 × 1/2 = 100(3, 5, 92)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Geese, ducks, chicks
The three types are geese, ducks, chicks. Their unit prices, in the same order, are
10, 4, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10010 × x + 4 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
29x + 11y = 200. The gcd is 1; dividing by 1 leaves29x + 11y = 200.30x + 12y + 1z = 30030x + 12y + 1(100 - x - y) = 3003. Reduce modulo 11: 29x ≡ 200 (mod 11). Bézout’s identity
29 × (8) + 11 × (-21) = 1shows that(8)is an inverse of 29 modulo 11. Hence x ≡(8)× 200 ≡ 5 (mod 11). All candidates are x = 5 + 11k, with integer k.4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives
x = 5 + 11k,y = 5 - 29k,z = 90 + 18k. The constraints become5 + 11k ≥ 0 → k ≥ 0;5 - 29k ≥ 0 → k ≤ 0;90 + 18k ≥ 0 → k ≥ -5. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are5. This interval exhausts all possibilities.5. Every solution, in the stated order
geese (x) ducks (y) chicks (z) Total animals Cost check 5 5 90 100 5 × 10 + 5 × 4 + 90 × 1/3 = 100(5, 5, 90)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Peacocks, hens, sparrows
The three types are peacocks, hens, sparrows. Their unit prices, in the same order, are
15, 4, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10015 × x + 4 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
29x + 7y = 100. The gcd is 1; dividing by 1 leaves29x + 7y = 100.30x + 8y + 1z = 20030x + 8y + 1(100 - x - y) = 2003. Reduce modulo 7: 29x ≡ 100 (mod 7). Bézout’s identity
29 × (1) + 7 × (-4) = 1shows that(1)is an inverse of 29 modulo 7. Hence x ≡(1)× 100 ≡ 2 (mod 7). All candidates are x = 2 + 7k, with integer k.4. From y ≥ 0 we obtain x ≤ 3. Substituting the family into the other counts gives
x = 2 + 7k,y = 6 - 29k,z = 92 + 22k. The constraints become2 + 7k ≥ 0 → k ≥ 0;6 - 29k ≥ 0 → k ≤ 0;92 + 22k ≥ 0 → k ≥ -4. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are2. This interval exhausts all possibilities.5. Every solution, in the stated order
peacocks (x) hens (y) sparrows (z) Total animals Cost check 2 6 92 100 2 × 15 + 6 × 4 + 92 × 1/2 = 100(2, 6, 92)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Horses, sheep, lambs
The three types are horses, sheep, lambs. Their unit prices, in the same order, are
6, 3, 1/2coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1006 × x + 3 × y + 1/2 × z = 1002. Multiply the cost equation by 2 and substitute z = 100 - x - y. We obtain
11x + 5y = 100. The gcd is 1; dividing by 1 leaves11x + 5y = 100.12x + 6y + 1z = 20012x + 6y + 1(100 - x - y) = 2003. Reduce modulo 5: 11x ≡ 100 (mod 5). Bézout’s identity
11 × (1) + 5 × (-2) = 1shows that(1)is an inverse of 11 modulo 5. Hence x ≡(1)× 100 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives
x = 0 + 5k,y = 20 - 11k,z = 80 + 6k. The constraints become0 + 5k ≥ 0 → k ≥ 0;20 - 11k ≥ 0 → k ≤ 1;80 + 6k ≥ 0 → k ≥ -13. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are0, 5. This interval exhausts all possibilities.5. Every solution, in the stated order
horses (x) sheep (y) lambs (z) Total animals Cost check 0 20 80 100 0 × 6 + 20 × 3 + 80 × 1/2 = 1005 9 86 100 5 × 6 + 9 × 3 + 86 × 1/2 = 100(0, 20, 80); (5, 9, 86)There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Trout, carp, bleak
The three types are trout, carp, bleak. Their unit prices, in the same order, are
8, 3, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1008 × x + 3 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
31x + 11y = 300. The gcd is 1; dividing by 1 leaves31x + 11y = 300.32x + 12y + 1z = 40032x + 12y + 1(100 - x - y) = 4003. Reduce modulo 11: 31x ≡ 300 (mod 11). Bézout’s identity
31 × (5) + 11 × (-14) = 1shows that(5)is an inverse of 31 modulo 11. Hence x ≡(5)× 300 ≡ 4 (mod 11). All candidates are x = 4 + 11k, with integer k.4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives
x = 4 + 11k,y = 16 - 31k,z = 80 + 20k. The constraints become4 + 11k ≥ 0 → k ≥ 0;16 - 31k ≥ 0 → k ≤ 0;80 + 20k ≥ 0 → k ≥ -4. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are4. This interval exhausts all possibilities.5. Every solution, in the stated order
trout (x) carp (y) bleak (z) Total animals Cost check 4 16 80 100 4 × 8 + 16 × 3 + 80 × 1/4 = 100(4, 16, 80)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Dogs, cats, hamsters
The three types are dogs, cats, hamsters. Their unit prices, in the same order, are
10, 2, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10010 × x + 2 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
29x + 5y = 200. The gcd is 1; dividing by 1 leaves29x + 5y = 200.30x + 6y + 1z = 30030x + 6y + 1(100 - x - y) = 3003. Reduce modulo 5: 29x ≡ 200 (mod 5). Bézout’s identity
29 × (4) + 5 × (-23) = 1shows that(4)is an inverse of 29 modulo 5. Hence x ≡(4)× 200 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives
x = 0 + 5k,y = 40 - 29k,z = 60 + 24k. The constraints become0 + 5k ≥ 0 → k ≥ 0;40 - 29k ≥ 0 → k ≤ 1;60 + 24k ≥ 0 → k ≥ -2. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are0, 5. This interval exhausts all possibilities.5. Every solution, in the stated order
dogs (x) cats (y) hamsters (z) Total animals Cost check 0 40 60 100 0 × 10 + 40 × 2 + 60 × 1/3 = 1005 11 84 100 5 × 10 + 11 × 2 + 84 × 1/3 = 100(0, 40, 60); (5, 11, 84)There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Turkeys, ducks, chicks
The three types are turkeys, ducks, chicks. Their unit prices, in the same order, are
15, 3, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10015 × x + 3 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
44x + 8y = 200. The gcd is 4; dividing by 4 leaves11x + 2y = 50.45x + 9y + 1z = 30045x + 9y + 1(100 - x - y) = 3003. Reduce modulo 2: 11x ≡ 50 (mod 2). Bézout’s identity
11 × (1) + 2 × (-5) = 1shows that(1)is an inverse of 11 modulo 2. Hence x ≡(1)× 50 ≡ 0 (mod 2). All candidates are x = 0 + 2k, with integer k.4. From y ≥ 0 we obtain x ≤ 4. Substituting the family into the other counts gives
x = 0 + 2k,y = 25 - 11k,z = 75 + 9k. The constraints become0 + 2k ≥ 0 → k ≥ 0;25 - 11k ≥ 0 → k ≤ 2;75 + 9k ≥ 0 → k ≥ -8. Intersecting the three bounds gives0 ≤ k ≤ 2. The allowed x values are0, 2, 4. This interval exhausts all possibilities.5. Every solution, in the stated order
turkeys (x) ducks (y) chicks (z) Total animals Cost check 0 25 75 100 0 × 15 + 25 × 3 + 75 × 1/3 = 1002 14 84 100 2 × 15 + 14 × 3 + 84 × 1/3 = 1004 3 93 100 4 × 15 + 3 × 3 + 93 × 1/3 = 100(0, 25, 75); (2, 14, 84); (4, 3, 93)There are 3 non-negative solutions. If we require at least one animal of each type, 2 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Rabbits, pigeons, sparrows
The three types are rabbits, pigeons, sparrows. Their unit prices, in the same order, are
6, 3, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1006 × x + 3 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
23x + 11y = 300. The gcd is 1; dividing by 1 leaves23x + 11y = 300.24x + 12y + 1z = 40024x + 12y + 1(100 - x - y) = 4003. Reduce modulo 11: 23x ≡ 300 (mod 11). Bézout’s identity
23 × (1) + 11 × (-2) = 1shows that(1)is an inverse of 23 modulo 11. Hence x ≡(1)× 300 ≡ 3 (mod 11). All candidates are x = 3 + 11k, with integer k.4. From y ≥ 0 we obtain x ≤ 13. Substituting the family into the other counts gives
x = 3 + 11k,y = 21 - 23k,z = 76 + 12k. The constraints become3 + 11k ≥ 0 → k ≥ 0;21 - 23k ≥ 0 → k ≤ 0;76 + 12k ≥ 0 → k ≥ -6. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are3. This interval exhausts all possibilities.5. Every solution, in the stated order
rabbits (x) pigeons (y) sparrows (z) Total animals Cost check 3 21 76 100 3 × 6 + 21 × 3 + 76 × 1/4 = 100(3, 21, 76)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Cows, pigs, chicks
The three types are cows, pigs, chicks. Their unit prices, in the same order, are
8, 5, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1008 × x + 5 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
31x + 19y = 300. The gcd is 1; dividing by 1 leaves31x + 19y = 300.32x + 20y + 1z = 40032x + 20y + 1(100 - x - y) = 4003. Reduce modulo 19: 31x ≡ 300 (mod 19). Bézout’s identity
31 × (8) + 19 × (-13) = 1shows that(8)is an inverse of 31 modulo 19. Hence x ≡(8)× 300 ≡ 6 (mod 19). All candidates are x = 6 + 19k, with integer k.4. From y ≥ 0 we obtain x ≤ 9. Substituting the family into the other counts gives
x = 6 + 19k,y = 6 - 31k,z = 88 + 12k. The constraints become6 + 19k ≥ 0 → k ≥ 0;6 - 31k ≥ 0 → k ≤ 0;88 + 12k ≥ 0 → k ≥ -7. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are6. This interval exhausts all possibilities.5. Every solution, in the stated order
cows (x) pigs (y) chicks (z) Total animals Cost check 6 6 88 100 6 × 8 + 6 × 5 + 88 × 1/4 = 100(6, 6, 88)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Swans, geese, sparrows
The three types are swans, geese, sparrows. Their unit prices, in the same order, are
11, 2, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 10011 × x + 2 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
43x + 7y = 300. The gcd is 1; dividing by 1 leaves43x + 7y = 300.44x + 8y + 1z = 40044x + 8y + 1(100 - x - y) = 4003. Reduce modulo 7: 43x ≡ 300 (mod 7). Bézout’s identity
43 × (1) + 7 × (-6) = 1shows that(1)is an inverse of 43 modulo 7. Hence x ≡(1)× 300 ≡ 6 (mod 7). All candidates are x = 6 + 7k, with integer k.4. From y ≥ 0 we obtain x ≤ 6. Substituting the family into the other counts gives
x = 6 + 7k,y = 6 - 43k,z = 88 + 36k. The constraints become6 + 7k ≥ 0 → k ≥ 0;6 - 43k ≥ 0 → k ≤ 0;88 + 36k ≥ 0 → k ≥ -2. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are6. This interval exhausts all possibilities.5. Every solution, in the stated order
swans (x) geese (y) sparrows (z) Total animals Cost check 6 6 88 100 6 × 11 + 6 × 2 + 88 × 1/4 = 100(6, 6, 88)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
Goats, hens, chicks
The three types are goats, hens, chicks. Their unit prices, in the same order, are
5, 2, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1005 × x + 2 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
14x + 5y = 200. The gcd is 1; dividing by 1 leaves14x + 5y = 200.15x + 6y + 1z = 30015x + 6y + 1(100 - x - y) = 3003. Reduce modulo 5: 14x ≡ 200 (mod 5). Bézout’s identity
14 × (4) + 5 × (-11) = 1shows that(4)is an inverse of 14 modulo 5. Hence x ≡(4)× 200 ≡ 0 (mod 5). All candidates are x = 0 + 5k, with integer k.4. From y ≥ 0 we obtain x ≤ 14. Substituting the family into the other counts gives
x = 0 + 5k,y = 40 - 14k,z = 60 + 9k. The constraints become0 + 5k ≥ 0 → k ≥ 0;40 - 14k ≥ 0 → k ≤ 2;60 + 9k ≥ 0 → k ≥ -6. Intersecting the three bounds gives0 ≤ k ≤ 2. The allowed x values are0, 5, 10. This interval exhausts all possibilities.5. Every solution, in the stated order
goats (x) hens (y) chicks (z) Total animals Cost check 0 40 60 100 0 × 5 + 40 × 2 + 60 × 1/3 = 1005 26 69 100 5 × 5 + 26 × 2 + 69 × 1/3 = 10010 12 78 100 10 × 5 + 12 × 2 + 78 × 1/3 = 100(0, 40, 60); (5, 26, 69); (10, 12, 78)There are 3 non-negative solutions. If we require at least one animal of each type, 2 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Horses, donkeys, sheep
The three types are horses, donkeys, sheep. Their unit prices, in the same order, are
7, 5, 1/3coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1007 × x + 5 × y + 1/3 × z = 1002. Multiply the cost equation by 3 and substitute z = 100 - x - y. We obtain
20x + 14y = 200. The gcd is 2; dividing by 2 leaves10x + 7y = 100.21x + 15y + 1z = 30021x + 15y + 1(100 - x - y) = 3003. Reduce modulo 7: 10x ≡ 100 (mod 7). Bézout’s identity
10 × (5) + 7 × (-7) = 1shows that(5)is an inverse of 10 modulo 7. Hence x ≡(5)× 100 ≡ 3 (mod 7). All candidates are x = 3 + 7k, with integer k.4. From y ≥ 0 we obtain x ≤ 10. Substituting the family into the other counts gives
x = 3 + 7k,y = 10 - 10k,z = 87 + 3k. The constraints become3 + 7k ≥ 0 → k ≥ 0;10 - 10k ≥ 0 → k ≤ 1;87 + 3k ≥ 0 → k ≥ -29. Intersecting the three bounds gives0 ≤ k ≤ 1. The allowed x values are3, 10. This interval exhausts all possibilities.5. Every solution, in the stated order
horses (x) donkeys (y) sheep (z) Total animals Cost check 3 10 87 100 3 × 7 + 10 × 5 + 87 × 1/3 = 10010 0 90 100 10 × 7 + 0 × 5 + 90 × 1/3 = 100(3, 10, 87); (10, 0, 90)There are 2 non-negative solutions. If we require at least one animal of each type, 1 remain.
Rows containing a zero are correct when an absent type is allowed; exclude them only in the version requiring every type to be present.
Oxen, rams, lambs
The three types are oxen, rams, lambs. Their unit prices, in the same order, are
9, 6, 1/4coins. How many animals of each type can you buy while meeting both totals?Show solution and method
1. Choose the unknowns in the stated order: x, y, z. The two conditions are:
x + y + z = 1009 × x + 6 × y + 1/4 × z = 1002. Multiply the cost equation by 4 and substitute z = 100 - x - y. We obtain
35x + 23y = 300. The gcd is 1; dividing by 1 leaves35x + 23y = 300.36x + 24y + 1z = 40036x + 24y + 1(100 - x - y) = 4003. Reduce modulo 23: 35x ≡ 300 (mod 23). Bézout’s identity
35 × (2) + 23 × (-3) = 1shows that(2)is an inverse of 35 modulo 23. Hence x ≡(2)× 300 ≡ 2 (mod 23). All candidates are x = 2 + 23k, with integer k.4. From y ≥ 0 we obtain x ≤ 8. Substituting the family into the other counts gives
x = 2 + 23k,y = 10 - 35k,z = 88 + 12k. The constraints become2 + 23k ≥ 0 → k ≥ 0;10 - 35k ≥ 0 → k ≤ 0;88 + 12k ≥ 0 → k ≥ -7. Intersecting the three bounds gives0 ≤ k ≤ 0. The allowed x values are2. This interval exhausts all possibilities.5. Every solution, in the stated order
oxen (x) rams (y) lambs (z) Total animals Cost check 2 10 88 100 2 × 9 + 10 × 6 + 88 × 1/4 = 100(2, 10, 88)There are 1 non-negative solutions. If we require at least one animal of each type, 1 remain.
6. Conclusion
The animal names and coins provide a story: the method works for any three goods with rational prices.
Remember the sequence: two equations → elimination → integer coefficients → gcd → solution family → bounds → verification. Finding one triple does not prove uniqueness; determining the entire parameter interval does.