How to solve a system of linear equations?