The number of ducks is 29 and the number of pigs is 17
Step-by-step explanation
Suppose, the number of ducks
and the number of pigs

As the total number of ducks and pigs in the field is 46, so the first equation will be......
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.....

Solving equation (1) for getting 'd' itself ......

Now, we will substitute this
into equation (2). So we will get.....

Plugging this
into equation (1), we will get...

So, the number of ducks is 29 and the number of pigs is 17