<s>[INST] What are the generators for $SL_n(\mathbb{R})$ (Michael Artin's Algebra book) The book asks you to prove that $SL_n(\mathbb{R})$ is generated by elementary (row operation) matrices in which one nonzero off-diagonal entry is added to the identity matrix.  For example, 
$$
\begin{bmatrix}
1 & a \\
0 & 1
\end{bmatrix}
$$
acts by left multiplication on $2\times2$ matrices by adding $a$ times (row 2) to (row 1).   Considering a simple example:
$$
M=
\begin{bmatrix}
a & 0  \\ 
0 & 1/a
\end{bmatrix}, a \neq 0$$
you can see that the matrix $M$ does belong to $SL_n(\mathbb{R})$.  However, the elementary matrices composing $M$ are of the below type and not of the first type (nonzero off-diagonal entry).
$$
\begin{bmatrix}
 c & 0 \\ 
 0 & 1 
\end{bmatrix}
$$
i.e. one nonzero diagonal entry added to the identity matrix.  So 
$$M = 
\begin{bmatrix}
a & 0 \\
0 & 1
\end{bmatrix}
\begin{bmatrix}
1 & 0 \\
0 & 1/a
\end{bmatrix}
$$
So $M$ clearly isn't generated by the first type.  What is going wrong?
 [/INST] The point is, you can do without using elementary row operations of the form $R_i\leftarrow \lambda R_i$. Given a matrix $\begin{pmatrix}a&b\\c&d\end{pmatrix}$ such that its first column is nonzero, we can always reduce its first column to $(1,0)^T$ using only elementary row operations of the form $R_i\leftarrow R_i+kR_j$. In fact, let $k$ be a scalar such that $ka+c\neq0$. Then
$$
\begin{pmatrix}1&0\\-(ka+c)&1\end{pmatrix}
\begin{pmatrix}1&\frac{1-a}{ka+c}\\0&1\end{pmatrix}
\begin{pmatrix}1&0\\k&1\end{pmatrix}
\begin{pmatrix}a&b\\c&d\end{pmatrix}
=\begin{pmatrix}1&\ast\\0&\ast\end{pmatrix}.
$$
The first elementary row operation (i.e. the rightmost one) modifies the $(2,1)$-th entry to nonzero; the second one makes the $(1,1)$-th entry becomes $1$ and the third (the leftmost one) kills off the $(2,1)$-th entry.
For your particular example, we may put $k=1$ and get
$$
\begin{pmatrix}1&0\\-a&1\end{pmatrix}
\begin{pmatrix}1&\frac{1-a}{a}\\0&1\end{pmatrix}
\begin{pmatrix}1&0\\1&1\end{pmatrix}
\begin{pmatrix}a&0\\0&\frac1a\end{pmatrix}
=\begin{pmatrix}1&\frac{1-a}{a^2}\\0&1\end{pmatrix}.
$$
Hence
$$
\begin{align*}
\begin{pmatrix}a&0\\0&\frac1a\end{pmatrix}
&=
\begin{pmatrix}1&0\\1&1\end{pmatrix}^{-1}
\begin{pmatrix}1&\frac{1-a}{a}\\0&1\end{pmatrix}^{-1}
\begin{pmatrix}1&0\\-a&1\end{pmatrix}^{-1}
\begin{pmatrix}1&\frac{1-a}{a^2}\\0&1\end{pmatrix}\\
&=
\begin{pmatrix}1&0\\-1&1\end{pmatrix}
\begin{pmatrix}1&\frac{a-1}{a}\\0&1\end{pmatrix}
\begin{pmatrix}1&0\\a&1\end{pmatrix}
\begin{pmatrix}1&\frac{1-a}{a^2}\\0&1\end{pmatrix}.
\end{align*}
$$
</s>