Final answer:
To solve the problem, set up a system of equations by considering the number of chickens as c and the number of pigs as p. The first equation is c + p = 13, and the second equation is 2c + 4p = 40. By solving the system of equations, we find that there are 6 chickens and 7 pigs in the barn.
Step-by-step explanation:
To solve this problem, we can set up a system of equations. Let's assume that the number of chickens is represented by c and the number of pigs is represented by p. We can create two equations based on the given information:
From the first equation, we know that there are a total of 13 animals in the barn, so we can write: c + p = 13.
From the second equation, we know that the total number of legs in the barn is 40, so we can write: 2c + 4p = 40.
We now have a system of equations:
c + p = 13
2c + 4p = 40
To solve this system, we can use the method of substitution or elimination. Let's use the method of substitution. We can solve the first equation for c: c = 13 - p.
Substitute this expression for c into the second equation: 2(13 - p) + 4p = 40.
Simplify and solve for p: 26 - 2p + 4p = 40.
Combine like terms: 2p = 14.
Divide both sides by 2: p = 7.
Now that we know the number of pigs, we can substitute this value into the first equation to find the number of chickens: c + 7 = 13.
Solve for c: c = 6.
So, there are 6 chickens and 7 pigs in the barn.