P = age of Peter and S = Sylvia's age.
We will first decipher "four years prior Peter was three times as old as Sylvia." This can be composed P = 4 + 3*(S-4).
Next, we interpret "in 5 years the total of their ages will be 38 years" as (P + 5) + (S + 5) = 38.
Presently we have two questions (P and S) and two conditions, so we are prepared to settle. We substitute our first condition for P into our second condition:
(4+3*(S-4)+5) + (S+5) = 38
9 + 3S - 12 + S + 5 = 38
2 + 4S = 38
4S = 36
S = 9.
Substitute this once more into the main condition to discover P = 4+3*(S-4) = 4+3*(9-4) = 4+15 = 19.