[step:Transform $f$ via convergent substitutions and track the new coefficients]
For each $n \geq 0$, the [Matrix Identity for Convergents](/theorems/1759) gives
\begin{align*}
\theta &= \frac{p_n \theta_{n+1} + p_{n-1}}{q_n \theta_{n+1} + q_{n-1}},
\end{align*}
where $\theta_{n+1}$ is the $(n+1)$-st complete quotient. Consider the linear substitution
\begin{align*}
\Phi_n: \mathbb{Z}^2 &\to \mathbb{Z}^2 \\
(X, Y) &\mapsto (p_n X + p_{n-1} Y,\, q_n X + q_{n-1} Y),
\end{align*}
whose integer matrix has determinant $p_n q_{n-1} - p_{n-1} q_n = (-1)^{n-1} = \pm 1$ by the [Determinant Identity for Convergents](/theorems/1757). Hence $\Phi_n \in \operatorname{GL}_2(\mathbb{Z})$. Define the pulled-back form
\begin{align*}
f_n(X, Y) &:= f(\Phi_n(X, Y)) = A_n X^2 + B_n X Y + C_n Y^2,
\end{align*}
with integer coefficients
\begin{align*}
A_n &= f(p_n, q_n), \qquad C_n = f(p_{n-1}, q_{n-1}), \qquad B_n = 2 a p_n p_{n-1} + b (p_n q_{n-1} + p_{n-1} q_n) + 2 c q_n q_{n-1}.
\end{align*}
Since $\Phi_n$ has determinant $\pm 1$, discriminants are preserved:
\begin{align*}
\operatorname{disc}(f_n) = B_n^2 - 4 A_n C_n &= \operatorname{disc}(f).
\end{align*}
Moreover, applying $\Phi_n$ to the pair $(\theta_{n+1}, 1)$,
\begin{align*}
\Phi_n(\theta_{n+1}, 1) &= (p_n \theta_{n+1} + p_{n-1},\, q_n \theta_{n+1} + q_{n-1}) = (q_n \theta_{n+1} + q_{n-1}) \cdot (\theta, 1),
\end{align*}
and since $f(\lambda v) = \lambda^2 f(v)$ for scalars $\lambda$, $f_n(\theta_{n+1}, 1) = (q_n \theta_{n+1} + q_{n-1})^2 f(\theta, 1) = 0$. Thus $\theta_{n+1}$ is a root of the quadratic $A_n t^2 + B_n t + C_n = 0$.
Finally, note that $C_n = f(p_{n-1}, q_{n-1}) = A_{n-1}$, so the sequence $(A_n)$ determines $(C_n)$ by a shift.
[/step]