Explanation:
let x be the number of years that Zach has been on the soccer team and y the number of years Anderson has been on the soccer team.
So, reading our problem it seems that
x=5y-2
x+y=10
replacing x on the second formula we take that 5y-2+y=10
6y-2=10
6y=12
y=2
so x=5y-2=5*2-2=10-2=8