<s>[INST] What is wrong in the following calculation for the inverse of a matrix? $\left[\begin{array}{ccc|ccc}
 0 & 3 & 0 &      1 & 0 & 0\\
 4 & 0 & 0 &      0 & 1 & 0\\
 0 & 0 & 5 &      0 & 0 & 1
\end{array}\right]$
Exchange the first and the second columns:
$\left[\begin{array}{ccc|ccc}
 3 & 0 & 0 &      0 & 1 & 0\\
 0 & 4 & 0 &      1 & 0 & 0\\
 0 & 0 & 5 &      0 & 0 & 1
\end{array}\right]$
Divide the rows by $3$, $4$, and $5$ respectively:
$\left[\begin{array}{ccc|ccc}
 1 & 0 & 0 &      0 & \frac{1}{3} & 0\\
 0 & 1 & 0 &      \frac{1}{4} & 0 & 0\\
 0 & 0 & 1 &      0 & 0 & \frac{1}{5}
\end{array}\right]$
Obviously, the result is not the inverse of the initial matrix. Where is the mistake?
 [/INST] You shoul work on columns or on rows, never on both.
</s>