This heads and legs paradox has been famous from grade school to mid-schoolers.  The problem is something about determining the number of animals given the total number of their heads and legs or feet. For grade schoolers, they can solve it by trial and error until the given condition is achieved. For middle schoolers, they used algebra to solve this. Assign unknowns, generate equations and solve it. For better understanding, here is an example. Mang Kanor is breeding Chickens and Goats. He asked his nephew Ben to count the number of heads of these animals. He also asked Loi to count the total number of legs these animals have. Ben reported that he counted 40 heads, Loi counted 110 legs. How many chickens Mang Kanor have?

Solution:

Let C be the number of chicken

Let G be the number of goats

Since the number of heads is 40,

1 Head of Chicken = 1 Chicken(C )

1 Head of Goat = 1 Goat (G) $C+G=40$ (1)

Since there are 110 legs,

Legs of Chicken + Legs of Goat = 110

1 Chicken(C ) has 2 legs

1 Goat (G ) has 4 legs

Goats (4 legs per goat) + Chicken(2 legs per chicken) = 110 $4G+2C=110$ (2)

(1) and (2) are the smart way to solve this paradox. These are two equations in two unknowns.

We can rewrite (1) as $G=40-C$

Substitute this to (2) $4G+2C=110$ $4(40-C)+2C=110$ $160-4C+2C=110$ $-2C=-50$ $C=25$

Therefore, there are 25 chickens. Since there are 40 animals, there are 15 goats. Try to check if the number of legs will equal to 110.