Solution (source code)

= Solution

Write
$$
M=\begin{pmatrix}p&q\\r&s\end{pmatrix}.
$$
The first column has unit length for the indefinite quadratic form:
$$
p^2-r^2=1.
$$
Because $p=M_{11}>0$, there is a unique $u\in\mathbb R$ such that
$$
p=\cosh u,\qquad r=\sinh u.
$$
The two columns are orthogonal for the same form and the second has squared length $-1$:
$$
pq-rs=0,\qquad q^2-s^2=-1.
$$
The vectors with these properties are
$$
(q,s)=\pm(\sinh u,\cosh u).
$$
Using the <hyperbolic cosine> and <hyperbolic sine>, the two possible families are therefore
$$
\boxed{
\begin{pmatrix}\cosh u&\sinh u\\\sinh u&\cosh u\end{pmatrix},
\qquad
\begin{pmatrix}\cosh u&-\sinh u\\\sinh u&-\cosh u\end{pmatrix}},
\qquad u\in\mathbb R.
$$