How to solve systems of equations in three variables