[Math] Applying row operations to a matrix in order to get a diagonal matrix

linear algebramatrices

Is there any way to obtain a diagonal matrix $D$ from a square matrix $A$ applying only row operations $R_{ij}(k)$ with $i\neq j$, $k\in\mathbb R$, which means add to the $i$-th row the $j$-th row multiplied by $k$.
For example, if
$$A = \begin{pmatrix}a&b\\c&d\end{pmatrix},\quad P = \begin{pmatrix}-\frac{\lambda d}{b} & \lambda \\ -\frac{\mu c}{a} & \mu\end{pmatrix} \quad (\lambda,\mu\in\mathbb R) $$
$P A = \begin{pmatrix} * & 0 \\ 0 & * \end{pmatrix}$, but how can $P$ be expressed as product of elementary matrices of that type?
Thanks in advance.

Best Answer

You can't always, e.g. there's no way to get a diagonal matrix from $$\pmatrix{1 & 1\cr 0 & 0\cr}$$ by these operations. But if you don't run into any inconvenient zeros, it is possible. First add appropriate multiples of row $1$ to each other row to make all $a_{i1} = 0$ for $i \ne 1$. Then add appropriate multiples of row $2$ to each other row to make $a_{i2} = 0$ for $i \ne 2$. Continue...