Let the number of chickens = c.
Let the number of pigs = p.
A chicken has 1 head and 2 legs.
c number of chickens have c heads and 2c legs.
A pig has 1 head and 4 legs.
p number of pigs have p heads and 4p legs.
There are 40 heads.
Equation for heads:
c + p = 40
There are 110 legs.
Equation for legs:
2c + 4p = 110
System of equations:
c + p = 40
2c + 4p = 110
Solve the first equation of the system of equations for c:
c = 40 - p
Substitute 40 - p for c in the second equation:
2c + 4p = 110
2(40 - p) + 4p = 110
80 - 2p + 4p = 110
80 + 2p = 110
2p = 30
p = 15
Now substitute p = 15 in the first equation to find c.
c + p = 40
c + 15 = 40
c = 25
There are 25 chickens and 15 pigs.