%! TEX root = NT.tex
% vim: tw=50
% 27/10/2023 10AM

\begin{remark*}
  (This remark is unrelated to the current
  content). Given that we know that a
  \gls{prim_root} exists \gls{modulo} any
  \gls{prime}, one question we
  might ask is :``Can $a$ be a \gls{prim_root} for
  all sufficiently large \glspl{prime} $p$?''

  The answer is no. One can prove this using the
  \gls{jac_symb} and Dirichlet's Theorem on
  \glspl{prime} in arithmetic progressions.
\end{remark*}
\vspace{-1em}

We know:
\begin{itemize}
  \item \Gls{equiv_bqf} \glsref[bqf]{forms}
    \gls{bqf_rep} the same integers ($N = f(m,
    n)$, $m, n \in \ZZ$).
  \item \Gls{equiv_bqf} \glsref[bqf]{forms} have
    the same \gls{disc_bqf}.
  \item \glsref[equiv_bqf]{Equivalence} is an
    equivalence relation.
\end{itemize}
We said that a \gls{bqf} $f(x, y)$ is
\gls{posdef_bqf} if $\forall \mathbf{v} \in \RR^2
- 0$, $f(\mathbf{v}) > 0$. We showed that $f$ is
\gls{posdef_bqf} $\iff$ $\disc f < 0$, $a > 0$,
$\iff$ $\disc f < 0$, $c > 0$.

\glsnoundefn{pdbqf}{PDBQF}{PDBQFs}
We will now study
equivalence classes of PDBQFs (\gls{posdef_bqf}
\glspl{bqform}) of fixed \gls{disc_bqf} $d \in
\ZZ$, $d \equiv 0, 1 \pmod{4}$, $d < 0$. The set
of classes is always non-empty since
\[ x^2 + \frac{d}{4} y^2 \qquad \text{or} \qquad
x^2 + y + \frac{(1 - d)}{4} y^2 \]
is a \gls{pdbqf} of \gls{disc_bqf} $d$.

\textbf{Question:} If we are given a \gls{pdbqf}
$(a, b, c)$, when can we find an \gls{equiv_bqf}
one with smaller coefficients?

\begin{example*}
  $f(x, y) = 10x^2 + 34xy + 29y^2 = \bqfb(10, 34, 29)$.
  We try to decrease the coefficients by acting by
  the \glspl{unimod_cv}
  \glssymboldefn{pdbqf_swap}{S}{S}
  \glssymboldefn{pdbqf_translate}{T}{T}
  \begin{flashcard}[reduction-matrices]
    \prompt{Matrices used to reduce a \gls{pdbqf}?}
  \[ T_{\pm} = \cloze{
  \begin{pmatrix}
    1 & 0 \\
    \pm 1 & 1
  \end{pmatrix}}
  \qquad \text{and} \qquad
  S = \cloze{
  \begin{pmatrix}
    0 & 1 \\
    -1 & 0
  \end{pmatrix}
  } \]
  \end{flashcard}
  \begin{hiddenflashcard}[action-of-swap-translate-pdbqf]
    \prompt{What are the actions of $\swap$ and
    $\translate_{\pm}$ on a \gls{pdbqf} $(a, b, c)$?}
    \[ \translate_{\pm} : \bqfb(a, b, c) \to
    \cloze{\bqfb(a, b \pm
    2a, c \pm b + a)}, \qquad \swap : \bqfb(a, b, c)
    \to \cloze{\bqfb(c, -b, a)} \]
  \end{hiddenflashcard}
  \textbf{Fact:} $S_1, T_{\pm}$ generate
  $\SL_2(\ZZ)$, so any \gls{unimod_cv} is a
  composite of these.

  If $g(x, y) = ax^2 + bxy + cy^2$, then for
  $\lambda = \pm 1$,
  \begin{align*}
    (\translate_\lambda g) (x, y)
    &= g((x, y)\translate_\lambda) \\
    &= g(x + \lambda y, y) \\
    &= a(x + \lambda y)^2 + b(x + \lambda y)y +
    cy^2 \\
    &= ax^2 + (b + 2a\lambda) xy + (c + b\lambda +
    a\lambda^2)y^2
  \end{align*}
  So $\translate_{\pm} : \bqfb(a, b, c) \mapsto
  \bqfb(a, b \pm 2a, c
  \pm b + a)$. So we can make \gls{unimod_cv}
  for $f$ as follows:
  \[ \bqfb(10, 34, 29)
  \stackrel[\translate_-]{}{\longrightarrow} \bqfb(10, 14, 5)
  \stackrel[\translate_-]{}{\longrightarrow} \bqfb(10, -6, 1) .\]
  We have
  \[ (\swap \cdot g) (x, y) = g \left( (x, y)
  \begin{pmatrix}
    0 & 1 \\
    -1 & 0
  \end{pmatrix}
  \right) = g(-y, x) = cx^2 - bxy + ay^2 .\]
  If $a > c$, we can act by $\swap$ to reduce the size
  of $a$, just as when $|b| > 2a$ we could act by
  one of $\translate_+$, $\translate_-$ to reduce the size of $b$.
  \[ \bqfb(10, -6, 1) \stackrel[\swap]{}{\longrightarrow}
  \bqfb(1, 6, 10)
  \stackrel[\translate_-]{}{\longrightarrow} \bqfb(1,
  4, 5) \stackrel[\translate_-]{}{\longrightarrow}
  \bqfb(1, 2,
  2) \stackrel[\translate_-]{}{\longrightarrow}
  \bqfb(1, 0, 1) .\]
  We've proved that $f(x, y) = 10x^2 + 34xy +
  29y^2$ is \gls{equiv_bqf} to $x^2 + y^2$.
\end{example*}

\begin{flashcard}[reduced-bqf-defn]
\begin{definition}[Reduced \gls{pdbqf}]
  \glsadjdefn{red_pdbqf}{reduced}{\gls{pdbqf}}
  \cloze{
  We say a \gls{pdbqf} $\bqfb(a, b, c)$ is
  \emph{reduced} if $-a < b \le a \le c$ and if $a
  = c$, then $b \ge 0$.
  }
\end{definition}
\end{flashcard}

\begin{example*}
  $10x^2 + 34xy + 29y^2$ is not \gls{red_pdbqf}. $x^2 +
  y^2$ is \gls{red_pdbqf}.

  In general, if $\bqfb(a, b, c)$ is \gls{red_pdbqf},
  then $c \ge a \ge |b| \ge 0$.
\end{example*}

\begin{flashcard}[pdbqf-equiv-reduced-prop]
\begin{proposition}
  Any \gls{pdbqf} is \gls{equiv_bqf} to a
  \gls{red_pdbqf} one.
\end{proposition}

\begin{proof}
  \cloze{
  Starting with $\bqfb(a, b, c)$ we act as follows. If
  $a > c$, then act by $\swap$ to replace $\bqfb(a, b,
  c)$ by $\bqfb(c, -b, a)$. This decreases $a$ and
  doesn't change $|b|$. If $a \le c$, but $|b| >
  a$, then act by one of $\translate_{\pm} : \bqfb(a,
  b, c) \to \bqfb(a, b \pm 2a, c \pm b + a)$ to
  decrease $|b|$ and leave $a$ the same.

  Repeat these steps until $a \le c$ and $|b| \le
  a$. The process must terminate as $a + |b|$ is a
  positive integer, but decreases by at least $1$
  each time we act by $\pm 1$.

  The \glsref[bqf]{form} $\bqfb(a, b, c)$ is then
  \gls{red_pdbqf} except possibly if $c > a$ and $b
  = -a$ or if $a = c$ and $b < 0$. If $c > a$, $b
  = -a$, then $f = \bqfb(a, -a, c)$, $\translate_+
  f = \bqfb(a, a, c)$
  is \gls{red_pdbqf}. If $c = a$, $b < 0$, then $f =
  \bqfb(a, b, a)$, $\swap f = \bqfb(a, -b, a)$ is \gls{red_pdbqf}.
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[red-pdbqf-facts-lemma]
\begin{lemma}
  If $\bqfb(a, b, c)$ is a \gls{red_pdbqf} \gls{pdbqf}
  then \cloze{$|b| \le a \le \sqrt{\frac{|d|}{3}}$, where
  $d = b^2 - 4ac$ and $b \equiv d \pmod{2}$.}
\end{lemma}

\begin{proof}
  \cloze{
  $b^2 \equiv d \pmod{4} \implies b \equiv d
  \pmod{2}$. We have $c \ge a \ge |b| \ge 0$, $-d
  = 4ac - b^2 \ge 4ac - ac = 3ac \ge 3a^2$
  \[ \implies a \le \sqrt{\frac{|d|}{3}} \qedhere \]
  }
\end{proof}
\end{flashcard}

\begin{example*}
  Let's enumerate all \gls{red_pdbqf}
  \glsref[bqf]{forms} of \gls{disc_bqf} $-4$. If
  $\bqfb(a, b, c)$ is \gls{red_pdbqf}, $b^2 - 4ac =
  4$, then $c \ge a \ge |b| \ge 0$, $b \equiv 0
  \pmod{2}$, $a \le \sqrt{\frac{4}{3}}$ so $a =
  1$. Since $b$ is even, $|b| \le 1$, we must have
  $b = 0$. Since $b^2 - 4ac = -4$, this fixes $c =
  1$. So $x^2 + y^2$ is the only \gls{red_pdbqf} of
  \gls{disc_bqf} $-4$, so any \gls{pdbqf} of
  \gls{disc_bqf} $-4$ is \gls{equiv_bqf} to $x^2 +
  y^2$.
\end{example*}

\begin{corollary}
  If $p$ is an odd \gls{prime}, then $p$ is
  \gls{bqf_rep} $x^2 + y^2$ if and only if $p
  \equiv 1 \pmod{4}$.
\end{corollary}

\begin{proof}
  \phantom{}
  \begin{enumerate}[$\Rightarrow$]
    \item[$\Rightarrow$] Easy.
    \item[$\Leftarrow$] We know $p \equiv 1
      \pmod{4}$ implies $\legendre{-1}{p} = 1$, so
      there exists $n \in \ZZ$ such that $n^2
      \equiv -1 \pmod{p}$. So $\exists n, k \in
      \ZZ$ such that $n^2 = -1 + pk$. Then $-4 =
      4n^2 - 4pk = \disc (px^2 + 2nxy + ky^2)$. So
      $f(x, y) = px^2 + 2nxy + ky^2$ is a
      \gls{pdbqf} of \gls{disc_bqf} $-4$, which
      \glsref[bqf_rep]{represents} $p$, as $f(1,
      0) = p$. $f$ is equivalent to the
      \gls{red_pdbqf} \glsref[bqf]{form} $x^2 +
      y^2$.
      \glsref[equiv_bqf]{Equivalent}
      \glsref[bqf]{forms} \gls{bqf_rep} the same
      integers, so $x^2 + y^2$
      \glsref[bqf_rep]{represents} $p$. \qedhere
  \end{enumerate}
\end{proof}
