Solving systems of equations with substitution