0

Let $f=aX^2+bX+c \in \mathbb{Z}[X]$ be a quadratic polynomial and $p$ a prime number. I need to find all solutions $x \in \mathbb{Z}$, s.t. $p$ divides $f(x)\in \mathbb{Z}$. I'm sure there is an algorithm for it, but unfortunately I don't know it.

2 Answers2

1

Well this is equivalent to finding the roots of $ax^2 + bx + c \in \mathbb{Z}_p[x]$

$\mathbb{Z}_p$ is a field, so actually the quadratic formula still applies:

So the two solutions (assuming the descriminant is a quadratic residue) are:

$$ x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$$

So really this boils down to two problems:

Karan Elangovan
  • 893
  • 4
  • 9
1

Hint:

You need to study the case $p=2$ separately.

If $p \neq 2$ you have $$ax^2+bx+c= 0 \pmod{p} \Leftrightarrow \\ 4a^2x^2+4abx+4ac = 0 \pmod{p} \Leftrightarrow \\ (2ax+b)^2 = b^2-4ac \pmod{p} $$

This equation has:

  • $2$ distinct solutions if $\left( \frac{b^2-4ac}{p} \right)=1$
  • $1$ double solutions if $p|b^2-4ac$
  • no solution if $\left( \frac{b^2-4ac}{p} \right)=-1$

Here $\left( \frac{b^2-4ac}{p} \right)$ is the Legendre symbol.

If you need to find them, you need to first figure if there are solutions and in the case, $\left( \frac{b^2-4ac}{p} \right)=1$ you have to find one solution to $$y^2=b^2-4ac$$ by trial and error.

N. S.
  • 132,525