Solving systems of equations using matrices