To solve using matrices, we want to get an identity matrix in the variable columns and see what we get on the far right columns
The coefficients for the problem in matrix form:
1 1 5
2 -1 1
Add -2(row 1) to row 2:
1 1 5
0 -3 -9
Add (1/3) row 2 to row 1
1 0 2
0 -3 -9
Divide Row 2 by -3
1 0 2
0 1 3
We now have an identity matrix inf the first two columns. Row 1 gives us the value of x, and row 2 gives us the value of y:
x = 2, y = 3