Let $E$ be an elliptic curve over $\mathbb F_p$ (the finite field of $p$ elements) defined by $y^2=x(x-n)(x-m)$ where $p\nmid nm(n-m)$. Let $N$ be the number of $\mathbb F_p$-valued points of $E$. Let $a=p+1-N$.
Then $a=A-B$ where $A$ is the number of elements $x\not=0,n,m$ in $\mathbb F_p$ such that $x(x-n)(x-m)$ is a non-square in $\mathbb F_p$ and $B$ is the number of elements $x\not=0,n,m$ in $\mathbb F_p$ such that $x(x-n)(x-m)$ is a square in $\mathbb F_p$.
I can't see why this is true but I feel like it should be obvious. Can anybody offer any insight into how to show this? Thank you!
Let's count the points on $E$. There's that point at infinity. Then we have exactly $p$ choices for $x$. If to each $x$ there were exactly one $y$ such that $(x,y)\in E$, then the number of ($\Bbb{F}_p$-rational) points on $E$ would be $p+1$.
But let's take the form of the equation into account: $$y^2=x(x-m)(x-n).$$ We see that $y$ only appears squared. Meaning that if $(x,y)\in E$ then so is $(x,-y)$ - two points on $E$ for those choices $x$. If furthermore $y\neq0$ these two points are distinct. But also it is easy to imagine that to some $x$ the r.h.s. has no square root. To such $x$ there is no matching $y$ - no points on $E$ for those choices $x$.
The variable $A$ counts those choices of $x$, where we get one point less than "expected". The variable $B$ counts those choices, where we get one more. Therefore $$ |E|=p+1-A+B. $$