Cows and Chickens: Solving Systems with Two Unknowns
A farmer has cows and chickens. Cows have 4 legs, and chickens have 2 legs. The farmer counts 20 animals in total and 56 legs. How many cows and chickens are there?
Already Got the Answer?
- Setup:
c + h = 20and4c + 2h = 56 - Answer: 8 cows and 12 chickens
- One-line check:
8·4 + 12·2 = 32 + 24 = 56✓ and8 + 12 = 20✓
If your numbers match, skip ahead to the pitfalls and the four extension problems. They are where the real learning happens.
What You Will Learn
This is the most famous "two unknowns" puzzle in school math. The arithmetic is easy. The point is learning to turn a story into two equations that must both be true at once.
- Translating a story into a system. Each fact in the problem becomes one equation. Two unknowns need two facts.
- Separating "how many" from "how much each contributes." The head count adds animals. The leg count adds animals times a weight. Mixing these up is the central error in this problem family.
- Substitution as a tool. Replace one unknown with an expression in the other, and the problem collapses to a one-variable equation you already know how to solve.
- Non-algebraic reasoning that mirrors the algebra. The "all chickens" baseline method and the "average leg" method are the same math in disguise. Seeing why they agree builds real fluency.
- Checking against the story. Counts of animals must be whole, non-negative numbers. Good problem solvers test an answer against the context, not only against the equations.
Solution: Method 1 — The Two-Equation System with Substitution
The problem gives two separate facts about the same farm: how many animals there are, and how many legs they have. Each fact becomes an equation. Because there are two unknowns, we need exactly two equations, and we have them.
Step 1 — Name the unknowns
Choose letters that remind you what they stand for:
h = number of chickens (hens)
Always write this down. It prevents the common slip of forgetting which letter means what halfway through the work.
Step 2 — Write the equation for the head count
Every animal counts as one, whether it is a cow or a chicken. So the cows plus the chickens must equal 20:
Step 3 — Write the equation for the leg count
Now each animal contributes more than one unit. A cow adds 4 legs and a chicken adds 2 legs. If there are c cows, they bring 4c legs. If there are h chickens, they bring 2h legs. Together:
Step 4 — Use Equation (1) to eliminate one unknown
Solve Equation (1) for h. Subtract c from both sides:
This says, in plain English, "whatever animals are not cows must be chickens." Now substitute this expression for h in Equation (2). Put it in parentheses, because the whole expression gets multiplied by 2:
Step 5 — Solve the one-variable equation
Distribute the 2, combine like terms, then isolate c:
2c + 40 = 56
2c = 16
c = 8
Step 6 — Back-substitute to find the chickens
Return to h = 20 − c:
So the farm has 8 cows and 12 chickens. Notice that we found c first, but the question asks for both numbers. A system is not finished until every unknown has a value.
Solution: Method 2 — The All-Chickens Baseline Shift
You can solve this puzzle without writing a single variable. The trick is to start from a farm that is easy to count and see how far the real farm is from it.
Step 1 — Imagine the least-legged farm
Pretend all 20 animals are chickens. Then the legs would total 20 × 2 = 40. This is the minimum possible, because no animal on this farm has fewer than 2 legs.
Step 2 — Measure the surplus
The farmer actually counted 56 legs, so there are 56 − 40 = 16 "extra" legs that our all-chicken farm cannot explain.
Step 3 — Price each swap
Replace one chicken with one cow. The head count stays at 20, but the legs rise by 4 − 2 = 2. Every cow on the farm is responsible for exactly 2 of those surplus legs.
Step 4 — Divide the surplus by the price
chickens = 20 − 8 = 12
The table shows the same idea as a sequence. Each additional cow bumps the leg total up by 2, and we stop when we reach 56.
| Cows | Chickens | Cow legs | Chicken legs | Total legs |
|---|---|---|---|---|
| 0 | 20 | 0 | 40 | 40 |
| 1 | 19 | 4 | 38 | 42 |
| 2 | 18 | 8 | 36 | 44 |
| 4 | 16 | 16 | 32 | 48 |
| 6 | 14 | 24 | 28 | 52 |
| 8 | 12 | 32 | 24 | 56 |
| 10 | 10 | 40 | 20 | 60 |
Why this is the algebra in disguise. Substituting h = 20 − c gave 2c + 40 = 56 in Method 1. The 40 is the all-chicken baseline, and the 2c is the 2-legs-per-swap surplus. The two methods are the same equation read in two different languages.
Solution: Method 3 — The "Average Leg" Lens
Here is a third view, and it is the one that generalizes best. Spread the 56 legs evenly across the 20 animals:
No animal actually has 2.8 legs. But the average must sit between 2 (all chickens) and 4 (all cows). The question is how far along that interval 2.8 falls:
cows = 0.4 × 20 = 8
The average sits 40% of the way from 2 to 4, so 40% of the animals are cows: 8 of 20. This weighted-average idea is exactly how mixture problems work, and we will connect it to those below.
The Answer
Cows: 8
Chickens: 12
The farm has 8 cows and 12 chickens: 20 animals with 56 legs in total.
Verification
Substitute the answer into both original facts. Satisfying only one is not enough, because a system requires every equation to hold at once.
Head count:8 + 12 = 20 ✓
Leg count:4(8) + 2(12) = 32 + 24 = 56 ✓
Context check: 8 and 12 are whole, non-negative numbers, so they make sense as counts of animals ✓
Method 2 and Method 3 reached the same pair independently of the algebra, which is another form of verification.
Sanity Check
Before doing any algebra, you can predict roughly what the answer should look like. This is what experienced problem solvers do.
- The legs must fall between 40 and 80. With 20 animals, all chickens gives 40 legs and all cows gives 80. A total of 56 is inside that range, so a solution is possible.
- 56 is closer to 40 than to 80. It is 16 above the minimum and 24 below the maximum, so we should expect more chickens than cows. The answer 12 chickens versus 8 cows agrees.
- The total must be even. Every animal has an even number of legs, so any whole-number mix gives an even total. 56 is even.
| Scenario (20 animals) | Total legs | Compare with 56 |
|---|---|---|
| All chickens | 40 | 16 too few |
| Half and half (10 and 10) | 60 | 4 too many |
| 8 cows, 12 chickens | 56 | exact match |
| All cows | 80 | 24 too many |
The half-and-half farm is only 4 legs too high. Since moving one animal changes the total by 2, we need to shift exactly two animals from cow to chicken, from 10 and 10 to 8 and 12. That is a third confirmation.
What Trips People Up
This puts the leg counts on the wrong animals. Solving it gives 12 cows and 8 chickens, which is the right pair of numbers attached to the wrong animals. The equations are consistent with each other, so nothing looks broken. Defense: read your leg equation aloud as "4 legs per cow times the number of cows," and make sure the 4 sits next to the cow variable.
When substituting h = 20 − c, the whole expression must be multiplied by 2. Without parentheses, only the 20 is doubled, and you get 3c + 40 = 56, so c = 16/3. A fractional number of cows is a loud alarm: in a counting problem, a non-integer answer almost always means a setup or substitution error.
This treats all the legs as if they belonged to cows. But the chickens' legs are in that 56 as well. Check it: 14·4 + 6·2 = 68, not 56. Whenever you divide a total by a "per item" amount, ask whether that total contains only one kind of item.
Adding the two leg counts (4 + 2 = 6) only makes sense if cows and chickens come in matched pairs. Nothing in the problem says that. The number of cows and the number of chickens are independent unknowns, linked only by the total of 20.
If You See These Words...
This puzzle has a recognizable shape: two kinds of things, one total count, one total "weighted" quantity. Look for:
- "…in total" given twice, once for how many items and once for a sum of some property (legs, dollars, points, wheels).
- Two categories with a fixed amount per item: 4 legs and 2 legs, $5 tickets and $8 tickets, 2-point and 3-point baskets, bicycles and tricycles.
- A question asking "how many of each?"
A disguised twin. "A theater sold 20 tickets for $56 total. Adult tickets cost $4 and child tickets cost $2. How many of each?" Replace "legs" with "dollars" and the equations are identical: a + k = 20 and 4a + 2k = 56. Same system, same answer: 8 adult tickets and 12 child tickets.
The General Formula
Replace the specific numbers with letters and the solution becomes a formula you can use on any problem of this type. Suppose there are N animals, L legs total, and the two kinds have a legs and b legs (with a > b).
a·c + b·h = L
c = (L − b·N) ÷ (a − b) Number of the many-legged animal. Then h = N − c.
Look at the pieces: b·N is the all-chickens baseline, L − b·N is the surplus, and a − b is the price per swap. This is Method 2 written as a formula. For our farm:
The formula also tells you precisely when a solution exists: the numerator must be a non-negative multiple of (a − b) and must not exceed (a − b)·N. That is how we know in advance that 55 legs is impossible on this farm.
Limits of the shortcut. It works for exactly two kinds of item. With three kinds you need a third piece of information, and the system needs three equations (see "What If?" problem 4).
The same structure shows up in mixture problems. Method 3's "fraction of the way between 2 and 4" is the same calculation as finding how much of a 10% solution and a 30% solution to blend to get 24%.
A Brief History
This puzzle is over 1,500 years old. It appears in the Chinese text Sunzi Suanjing (roughly 4th–5th century CE) as the "pheasants and rabbits in a cage" problem: given 35 heads and 94 feet, find each count. The text gives a method that is essentially the "half the legs" trick: halve the feet, subtract the heads, and you have the number of rabbits. It endures in textbooks because it is the simplest setting where one equation is not enough and the idea of a system has to appear.
The Next Level
Once two unknowns feel natural, the next steps are three unknowns (three equations, as in "What If?" problem 4) and systems where the equations are not so tidy, such as 3x + 2y = 17 and 5x − 4y = 9, where elimination becomes more efficient than substitution. Elimination here would go like this: multiply c + h = 20 by 2 to get 2c + 2h = 40, subtract it from 4c + 2h = 56, and the h terms vanish, leaving 2c = 16. Try redoing the farm that way. Which do you prefer?
Extend Your Thinking
Try each problem before opening the solution. They are ordered from a straight repeat of the method to a problem that needs a new idea.
A farmer has cows and chickens. She counts 30 animals and 84 legs in total. How many cows and how many chickens does she have?
Let c = cows and h = chickens.
Heads: c + h = 30. Legs: 4c + 2h = 84.
From the first equation, h = 30 − c. Then 4c + 2(30 − c) = 84, which simplifies to 2c + 60 = 84.
2c = 24, so c = 12 and h = 30 − 12 = 18. 12 cows and 18 chickens.
Animals: 12 + 18 = 30 ✓. Legs: 12·4 + 18·2 = 48 + 36 = 84 ✓.
A farmer knows she has exactly 9 cows. She counts 62 legs in total on her farm, which has only cows and chickens. How many chickens does she have, and how many animals are there altogether?
The number of cows is given, so only one unknown remains: h, the chickens. One equation will be enough.
Cow legs: 9 × 4 = 36. Chicken legs: 2h. Total: 36 + 2h = 62.
2h = 26, so h = 13.
Total animals: 9 + 13 = 22. 13 chickens and 22 animals in total.
Legs: 9·4 + 13·2 = 36 + 26 = 62 ✓. The answer is a whole number, as it must be.
A different farmer has 20 animals, all of them cows or chickens, and says she counted exactly 55 legs. Is that possible? Then find the smallest and largest numbers of legs she could possibly have counted.
Cows have 4 legs and chickens have 2 legs, and both are even numbers. A sum of even numbers is always even, so the total must be even. 55 is odd.
With h = 20 − c: 4c + 2(20 − c) = 55 gives 2c + 40 = 55, so c = 7.5. Half a cow is not allowed, which agrees with the parity argument.
All chickens: 20 × 2 = 40 legs. All cows: 20 × 4 = 80 legs.
55 legs is impossible. The possible totals are the even numbers from 40 to 80, which is 21 possible totals, one for each number of cows from 0 to 20.
Each extra cow adds 2 legs: 40, 42, …, 80. That is (80 − 40) ÷ 2 + 1 = 21 values ✓.
The farm now also has ducks (2 legs each). There are 20 animals and 56 legs in total, and there are twice as many chickens as ducks. How many cows, chickens, and ducks are there?
Let c, h, d be cows, chickens, ducks. Heads: c + h + d = 20. Legs: 4c + 2h + 2d = 56. Relationship: h = 2d.
Chickens and ducks both have 2 legs, so for the leg count they behave like one group of "2-legged animals" of size h + d. Let t = h + d.
c + t = 20 and 4c + 2t = 56. This is the original problem, so c = 8 and t = 12.
With h = 2d: h + d = 3d = 12, so d = 4 and h = 8. 8 cows, 8 chickens, 4 ducks.
Animals: 8 + 8 + 4 = 20 ✓. Legs: 32 + 16 + 8 = 56 ✓. Chickens are twice the ducks: 8 = 2·4 ✓. The leg count alone could never separate chickens from ducks, which is why the extra relationship was necessary.
Frequently Asked Questions
Name the two unknowns, write one equation for each piece of information, then use one equation to express one unknown in terms of the other and substitute it into the second equation. In this example, c + h = 20 gives h = 20 − c. Substituting into 4c + 2h = 56 gives 4c + 2(20 − c) = 56, so 2c + 40 = 56 and c = 8. Then h = 20 − 8 = 12.
Assume every animal is the one with fewer legs, count the legs, and then measure the shortfall. Each swap to the other animal adds a fixed number of legs. In this example, 20 chickens would have 40 legs. The farm actually has 56, which is 16 extra. Swapping a chicken for a cow adds 2 legs, so 16 ÷ 2 = 8 cows and 20 − 8 = 12 chickens.
Solve it, then check that the answers make sense for the story: counts of animals or people must be whole, non-negative numbers. You can often spot trouble before solving by looking at parity and range. In a cows-and-chickens problem every animal has an even number of legs, so the total must be even, and with 20 animals it must fall between 40 and 80. A count of 55 legs is therefore impossible.
2026-09-16