Farmer John looks out onto his farm and counts 16 heads. The only animals are cows and chicken. He then counts 42 legs in all. How many of each animal does farmer John have?

To solve this problem, we can use a system of equations. Let's assume the number of cows is 'C' and the number of chickens is 'H'.

First, we know that the total number of animals is 16, so we can write the equation:
C + H = 16 (Equation 1)

Next, we know that the total number of legs is 42, which can be expressed as:
4C + 2H = 42 (Equation 2)

We now have a system of two equations with two variables. To solve for C and H, we can use a method called substitution or elimination.

Let's solve using the substitution method:

From Equation 1, we can solve for C:
C = 16 - H

Substitute this value of C into Equation 2:
4(16 - H) + 2H = 42
64 - 4H + 2H = 42
-2H = 42 - 64
-2H = -22
H = (-22)/(-2)
H = 11

Now that we know H is 11, we can substitute this value back into Equation 1 to find C:
C + 11 = 16
C = 16 - 11
C = 5

Therefore, Farmer John has 5 cows and 11 chickens on his farm.