You can
put this solution on YOUR website! Amanda is 5 years older than Peter
A = P+5
and Sam is 3 years younger than Peter.
S = P-3
If the sum of their ages is 50,
A+P+S = 50
Substitute (P+5) for A, and (P-3) for S in A+P+S = 50:
(P+5)+P+(P-3) = 50
Solve for P, that's Peter's age.
Substitute what you get for P in A = P+5 to get Amanda's age.
Substitute what you get for P in S = P-3 to get Peters's age.
Edwin