Cows and Chickens: Solving Systems with Two Unknowns

Number Puzzles 7th-8th Grade
PROBLEM

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?

What You Will Learn

  • Setting up systems of equations from word constraints
  • Using substitution to solve two-variable systems
  • Recognizing when real-world problems require integer solutions
  • Checking solutions by substituting back into original constraints
  • Building algebraic models for counting problems with multiple categories

Solution: Method 1 — The Substitution Approach

The key insight is that we have two constraints: a count constraint (total animals) and a property constraint (total legs). Each constraint gives us one equation, and we need exactly two equations to solve for two unknowns.

Step 1 — Define variables clearly

Let c = number of cows and h = number of chickens. I'm using h for chickens to avoid confusion with the variable c for cows.

Step 2 — Write the count equation

Total animals: cows + chickens = 20

c + h = 20

Step 3 — Write the legs equation

Each cow contributes 4 legs, each chicken contributes 2 legs, and the total is 56 legs:

4c + 2h = 56

Step 4 — Solve the first equation for one variable

From c + h = 20, we get:

h = 20 - c

Step 5 — Substitute into the legs equation

Replace h with 20 - c in the legs equation:

4c + 2(20 - c) = 56 4c + 40 - 2c = 56 2c + 40 = 56 2c = 16 c = 8

Step 6 — Find the number of chickens

Now that we know c = 8, we can find h:

h = 20 - c = 20 - 8 = 12

Solution: Method 2 — The "All Chickens" Mental Model

Sometimes it's easier to think about extreme cases first. What if all 20 animals were chickens? Then what would need to change?

Step 1 — Imagine all animals are chickens

If all 20 animals were chickens, each with 2 legs, we'd have:

20 × 2 = 40 legs

But we actually have 56 legs, so we have:

56 - 40 = 16 extra legs

Step 2 — Account for the extra legs

The extra legs come from having cows instead of chickens. Each time we replace a chicken (2 legs) with a cow (4 legs), we gain:

4 - 2 = 2 extra legs

Step 3 — Find how many replacements we need

To get 16 extra legs, we need:

16 ÷ 2 = 8 replacements

So we have 8 cows and 20 - 8 = 12 chickens.

Answer: There are 8 cows and 12 chickens.

Verification

Let's check both constraints with our answer of 8 cows and 12 chickens:

Animal count check:

8 cows + 12 chickens = 20 animals ✓

Leg count check:

8 cows × 4 legs + 12 chickens × 2 legs = 32 + 24 = 56 legs ✓

Both constraints are satisfied, so our answer is correct.

Watch Out For These

✗ Mistake 1: Mixing up which variable represents which animal
Some students write h for cows and c for chickens, then get confused when setting up the legs equation. Always write down what each variable represents before starting.
✗ Mistake 2: Getting the leg coefficients backwards
Writing 2c + 4h = 56 instead of 4c + 2h = 56. Remember: cows have 4 legs, so the coefficient of c (cows) should be 4.
✗ Mistake 3: Accepting fractional animals
If your algebra gives you something like "6.5 cows," that's a signal to check your work. You cannot have half an animal in this context.

How to Spot This Problem Type

These are the telltale signs that you're looking at a classic "animal legs" or similar counting problem:

  • "Total count" combined with "total of a property" — animals + legs, coins + value, people + ages
  • Two different types of objects with different "rates" (legs per animal, cents per coin, etc.)
  • Phrases like "in total," "altogether," "combined"
  • The numbers usually work out to nice integers — real-world problems don't typically give fractional animals

You'll also see this same mathematical structure in problems about:

  • Coins (quarters worth 25¢, dimes worth 10¢)
  • Tickets (adult tickets $12, child tickets $8)
  • Test questions (2-point and 5-point problems)

The Pattern Behind This

The general structure for any two-category counting problem is:

x + y = (total count) ax + by = (total of property)

Where a and b are the "rates" for each category (legs per animal, value per coin, etc.). The solution is always:

x = [(total property) - b(total count)] / (a - b)

For our problem: a = 4 (cow legs), b = 2 (chicken legs), total count = 20, total property = 56

cows = (56 - 2×20) / (4 - 2) = 16 / 2 = 8
Formula limitation: This shortcut only works when you have exactly two categories. For three or more types of animals, you need to set up the full system of equations.

A Brief History

This type of problem appears in ancient mathematical texts from China, India, and Greece. The Chinese Nine Chapters on the Mathematical Art (circa 100 CE) includes problems about counting animals and objects with different properties. Medieval European mathematicians called these "false position" problems because they often used guessing strategies before algebra was fully developed.

The reason these problems persist in modern curricula isn't just tradition — they perfectly illustrate how real-world constraints translate into algebraic systems. The "counting" structure appears everywhere: inventory management, resource allocation, and even DNA sequencing algorithms in bioinformatics.

Four "What-If?" Problems

1
Different Animals
A farmer has horses (4 legs) and ducks (2 legs). She counts 18 animals and 58 legs. How many horses and ducks are there?
Step 1 — Set up variables

Let h = horses and d = ducks

Step 2 — Write the equations

h + d = 18 (total animals)

4h + 2d = 58 (total legs)

Step 3 — Solve by substitution

From equation 1: d = 18 - h

Substitute: 4h + 2(18 - h) = 58

4h + 36 - 2h = 58

2h = 22

h = 11

Step 4 — Find ducks

d = 18 - 11 = 7

Step 5 — Verify

Count: 11 + 7 = 18

Legs: 44 + 14 = 58

Answer

11 horses and 7 ducks

2
Adding a Third Animal
A farmer has cows (4 legs), chickens (2 legs), and pigs (4 legs). There are 25 animals total with 84 legs. The number of chickens equals the number of cows. How many of each animal are there?
Step 1 — Set up variables

Let c = cows, h = chickens, p = pigs

Given constraint: h = c (equal numbers of chickens and cows)

Step 2 — Write the equations

c + h + p = 25 (total animals)

4c + 2h + 4p = 84 (total legs)

Step 3 — Use the constraint

Since h = c, substitute in both equations:

c + c + p = 252c + p = 25

4c + 2c + 4p = 846c + 4p = 84

Step 4 — Solve the system

From the first: p = 25 - 2c

Substitute: 6c + 4(25 - 2c) = 84

6c + 100 - 8c = 84

-2c = -16, so c = 8

Step 5 — Find all animals

c = 8 cows

h = c = 8 chickens

p = 25 - 2(8) = 9 pigs

Answer

8 cows, 8 chickens, and 9 pigs

3
Reversing the Unknown
A farmer has cows and chickens totaling 52 legs. There are 4 more chickens than cows. How many animals of each type does she have?
Step 1 — Set up variables

Let c = number of cows and h = number of chickens

Given: h = c + 4 (4 more chickens than cows)

Step 2 — Write the legs equation

Total legs: 4c + 2h = 52

Step 3 — Substitute the constraint

Replace h with c + 4:

4c + 2(c + 4) = 52

4c + 2c + 8 = 52

6c = 44

c = 7.33...

Step 4 — Check if this makes sense

Since we can't have fractional animals, let's check our setup. Actually, let me try c = 7 and c = 8:

If c = 7: h = 11, legs = 28 + 22 = 50

If c = 8: h = 12, legs = 32 + 24 = 56

Step 5 — Interpolate for exact solution

We need exactly 52 legs, which is between these values. But since we need whole animals, this problem as stated has no solution with integer animals.

The closest would be 7 cows and 11 chickens (50 legs) or adjust the problem constraints.

4
The Challenge Version
In a magical farm, some animals are "double-headed cows" (1 body, 2 heads, 4 legs) and some are normal chickens (1 head, 2 legs). The farmer counts 28 heads and 60 legs. How many double-headed cows and chickens are there?
Step 1 — Define variables carefully

Let c = number of double-headed cows and h = number of chickens

Each double-headed cow contributes 2 heads and 4 legs

Each chicken contributes 1 head and 2 legs

Step 2 — Write the equations

Total heads: 2c + 1h = 28

Total legs: 4c + 2h = 60

Step 3 — Simplify the legs equation

Divide the legs equation by 2: 2c + h = 30

Step 4 — Solve the system

From the simplified legs equation: h = 30 - 2c

Substitute into heads equation: 2c + (30 - 2c) = 28

2c + 30 - 2c = 28

30 = 28 — This is impossible!

Step 5 — Re-examine the problem

Let me check: if heads equation is 2c + h = 28 and simplified legs is 2c + h = 30, these are contradictory.

Let me solve differently: From heads: h = 28 - 2c

Into original legs: 4c + 2(28 - 2c) = 60

4c + 56 - 4c = 60 gives 56 = 60

Answer

This problem has no solution — the constraints are inconsistent. The ratio of heads to legs doesn't work out for any combination of these animals.

Frequently Asked Questions

How do you set up a system of equations for animal counting problems?+

Create one equation for the total count and one for the total legs. For cows (c) and chickens (h): c + h = 20 animals, and 4c + 2h = 56 legs. The coefficients match each animal's leg count.

What's the easiest way to solve animal-leg counting problems?+

Use the substitution method: solve one equation for a variable, then substitute into the other. From c + h = 20, we get h = 20 - c. Substituting into 4c + 2h = 56 gives 4c + 2(20 - c) = 56, which simplifies to solve for c.

Why do animal counting problems always have whole number answers?+

You cannot have fractional animals in real life. If your algebra gives non-whole numbers, check your setup or arithmetic. These problems are designed so the constraints (total animals and total legs) are consistent and yield integer solutions.

DN

Dr. Neven Jurkovic

Mathematics educator with expertise in algebraic problem-solving and systems of equations

NJ
Neven Jurkovic, PhD

Professor of Computer Science, Palo Alto College, Alamo Colleges District, San Antonio, TX

Developer of Algebrator

Contact

This solution was prepared with AI assistance and reviewed by Dr. Jurkovic for mathematical accuracy and pedagogical clarity.

2026-09-16