Solution (source code)

= Solution

The <Hasse theorem for elliptic curves> states that every <elliptic curve> $E/\mathbb F_q$ satisfies
$$
\boxed{\left|\#E(\mathbb F_q)-(q+1)\right|\leq2\sqrt q.}
$$
Let $\pi$ be the <Frobenius isogeny> and put $a=\operatorname{tr}(\pi)$. Its fixed points are exactly $E(\mathbb F_q)$, so separability of $1-\pi$ gives
$$
\#E(\mathbb F_q)=\deg(1-\pi)=1+q-a.
$$
The <degree of an isogeny> is a nonnegative <quadratic form> on the endomorphism ring, and for all integers $m,n$,
$$
\deg([m]+[n]\pi)=m^2+amn+qn^2\geq0.
$$
If $a^2>4q$, this quadratic polynomial has two real roots and takes a negative value at some rational $m/n$ between them, hence after clearing denominators at some integer pair $(m,n)$. Therefore $a^2\leq4q$, and substituting $a=q+1-\#E(\mathbb F_q)$ proves the bound. This is the <degree-form proof of the Hasse bound>.