Let 'p' and 'c' denote the number of pigs and the number of chickens, respectively.
Given that there are 30 heads, and we know that each animal has a single head,
![\begin{gathered} p+q=30 \\ q=30-p \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/43qflnuc74mkp6mhmuoufim82pxfyx87gy.png)
Knowing that a pig has 4 legs, and a chicken has 2 legs. It is given that the total number of legs is 82,
![\begin{gathered} 4p+2q=82 \\ 2p+q=41 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/39zaumitba1ug2d7ta3jp3rx18hns98qt1.png)
Substitute the value of 'q' from first equation into the second equation,
![\begin{gathered} 2p+(30-p)=41 \\ 2p-p=41-30 \\ p=11 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/ebd2vcg9706thoatbg9wmaf2r3dqaex0b4.png)
Substitute the value in the first equation,
![\begin{gathered} q=30-11 \\ q=19 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/1yzl04jj7ssz28v339zz2j5hiizopi6ddi.png)
Thus, there are 11 pigs and 19 chickens.