Exactly solve a linear system