Let L=Leroy and R=Rusty
L+R=4 because together they have 4 pets
3 times Rusty is 3R
minus Leroy's pets
3R-L=8
Our two equations are:
L+R=4
3R-L=8
Rearrange the second
-L+3R=8
L+R=4
Do elimination
4R=12
R=3
L+R=4
L+3=4
So L=1
Rusty has 3 and Leroy has 1