# If $f$ is a polynomial of degree $n$, then $f(x) \equiv 0\pmod p$ has at most $n$ solutions.

I know that I have to prove this by induction on $n$ when we let $f(x)=a_{n}x^n + a_{n-1}x^{n-1} +\cdots + a_0$. I have two books in front of me with the complete proof but I don't see how after they assume that the theorem holds for a polynomial of degree $n-1$ and move on to show it holds for a polynomial of degree $n$ they say,

Either $f(x) \equiv 0\pmod p$ has no solution or at least one solution. If it has no solution the theorem holds (How so? how come is it not also true in the second case?).

Then they say, suppose that $r$ is a solution. That is $f(r) \equiv 0\pmod p$, and $r$ is a least residue $\pmod p$. Then because $x-r$ is a factor of $x^t -r^t$ for $t=0,1,2\ldots,n$, we have \begin{align*} f(x)\equiv f(x)-f(r) &\equiv a_{n}(x^n -r^n) + a_{n-1}(x^{n-1} -r^{n-1}) +\cdots + a_0(x -r)\pmod{p}\\ &\equiv (x-r)g(x)\pmod p \end{align*} where $g$ is a polynomial of degree $n-1$. suppose that $s$ is also another solution of (1). Thus $$f(s) \equiv (s-r)g(s)\equiv0 \pmod p$$ because $p$ is prime it follows that $$s\equiv r\pmod p\text{ or }g(s) \equiv 0 \pmod p$$ from the inductions assumption, the second congruence has at most $n-1$ solutions. Since the first congruence has just one solution, the proof is complete.

I would just appreciate is someone could explain the reasoning behind this a little more. Thank you.

-
Can you express what part you have issues with? And what those issues are? One thing that I often do when I have issues with a proof is to take the proof idea but ignore the proof, instead trying to write my own proof using the idea. –  Hurkyl Jul 21 '12 at 2:55
@HowardRoark: Use \pmod{a} to produce $\pmod{a}$. –  Arturo Magidin Jul 21 '12 at 2:59
The bold part mainly. How is it that if it has no solutions the theorem holds? Then how come they decide to use the fact that $x-r$ is a factor of $x^t-r^t$? –  HowardRoark Jul 21 '12 at 3:00
@ArturoMagidin I shall use that from now on. Thanks. –  HowardRoark Jul 21 '12 at 3:01
Sorry, what is $f$? Is it a polynomial with coefficients in $\mathbf Z$? –  Dylan Moreland Jul 21 '12 at 3:03

Remember that you are trying to prove that the congruence $f(x)\equiv 0\pmod{p}$ has at most $n$ solutions. (Added. There must be an assumption that $a_n\not\equiv 0\pmod{p}$ missing, by the way)

The argument is essentially the same one we use to prove that a polynomial of degree $n$ has at most $n$ roots in any field: we do induction on the degree.

If $f$ is of degree $0$, a nonzero constant, then it has no solutions and we are fine.

Assume the result holds for any polynomial of degree less than $n$, and that $f$ has degree $n\gt 0$. If $f$ has no roots, then we are done: $0$ is less than $n$, so $f$ satisfies the conclusion. If $f$ has at least one root $r$, then we can use the Factor Theorem to write $f(x) = (x-r) g(x)$ for some polynomial $g$ of degree $n-1\lt n$. If $s$ is a root of $f$ different from $r$, then $0 = f(s) = (s-r)g(s)$; since $(s-r)\neq 0$, then $g(s)=0$. That is, all other roots of $f$ come from roots of $g$. By the induction hypothesis, $g$ has at most $n-1$ roots. So $f$ has at most $1+n-1 = n$ roots.

This proves that, whether $f$ has at least one root or no roots, it has at most $n$ roots, proving the result.

The argument here is the same. If $f(x)\equiv 0 \pmod{p}$ has no solutions, then you are already done: $0$ is less than $n$. So we can consider the case in which there is at least one solution. It's not that the conclusion will not hold in this latter case (in fact, we will prove it does), it's that the conclusion does not immediately follow: from "at least one solution" we cannot immediately conclude "at most $n$ solutions", whereas from "no solutions" we can immediately conclude "and so at most $n$ (since $0$ is less than $n$)".

Now, we use a lemma:

Lemma. Let $r$ be any integer. Then for any nonnegative integer $t$, $x-r$ divides $x^t - r^t$.

Proof. Simply note that $$(x-r)(x^{t-1}+x^{t-2}r+\cdots +xr^{t-2}+r^{t-1}) = x^t-r^t.\quad\Box$$

Note well: The fact that $x-r$ divides $x^t-r^t$ does not depend on whether $r$ is a root of $f(x)$ or not: it's a simple algebraic fact. It's always true.

Now, if $f(x)$ does have roots modulo $p$, then it has at least one; call it $r$. If $f(x)\equiv 0\pmod{p}$ has at least one root $r$, then we have $f(r)\equiv 0\pmod{p}$. We have \begin{align*} f(x) &\equiv f(x) - 0\pmod{p}\\ &\equiv f(x) -f(r)\pmod{p}\\ &\equiv a_nx^n + \cdots + a_0 - (a_nr^n +\cdots + a_0) \pmod{p}\\ &\equiv a_n(x^n - r^n) + a_{n-1}(x^{n-1}-r^{n-1}) + \cdots + a_1(x-r) + (a_0-a_0)\pmod{p} \end{align*} Now, by the Lemma, $(x-r)$ divides each of $x^n-r^n$, $x^{n-1}-r^{n-1},\ldots,x-r$. So $x-r$ divides $$a_n(x^n-r^n)+a_{n-1}(x^{n-1}-r^{n-1}) + \cdots + a_1(x-r).$$ (This argument takes the place of the Factor Theorem in the case above).

The conclusion is that if $f(r)\equiv 0\pmod{n}$, then we can write $$f(x) \equiv (x-r)g(x)\pmod{p}$$ for some polynomial $g(x)$ with integer coefficients. Now the argument proceeds as in the real case: if $f(s)\equiv 0\pmod{p}$, then $(s-r)g(s)\equiv 0 \pmod{p}$, so $g(s)\equiv 0\pmod{p}$. So any other root of $f$ gives a root of $g$, and since $g$ has at most $n-1$ roots modulo $p$, then $f$ has at most $1+(n-1)=n$ roots modulo $p$.

-
THANK YOU SO MUCH! This is exactly what I needed. –  HowardRoark Jul 21 '12 at 5:38

The idea of the proof is simple. If $\rm\:f(x) = (x\!-\!r)g(x)\:$ has $\rm\:n\!+\!1 > deg\ f\:$ roots then, as shown, the $\rm\:n\:$ roots of $\rm\:f\:$ different from $\rm\:r\:$ are all roots of $\rm\:g,\:$ so $\rm\:g\:$ has $\rm\:n > deg\ g = deg(f)\!-\!1\:$ roots, contra the induction hypothesis.

The proof essentially shows "additivity" of roots, i.e. $\rm\:roots(fg)\, =\, roots(f) \cup roots(g),\:$ which is true precisely because $\rm\,\Bbb Z/p\:$ is a domain, i.e. $\rm\: a,b\not\equiv 0\:\Rightarrow\:ab\not\equiv 0,\:$ i.e. no zero divisors exist. Otherwise it fails, e.g. $\rm\:mod\ 8\!:\ (x-1)(x+1)\:$ has root $\rm\:x\equiv3\:$ which is neither a root of $\rm\:x-1\:$ nor $\rm\:x+1.$

Proved more structurally: $\rm\: a_i\ne a_j\in D\,$ a domain $\rm\Rightarrow\ x-a_i\$ are nonassociate primes in $\rm\:D[x],\:$ since $\rm\: D[x]/(x-a) \cong D\:$ is a domain. So $\rm\: x-a_1\ |\ f(x),\ \ldots\:,\: x-a_n\ |\ f(x)\ \Rightarrow\ (x-a_1)\cdots (x-a_n)\ |\ f(x)\$ by LCM = product for nonassociate primes. Comparing degrees yields a contradiction if $\rm\ n > deg\ f.$

-
Thank you, I really appreciate it! –  HowardRoark Jul 21 '12 at 5:39
Another way of proving this that you might like better: Given a polynomial $f \in \mathbb Z[x]$ we can reduce its coefficients modulo $p$ to obtain an element $\bar f$ of $\mathbb F_p[x]$, where $\mathbb F_p = \mathbb Z/(p)$ is the field with $p$ elements. The result you now want to use is that a polynomial of degree $n \geq 0$ over a field has at most $n$ roots.
To prove that, use induction on $n$ and the division theorem as proved in these notes. To give more detail: if $f$ has a root $a$ then apply the division theorem to $f(x)$ and $x - a$.
[Note that you want to use the degree of the reduced polynomial. The integral polynomial $f(x) = p$, for example, has degree $0$, and yet it has $p$ zeros modulo $p$. Also note that it's important for $\mathbb F_p$ to be a field — the polynomial $2x$ has two roots in $\mathbb Z/(4)$, for example.]