# Is $f(a)\!=\!0\!=\!f(b)\Rightarrow (x\!-\!a)(x\!-\!b)\mid f(x)\,$ true if $\,a=b?\$ [Double Factor Theorem]

I encountered this proving problem, I can do the proof but my question is why in the condition/premise we need $a$ to be unequal to $b$? My guess is that even $a=b$, the statement is still true, is it correct? If yes, how can we prove it? If false, are there any counter-examples?

The problem: Let $a$ and $b$ be two unequal constants. If $f(x)$ is a polynomial with integer coefficients, and $f(x)$ is divisible by $x-a$ and $x-b$, then $f(x)$ is divisible by $(x-a)(x-b)$.

My proof (just for reference):
Let $q(x)$ be the quotient and $px+r$ be the remainder (where p, r are constants that we have to find) when $f(x)$ is divided by $(x-a)(x-b)$. So we have $f(x)=(x-a)(x-b)q(x)+px+r$.
We then substitute $a$ and $b$ into $f(x)$ and use factor theorem, we get $pa+r$ and $pb+r$. We solve the simultaneous equations we get $p(a-b)=0$, since $a\neq b$, $p=0$ and $r=0$. So $f(x)$ is divisible by $(x-a)(x-b)$.

Helps are greatly appreciated. Thanks!

No, the statement is not correct if $a=b$. For example, let $f=x-a$. Then $f$ is (obviously) divisible by both $x-a$ and $x-a$, while not being divisible by $(x-a)^2$.

By way of analogy, consider the statement "if $p$ and $q$ are two unequal prime numbers, and $n$ is an integer divisible by both $p$ and $q$, then $n$ is divisible by $pq$". That is a correct statement, but if you allow $p=q$ it is false, with counterexamples such as $n=p=q=2$.

The key in both situations is to make sure the ideals of the respective rings are coprime. The ideals $(x-a)$ and $(x-b)$ are coprime if and only if $a\neq b$, and the ideals $(p)$ and $(q)$ of $\mathbb{Z}$ for prime numbers $p,q$ are coprime if and only if $p\neq q$.

There are obvious counterexamples, e.g. $$\,f = x-a.\,$$ Less trivially see the remark below. Here is the theorem you seek.

Bifactor Theorem $$\$$ Let $$\rm\,a,b\in R,\,$$ a ring, and $$\rm\:f\in R[x].\:$$ If $$\rm\ \color{#C00}{a\!-\!b}\$$ is cancellable in $$\rm\,R\,$$ then

$$\rm f(a) = 0 = f(b)\ \iff\ f\, =\, (x\!-\!a)(x\!-\!b)\ h\ \ for\ \ some\ \ h\in R[x]$$

Proof $$\,\ (\Leftarrow)\,$$ clear. $$\ (\Rightarrow)\$$ Applying the Factor Theorem twice, while canceling $$\rm\: \color{#C00}{a\!-\!b},$$

$$\begin{eqnarray}\rm\:f(b)= 0 &\ \Rightarrow\ &\rm f(x)\, =\, (x\!-\!b)\,g(x)\ \ for\ \ some\ \ g\in R[x]\\ \rm f(a) = (\color{#C00}{a\!-\!b})\,g(a) = 0 &\Rightarrow&\rm g(a)\, =\, 0\,\ \Rightarrow\,\ g(x) \,=\, (x\!-\!a)\,h(x)\ \ for\ \ some\ \ h\in R[x]\\ &\Rightarrow&\rm f(x)\, =\, (x\!-\!b)\,g(x) \,=\, (x\!-\!b)(x\!-\!a)\,h(x)\end{eqnarray}$$

Remark $$\$$ The theorem may fail when $$\rm\ a\!-\!b\$$ is not cancellable (i.e. is a zero-divisor), e.g.

$$\rm\quad mod\ 8\!:\,\ f(x)=x^2\!-1\,\Rightarrow\,f(3)\equiv 0\equiv f(1)\ \ but\ \ x^2\!-1\not\equiv (x\!-\!3)(x\!-\!1)\equiv x^2\!-4x+3$$

See here for further discussion of the case of polynomials over a field or domain.