TITLE: Is natural map $\operatorname{SL}_2(\mathbb{Z}) \to \operatorname{SL}_2(\mathbb{Z}/n\mathbb{Z}) $ surjective?
QUESTION [7 upvotes]: I am trying to prove that the the natural map from the special linear group $\operatorname{SL}_2(\mathbb{Z})$ to the special linear group $\operatorname{SL}_2(\mathbb{Z}/n\mathbb{Z})$ is surjective. Clearly, the problem lies in finding an inverse with determinant one. If have following outline of a proof :
Pick a matrix $\big(\begin{smallmatrix}a &b \\c& d\end{smallmatrix}\big)\in \operatorname{SL}_2(\mathbb{Z}/n\mathbb{Z})$. Use the Chinese remainder theorem to find $b'=b \text{ mod } n$ such that $a$ and $b$ are relatively prime... Once I have this I can find an inverse.
The problem is that I cannot figure out how the Chinese remainder theorem could be of use, since there is no reason to assume $a$ and $n$ (capital $N$ in proof) have ggd=1. 
If so one could say there is a solution of $b'=b \bmod N$ and $b'= 1 \bmod a$.  
But I fail to see how they do it in general. 
Many thanks!

REPLY [3 votes]: Define the subsets $S$ and $T$ of $\text{M}_2(\mathbb Z)$ by 
$\bullet\ A\in S\iff A\equiv g\bmod n$ for some $g$ in $\text{SL}_2(\mathbb Z)$ depending on $A$,
$\bullet\ A\in T\iff\det(A)\equiv1\bmod n$.
In particular 
$$
G:=\text{SL}_2(\mathbb Z)\subset S\subset T\subset\text{M}_2(\mathbb Z).
$$
We must show $S=T$. 
Clearly
$\bullet\ G\times G$ act on $S$ and $T$ by 
$$
(g,h)A=gAh^{-1},
$$
$\bullet$ for each $A$ in $T$ there are $g,h\in G$ such that $gAh^{-1}$ is diagonal.
Thus, it suffices to show that any $\text{diag}(a,d)\in T\ $ belongs to $S$.
It is straightforward to check that, as Alex Youcis noticed, there are integers $c'$ and $d'$ satisfying 
$$
S\ni
\begin{pmatrix}a&n\\c'&d'\end{pmatrix}\equiv
\begin{pmatrix}a&0\\0&d\end{pmatrix}\bmod n.
$$
The general lemma is:
If $a,b,n$ are integers such that $\gcd(a,b)=1$, then any solution mod $n$ to 
$$
ax+by=1\tag1
$$
lifts to an exact solution. That is, if $x_0$ and $y_0$ satisfy 
$$
ax_0+by_0\equiv1\bmod n,
$$
then there is a solution to $(1)$ such that 
$$
x\equiv x_0,\quad y\equiv y_0\quad\bmod n.
$$