solve system of 3 equations