# Test for an Integer Solution

This came up an a training piece for the Putnam Competition and also in Ireland and Rosen.

The question posed was basically:

Let $p(x)$ be a polynomial with integer coefficients satisfying that $p(0)$ and $p(1)$ are odd. Show that $p$ has no integer zeros.

I&R give an example:

$p(x) = x^2 - 117x + 31$ and show (no problem) that for any $n$ whether even or odd, $p(n)$ will be odd. And claim that this shows $p(n)$ will never be $0$.

I can see, e.g., that $x^2 + 2x + 1$ will be odd substituting an even $n$ and even for an odd $n$.

But would appreciate help in understanding the underlying math and what is happening here.

Also, as a second part, can a general statement about the existence of an integer solution be made if $n$, even and odd, generates an even and an odd as in the last example.

I can see that if you look at these equations (mod $2$), you can distinguish whether there is an integer solution. And I would guess this is intimately connected with the question.

Thanks as always.

• In general, for a polynomial to have an integer root, it must have an integer root modulo $n$ for all integers $n>1$. This problem has the special case of $n=2$. – Thomas Andrews Aug 14 '12 at 20:46
• Nice problem. But tell us something about your own thoughts toward solving it, and where you are stuck. – Barry Cipra Apr 14 '14 at 15:24
• Frankly speaking , i just understood that constant and sum of coefficient are odd – avz2611 Apr 14 '14 at 16:01
• Have you checked, for example, what happens with quadratic polynomials? Or how about the linear case? In general, when you don't have any idea how to solve a problem, it's a good idea to start with a look at special cases. – Barry Cipra Apr 14 '14 at 16:16
• As far as linear goes it is pretty simple that it wont work out , in quadratic i have observed that one having all odd coefficient will never have integral roots – avz2611 Apr 14 '14 at 17:03

## 7 Answers

Hint $\$ If an integer coefficient polynomial has an integer root $\rm\,n,\,$ i.e.$\rm\ p(n) = 0,\$ then $\rm\,n\,$ remains a root modulo $2$, i.e. $\rm\ p(n)\equiv 0\,\ (mod\ 2).\:$ So, contrapositively, if a polynomial has no roots modulo $2$ then it has no integer roots. This leads to the following simple

Parity Root Test $\$ A polynomial $\rm\:P(x)\:$ with integer coefficients has no integer roots if its constant coefficient and coefficient sum are both odd.

Proof $\$ The test verifies that $\rm\ P(0) \equiv 1\equiv P(1)\ \ (mod\ 2)\:,\$ i.e. that $\rm\:P(x)\:$ has no roots modulo $2$, hence no integer roots. $\$ QED

E.g. $\rm\:\ a\ X^2 + b\ X + c\$ has no integer roots if $\rm\:c\:$ is odd and $\rm\:a,\:b\:$ have equal parity $\rm\:a\equiv b\ (mod\ 2)$

The Parity Root Test generalizes to any ring with a sense of parity, e.g. the Gaussian integers $\rm\: a + b\,{\it i}\$ for integers $\rm\:a,b.\:$ For much further discussion see this post and also these related posts.

• Nice and thanks. – user12802 Aug 14 '12 at 21:34
• So you could have a similar criterion using mod 3: suppose p(-1), p(0), p(1) are not divisible by 3 then p does not have an integer root. – i. m. soloveichik Aug 15 '12 at 0:54
• Yes, it works mod $\,\rm m\,$ for any $\rm\,m\ge 2.\:$ It's a simple example of modular problem solving - looking at "simpler" structure-preserving images of problems. It's the algebraists way to "divide and conquer". For another example of the power of parity $\rm(m = 2)$ see this question. Here one quickly shows that a matrix is invertible since it has odd (so nonzero) determinant. That this simple answer got 54 votes seems to indicate how little known is the wide applicability of modular reduction, even in the case of simple parity arguments. – Bill Dubuque Aug 15 '12 at 1:08
• @i.m.soloveichik These ideas will come to the fore if you study abstract algebra. There the structure-preserving maps are known as homomorphisms and the simpler images are known as quotient objects, e.g. modular / congruence arithmetic is a special case of a quotient ring (a.k.a. residue or factor ring). – Bill Dubuque Aug 15 '12 at 3:08

We know

$$f(0) \equiv 1 \pmod{2}$$

This means that the constant term of $f$ is an odd integer.

We also know

$$f(1) \equiv 1 \pmod{2}$$

This means that the sum of the coefficients of $f$ is odd.

Consider $f(x)$ for a general $x \in \mathbb{Z}$.

Case 1: $x$ is even.

If $x$ is even, all of the powers of $x$ must also be even, and since the product of even numbers with any integer coefficients is also even, everything but the constant term of $f$ is even. Thus, $f(x)$ must be odd.

Case 2: $x$ is odd.

If $x$ is odd, all of the powers of $x$ must also be odd. We have a bunch of odd numbers $x^i$ (including $x^0)$, and we are adding multiples of them together. We know that the sum of the coefficients is odd; this means we have, in total, an odd number of $x^i$s. The sum of an odd number of odd numbers must be odd, and so $f(x)$ is odd.

We've proven that $f(x)$ is odd for integer $x$. It follows, a fortiori, that $f(x)$ is nonzero.

• Dear Zubin - I actually also went to Yale, but had no notion of this as a freshman (or later for that matter since I am a self-studier, starting when I was 66). Wishing you much success. With regards, – user12802 Aug 25 '14 at 19:21

Hint: What can you say about $f(x) \pmod{2}$?

If you plug an integer into a polynomial and this equals zero, then you can look at the entire computation mod your favorite $n$. In this case, try two. What does the equation look like then?

If $p(0)$ and $p(1)$ are both odd, then $p(x)$ cannot have any integer roots. If it did, then there would be a solution to $p(x)\equiv0$ mod $2$. But $p(0)\equiv p(1)\equiv1\not\equiv0$ mod $2$.

If you're not comfortable with modular arithmetic here, suppose $p(x)=(x-r)q(x)$ with an integer root $r$. Then $-rq(0)=p(0)$ implies $r$ is odd, but $(1-r)q(1)=p(1)$ implies $1-r$ is odd, which implies $r$ is even. Taken together, we have a contradiction.

If there is an integer solution to $f(x)=0$, say $a$, then, if $a$ is even, $f(a)\equiv f(0)\equiv 1\mod 2$ and if $a$ is odd, $f(a)\equiv f(1)\equiv 1\mod 2$. So, no integer solution is possible.

The mod $2$ thing is easiest. Here is another idea.

Note that the polynomial expression $f(x)-f(y)$ is divisible by $x-y$ because $x^r-y^r=(x-y)(x^{r-1}+x^{r-2}y+\dots + xy^{r-2}+y^{r-1})$ and the polynomial is built up from such expressions.

So $f(n)-f(0)$ is divisible by $n$, and $f(n)-f(1)$ is divisible by $n-1$. Whence $-1$ is divisible by both $n$ and $n-1$ and you can complete the argument in various ways.

I mention the method because it can be used to answer questions about $n$ in other circumstances. For example, if you are given/have $f(7)=3$ and you want $f(n)=0$ you have $(n-7)|3$ so that $n=4, 6, 8, 10$ are the only possibilities.