How to prove that $\varphi$ is an injective homomorphism and why it is surjective? Here is the question I want to solve:
Prove that the subgroup of $SL_2(\mathbb F_3)$ generated by $\begin{pmatrix}
0 & -1 \\
1 & 0
\end{pmatrix}$ and $\begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}$ is isomorphic to the quaternion group of order $8.$[use a presentation for $\mathcal{Q}_8$]
Here is a solution I found online:
A presentation for $\mathcal{Q}_8,$ is $$\langle i,j | i^2 = j^2, i^4 = 1, ij = -ji \rangle$$
Which means that $i,j$ generates $\mathcal{Q}_8$ and they satisfy the relations $i^2 = j^2, i^4 = 1, ji = -ij = i^3j.$
Let $A = \begin{pmatrix}
0 & -1 \\
1 & 0
\end{pmatrix}$ and $B = \begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}.$ Define $\varphi: \{i,j\} \rightarrow \langle A, B \rangle $
as $\varphi(i) = A$ and $\varphi(j) = B.$
Now, note that by direct calculation , the subgroup generated by $A$ is  $$\langle A \rangle = \{ \begin{pmatrix}
0 & -1 \\
1 & 0
\end{pmatrix}, \begin{pmatrix}
-1 & 0 \\
0 & -1
\end{pmatrix}, \begin{pmatrix}
0 & 1 \\
-1 & 0
\end{pmatrix}, \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix} \}$$
And also, by direct calculation , the subgroup generated by $B$ is  $$\langle B \rangle = \{ \begin{pmatrix}
1 & 1 \\
1 & -1
\end{pmatrix}, \begin{pmatrix}
-1 & 0 \\
0 & -1
\end{pmatrix}, \begin{pmatrix}
-1 & -1 \\
-1 & 1
\end{pmatrix}, \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix} \}$$
And it is clear that $|A|=|B| = 4$ and $A^2 = B^2.$\
Also, by direct calculation, we have that $BA = \begin{pmatrix}
1 & -1 \\
-1 & -1
\end{pmatrix} = A^3B.$
Here by the lemma $\varphi$ extends to an injective homomorphism $$\bar{\varphi} : \mathcal{Q}_8 \rightarrow \langle A, B \rangle $$
Also, by construction $\bar{\varphi}$ is surjective. Hence the required is proved.
My questions are:
1-I do not know what lemma says that $\varphi$ is an injective homomorphism, tthis problem is #10 in section 2.4 of Dummit and Foote (3rd edition) and I could not find any lemma that said this. Could anyone help me in proving that $\varphi$ is an injective homomorphism please?
2- Why by construction is $\bar{\varphi}$ is surjective? what confuses me is that $\langle A, B \rangle $ is the subgroup generated by $A$ and $B$ and not the set that contains $A$ and $B,$ Could anyone explain to me this please?

You know that $A^2=B^2$, $A^4=\operatorname{Id}_2$, and that $AB=-BA$. So, since $\mathcal Q_8$ since the group generated by two generators $i$ and $j$ and by the relations $i^2=j^2$, $i^4=e$, and $ij=-ji$, there is a surjective group homomorphism $\varphi$  from $\mathcal Q_8$ onto the subgroup $G$ of $SL_2(\Bbb F_3)$ spanned by $A$ and $B$. But $\mathcal Q_8$ and $G$ have $8$ elements each. Therefore, $\varphi$ is a bijection.
