Solution (source code)

= Solution

The <matrix trace> is the sum of diagonal entries:
$$
\operatorname{Tr}M=a^2+1-1=a^2.
$$
Consequently
$$
\boxed{a=\pm\sqrt3,\qquad b\in\mathbb R\text{ arbitrary}.}
$$
The first diagonal entry is $a^2$ in the original PDF.