Help with Gaussian elimination for a $3\times 3$ matrix

I'm currently working on a linear algebra problem and I'm having trouble understanding why my Gaussian elimination process is not yielding the same answer as the given solution.

The matrix I'm working with is:

$$\begin{pmatrix}1&0&-2\\ 3&1&-2\\ -5&-1&9\end{pmatrix}$$

And I performed Gaussian elimination on the matrix by doing the following steps:

• R2-3R1
• Switched row R1 with R3
• R3 + R1/5
• -R1/5
• R3 + R2/5
• R1 - R2/5
• 5R3 / 11

And I ended up with:

$$\begin{pmatrix}1&0&-\frac{1}{5} \\ 0&1&-8\\ 0&0&1\end{pmatrix}$$

But this is not the same as the answer $$\begin{pmatrix}1&0&-2\\ 0&1&4\\ 0&0&3\end{pmatrix}$$ that was given. I would really appreciate it if someone could help me figure out where I went wrong in my calculations.

Thank you in advance for your help!

• You made an arithmetic mistake on the first step. You should have $-2--6=4$ but it looks like you did $-2-6=-8$. Commented May 11, 2023 at 23:48

The difference comes from the fact that you swapped rows when you didn't have to: you first use the operation $$R2\to R2-3R_1$$, but then swap R3 and R1. I expect you were supposed to replace R3 with R3+5R1, which gives you $$\left(\begin{array}{ccc} 1 & 0 & -2 \\ 0 & 1 & 4 \\ 0 & -1 & -1\end{array}\right)$$. If you then replace $$R3$$ with $$R3+R2$$ you get the matrix $$\left(\begin{array}{ccc} 1 & 0 & -2 \\ 0 & 1 & 4 \\ 0 & 0 & 3\end{array}\right)$$.