  Let $\Phi(N)$ denote the number of products of matrices $[
\begin{smallmatrix} 1 & 1 \\ 0 & 1 \end{smallmatrix}]$ and $[
\begin{smallmatrix} 1 & 0 \\ 1 & 1 \end{smallmatrix} ]$ of trace equal to $N$,
and $\Psi(N)=\sum_{n=3}^N \Phi(n)$ be the number of such products of trace
between $3$ and $N$. We prove an asymptotic formula of type $\Psi(N) = c_1 N^2
\log N +c_2 N^2 + O_\varepsilon (N^{7/4+\varepsilon})$ as $N\to \infty$. As a
result, the Dirichlet series $\sum_{n=1}^\infty \Phi(n) n^{-s}$ has a
meromorphic extension in the half-plane $\Re (s)>7/4$ with a single, order two
pole at $s=2$. Our estimate also improves on an asymptotic result of Faivre
concerning the distribution of reduced quadratic irrationals, providing an
explicit upper bound for the error term.
