Solve systems of linear equations exactly and approximately