use gauss-jordan

x+2y=5
2x+y=-2

To solve the system of equations using the Gauss-Jordan elimination method, we need to perform a series of row operations to transform the system into row-echelon form. Here's how you can do it step by step:

Step 1: Write the system of equations in the matrix form:
[1 2 | 5]
[2 1 | -2]

Step 2: Start with the first column and perform row operations to make the first element (1,1) equal to 1.
R1 - 2R2 -> R1

The matrix becomes:
[1 0 | 9]
[2 1 | -2]

Step 3: Next, perform row operations to make the second element (2,2) equal to 1.
R2 - 2R1 -> R2

The matrix becomes:
[1 0 | 9]
[0 1 | -20]

Step 4: At this stage, you have obtained the row-echelon form of the matrix. Now, perform back substitution to get the solution.

From the first row, we have x = 9.
From the second row, we have y = -20.

Therefore, the solution to the system of equations is x = 9 and y = -20.