Using elimination method to solve systems of equations