Let's denote the number of pigs as \( p \) and the number of ducks as \( d \).
We know:
-
The total number of animals is 10: \[ p + d = 10 \]
-
Pigs have 4 legs and ducks have 2 legs. The total number of legs is 36: \[ 4p + 2d = 36 \]
Now we can solve this system of equations.
From the first equation, we can express \( d \) in terms of \( p \): \[ d = 10 - p \]
Now, substitute \( d \) into the second equation: \[ 4p + 2(10 - p) = 36 \]
Expanding this gives: \[ 4p + 20 - 2p = 36 \] \[ 2p + 20 = 36 \]
Now, subtract 20 from both sides: \[ 2p = 16 \]
Dividing by 2, we find: \[ p = 8 \]
Now substitute back to find \( d \): \[ d = 10 - p = 10 - 8 = 2 \]
So, there are \( \boxed{8} \) pigs and 2 ducks.