Solving simultaneous equations by substitution