The question is:
Show that the matrices \begin{pmatrix} \cosh \theta & \sinh \theta\\ \sinh \theta & \cosh \theta \end{pmatrix} leave invariant the real quadratic form $x_1^2-x_2^2$ and constitute the group $SO(1,1).$
I did the invariance part as follows : $$ x_1^\prime =x_1 \cosh \theta+ x_2\sinh \theta, \ \ \ x_2\prime =x_1\sinh \theta+x_2\cosh \theta $$ which gives $$(x_1^\prime) ^2- (x_2^\prime) ^2 = x_1^2-x_2^2.$$ But I don't know how to show that this transformation will give the group $SO(1,1).$
This is 'true'.
Let $M$ be an matrix $2\times2$ with $\det(M)\neq 0$ of the form ($a,b,c,d \in \mathbb{R}$)
$$M = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)$$
We have that $M \in SO(1,1)$ if, for $\eta := \left(\begin{matrix}1&0\\0&-1\end{matrix}\right)$ we have that
and we have that $\det(M)=+1$. So, we have that
$$M^{-1} = \frac{1}{\det(M)}\left(\begin{matrix}d&-b\\-c&a\end{matrix}\right) =\left(\begin{matrix}d&-b\\-c&a\end{matrix}\right) $$
And
$$\eta M^T \eta = \left(\begin{matrix}a&-c\\-b&d\end{matrix}\right) $$
if set the equality quoted we get that $a=d$ and $b = c$ so the group have the form
Set $a = \cosh(\theta)$ for $\theta \in \mathbb{R}$ then you have your matrix. Note that you do not get all the group
As pointed out in the comments, we can see that $SO(1,1)$ have two connected components because this Lie-Group has a homeomorphism to $H_+ \cup H_-$ where
$$H_{\pm} = \left\{(x,y)\in\mathbb{R} : x = \pm \sqrt{y^2+1}, y\in \mathbb{R}\right\}$$
This implies that this group has two conex components, lets call them $L_+$ and $L_-$
$L_+$ is generated by matrix of the form, for $b\in \mathbb{R}$
$$\left(\begin{matrix}\sqrt{1+b^2}&b\\b&\sqrt{1+b^2}\end{matrix}\right)$$
and $L_-$ is generated by matrix of the form
$$\left(\begin{matrix}-\sqrt{1+b^2}&b\\b&-\sqrt{1+b^2}\end{matrix}\right)$$
The matrix pointed out in comments is in $L_-$. If there is some problem with my answer someone could explain in comments.