Call the number of rocks that Phil has "[tex]L[/tex]" and the number Peter had "[tex]R[/tex]".
We know that:
[tex]L=3R[/tex] and [tex]L+R=48[/tex]
Now solve by back substitution:
[tex]3R+R=48[/tex] therefore [tex]R=12[/tex] and thus [tex]L=3R=36[/tex]
Check:
[tex]L+R=12+36=48[/tex] CHECKS