I am reading "Topics in Algebra 2nd Edition" by I. N. Herstein.
This problem is the same problem as Problem 18 and Problem 19 on p.66 in Herstein's book.
I could not solve this problem, so I referred to Jose Carlos Santos's answer above.
Jose Carlos Santos, thank you very much for your answer.
I solved this problem as follows:
I use the result of Problem 20 in Herstein's book:
Problem 20.
Let $G$ be the group of all real $2\times 2$ matrices of the form $\begin{pmatrix}a&b\\0&d\end{pmatrix}$, where $ad\neq 0$, under multiplication. Show that $G^{'}$ is precisely the set of all matrices of the form $\begin{pmatrix}1&x\\0&1\end{pmatrix}$. ($G^{'}$ is the commutator subgroup of $G$.)
My solution to Problem 20:
Let $H$ be the set of all matrices of the form $\begin{pmatrix}1&x\\0&1\end{pmatrix}$.
Let $\begin{pmatrix}a&b\\0&d\end{pmatrix},\begin{pmatrix}e&f\\0&h\end{pmatrix}\in G.$
$$\begin{pmatrix}a&b\\0&d\end{pmatrix}\begin{pmatrix}e&f\\0&h\end{pmatrix}\begin{pmatrix}a&b\\0&d\end{pmatrix}^{-1}\begin{pmatrix}e&f\\0&h\end{pmatrix}^{-1}=\begin{pmatrix}a&b\\0&d\end{pmatrix}\begin{pmatrix}e&f\\0&h\end{pmatrix}\begin{pmatrix}a^{-1}&-\frac{b}{ad}\\0&d^{-1}\end{pmatrix}\begin{pmatrix}e^{-1}&-\frac{f}{eh}\\0&h^{-1}\end{pmatrix}\\=\begin{pmatrix}1&-\frac{f}{h}-\frac{be}{dh}+\frac{af}{hd}+\frac{b}{d}\\0&1\end{pmatrix}\in H.$$
So, $G^{'}\subset H$.
Let $\begin{pmatrix}1&x\\0&1\end{pmatrix}\in H$.
We want to find $a,b,d,e,f,h$ such that $a,d,e,h\in\mathbb{R}-\{0\}$ and $-\frac{f}{h}-\frac{be}{dh}+\frac{af}{hd}+\frac{b}{d}=x$.
Let $d=e=h=1$.
Then, $-\frac{f}{h}-\frac{be}{dh}+\frac{af}{hd}+\frac{b}{d}=-f-b+af+b=(a-1)f$.
We want to find $a, f$ such that $a\in\mathbb{R}-\{0\}$ and $(a-1)f=x$.
Let $f=1$ and $a=x+1$.
Therefore, if $x\neq -1$, then $$\begin{pmatrix}1&x\\0&1\end{pmatrix}=\begin{pmatrix}x+1&0\\0&1\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix}\begin{pmatrix}x+1&0\\0&1\end{pmatrix}^{-1}\begin{pmatrix}1&1\\0&1\end{pmatrix}^{-1}\in G^{'}.$$
Next consider the case in which $x=-1$.
We want to find $a,b,d,e,f,h$ such that $a,d,e,h\in\mathbb{R}-\{0\}$ and $-\frac{f}{h}-\frac{be}{dh}+\frac{af}{hd}+\frac{b}{d}=-1$.
Let $d=h=1$.
Then, $-\frac{f}{h}-\frac{be}{dh}+\frac{af}{hd}+\frac{b}{d}=-f-be+af+b$.
Let $a=1$.
Then, $-f-be+af+b=b(1-e)$.
We want to find $b,e$ such that $e\in\mathbb{R}-\{0\}$ and $b(1-e)=-1$.
Let $e=2, b=1$.
Therefore, $$\begin{pmatrix}1&-1\\0&1\end{pmatrix}=\begin{pmatrix}1&1\\0&1\end{pmatrix}\begin{pmatrix}2&f\\0&1\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix}^{-1}\begin{pmatrix}2&f\\0&1\end{pmatrix}^{-1}\in G^{'}.$$
So, $H\subset G^{'}$.
So, $H=G^{'}$.
Let $G^{'}$ be the commutator subgroup of $GL_2(\mathbb{R})$.
Let $\begin{pmatrix}a&b\\c&d\end{pmatrix},\begin{pmatrix}e&f\\g&h\end{pmatrix}\in GL_2(\mathbb{R})$.
Then, $$\det\begin{pmatrix}a&b\\c&d\end{pmatrix}\begin{pmatrix}e&f\\g&h\end{pmatrix}\begin{pmatrix}a&b\\c&d\end{pmatrix}^{-1}\begin{pmatrix}e&f\\g&h\end{pmatrix}^{-1}=1.$$
So, $$\begin{pmatrix}a&b\\c&d\end{pmatrix}\begin{pmatrix}e&f\\g&h\end{pmatrix}\begin{pmatrix}a&b\\c&d\end{pmatrix}^{-1}\begin{pmatrix}e&f\\g&h\end{pmatrix}^{-1}\in SL_2(\mathbb{R}).$$
So, $G^{'}\subset SL_2(\mathbb{R})$.
Let $\begin{pmatrix}a&b\\c&d\end{pmatrix}\in SL_2(\mathbb{R})$.
First we consider the case in which $a\neq 0$.
By LDU decomposition, $$\begin{pmatrix}a&b\\c&d\end{pmatrix}=\begin{pmatrix}1&0\\\frac{c}{a}&1\end{pmatrix}\begin{pmatrix}a&0\\0&\frac{ad-bc}{a}\end{pmatrix}\begin{pmatrix}1&\frac{b}{a}\\0&1\end{pmatrix}=\begin{pmatrix}1&0\\\frac{c}{a}&1\end{pmatrix}\begin{pmatrix}a&0\\0&\frac{1}{a}\end{pmatrix}\begin{pmatrix}1&\frac{b}{a}\\0&1\end{pmatrix}.$$
We know $\begin{pmatrix}1&\frac{b}{a}\\0&1\end{pmatrix}\in G^{'}$.
Since the transposition of a commutator is also a commutator, $\begin{pmatrix}1&0\\\frac{c}{a}&1\end{pmatrix}\in G^{'}$.
And by the answer of Jose Carlos Santos, $$\begin{pmatrix}a&0\\0&\frac{1}{a}\end{pmatrix}=\begin{pmatrix}a&0\\0&1\end{pmatrix}\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}a&0\\0&1\end{pmatrix}^{-1}\begin{pmatrix}0&1\\1&0\end{pmatrix}^{-1}\in G^{'}.$$
So, $\begin{pmatrix}a&b\\c&d\end{pmatrix}\in G^{'}$.
Next we consider the case in which $a=0$.
$$\begin{pmatrix}0&b\\c&d\end{pmatrix}=\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}c&d\\0&b\end{pmatrix}=\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}c&0\\0&b\end{pmatrix}\begin{pmatrix}1&\frac{d}{c}\\0&1\end{pmatrix}\\=\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}-b^{-1}&0\\0&b\end{pmatrix}\begin{pmatrix}1&-bd\\0&1\end{pmatrix}=\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}-1&0\\0&1\end{pmatrix}\begin{pmatrix}b^{-1}&0\\0&b\end{pmatrix}\begin{pmatrix}1&-bd\\0&1\end{pmatrix}\\=\begin{pmatrix}0&1\\-1&0\end{pmatrix}\begin{pmatrix}b^{-1}&0\\0&b\end{pmatrix}\begin{pmatrix}1&-bd\\0&1\end{pmatrix}.$$
We know $\begin{pmatrix}b^{-1}&0\\0&b\end{pmatrix}\in G^{'}$.
We know $\begin{pmatrix}1&-bd\\0&1\end{pmatrix}\in G^{'}$.
And again, by the answer of Jose Carlos Santos,
$$\begin{pmatrix}0&1\\-1&0\end{pmatrix}=\begin{pmatrix}1&2\\0&1\end{pmatrix}\begin{pmatrix}-1&0\\1&2\end{pmatrix}\begin{pmatrix}1&2\\0&1\end{pmatrix}^{-1}\begin{pmatrix}-1&0\\1&2\end{pmatrix}^{-1}\in G^{'}.$$
So, $\begin{pmatrix}0&b\\c&d\end{pmatrix}\in G^{'}$.
I have no idea how Jose Carlos Santos came up with these decompositions:
$$\begin{pmatrix}a&0\\0&\frac{1}{a}\end{pmatrix}=\begin{pmatrix}a&0\\0&1\end{pmatrix}\begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}a&0\\0&1\end{pmatrix}^{-1}\begin{pmatrix}0&1\\1&0\end{pmatrix}^{-1}\in G^{'}.$$
$$\begin{pmatrix}0&1\\-1&0\end{pmatrix}=\begin{pmatrix}1&2\\0&1\end{pmatrix}\begin{pmatrix}-1&0\\1&2\end{pmatrix}\begin{pmatrix}1&2\\0&1\end{pmatrix}^{-1}\begin{pmatrix}-1&0\\1&2\end{pmatrix}^{-1}\in G^{'}.$$