What are the generators for $SL_n(\mathbb{R})$ (Michael Artin's Algebra book)

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*} $$


In the case of $SL_2(\Bbb R)$, let $L(a) = \begin{pmatrix} 1 & a \\ 0 & 1 \end{pmatrix}$ and $R(a) = \begin{pmatrix} 1 & 0 \\ a & 1 \end{pmatrix}$.

Since $L(a)L(b) = L(a+b)$ and $R(a)R(b) = R(a+b)$, you need to find a way to write $\begin{pmatrix} a & 0 \\ 0 & 1/a \end{pmatrix}$ as some finite composition $L(a_1)R(a_2)L(a_3)\ldots$, with $a_i \neq 0$.

It is clearly not of the form $L(a_1)$.
Neither of the form $L(a_1)R(a_2) = \begin{pmatrix} 1 + a_1a_2 & a_1 \\ a_2 & 1 \end{pmatrix}$.
Neither of the form $L(a_1)R(a_2)L(a_3) = \begin{pmatrix} 1 + a_1a_2 & a_1+a_3+a_1a_2a_3 \\ a_2 & 1+a_2a_3 \end{pmatrix}$.
$L(a_1)R(a_2)L(a_3)R(a_4) = \begin{pmatrix} 1 + a_1a_2+a_1a_4+a_3a_4+a_1a_2a_3a_4 & a_1+a_3+a_1a_2a_3 \\ a_2 +a_4+a_2a_3a_4 & 1+a_2a_3 \end{pmatrix}$.

If this is a diagonal matrix, then we need $a_2+a_4+a_2a_3a_4 = a_1+a_3+a_1a_2a_3 = 0$, and then $L(a_1)R(a_2)L(a_3)R(a_4) = \begin{pmatrix} 1 + a_3a_4 & 0 \\ 0 & 1+a_2a_3 \end{pmatrix}$.

So, we have to pick $a_1 = -a_3/(1+a_2a_3) = -a_3a$, $a_2 = -a_4/(1+a_3a_4) = -a_4/a$. Then we are left to pick $a_3$ and $a_4$ such that $a_3a_4 = a-1$.

Pick $a_4=1$. Then $a_3 = a-1, a_2 = -1/a, a_1 = (1-a)/(1+(-1/a)(a-1)) = a(1-a)$. And you can check that $L(a-a^2)R(-1/a)L(a-1)R(1) = \begin{pmatrix} a & 0 \\ 0 & 1/a \end{pmatrix}$