The number of ducks is 29 and the number of pigs is 17
Explanation
Suppose, the number of ducks [tex]=d[/tex] and the number of pigs [tex]=p[/tex]
As the total number of ducks and pigs in the field is 46, so the first equation will be......
[tex]d+p=46...........................................(1)[/tex]
Now, each duck has exactly two legs and each pig has exactly four legs. The total legs in the field is 126. So, the second equation will be.....
[tex]2d+4p = 126......................................(2)[/tex]
Solving equation (1) for getting 'd' itself ......
[tex]d= 46-p[/tex]
Now, we will substitute this [tex]d= 46-p[/tex] into equation (2). So we will get.....
[tex]2(46-p)+4p=126\\ \\ 92-2p+4p=126\\ \\ 2p= 126-92\\ \\ 2p= 34\\ \\ p=\frac{34}{2}=17[/tex]
Plugging this [tex]p=17[/tex] into equation (1), we will get...
[tex]d+17=46\\ \\ d=46-17=29[/tex]
So, the number of ducks is 29 and the number of pigs is 17