Solving linear systems by substitution method