# Find the number of rational roots of $f(x)$

There's a polynomial $f(x)$ such that its degree is 3. All the coefficients of $f(x)$ are rational. If $f(x)$ is a tangent to $x$ axis, what can be the possible number of rational roots of $f(x) = 0$

options are : 0, 1, 2, 3, none

My approach :

Since y = 0 is a tangent to f(x), thus 2 roots are real and imaginary roots occur in pair so all 3 must be rational.

-
@Cocopuffs: The number cannot be exactly two. –  Arturo Magidin Jun 26 '12 at 20:24
@Cocopuffs There can be no rational roots as well and also there cannot be exactly two rational roots counting multiplicity. –  user17762 Jun 26 '12 at 20:25
@Cocopuffs: That has three rational roots: $0$ (twice), and $-1$. –  Arturo Magidin Jun 26 '12 at 20:26

For your tangency problem, you have shown that all roots are real. But there is no proof given that all roots are rational. They are.

Without loss of generality we can assume that the coefficient of $x^3$ is $1$. What I would do is to note that if our polynomial $P(x)$ is tangent to the $x$-axis at $x=a$, then $P(a)=P'(a)=0$.

Now divide the cubic $P(x)$ by $P'(x)$. The remainder is a polynomial of degree at most $1$, with rational coefficients. And $a$ is a root of this remainder. If the remainder is non-zero, that shows $a$ is rational, and therefore so is the remaining root.

If the remainder is $0$, then the cubic has shape $(x-a)^3$, and therefore $a$ is rational.

Remark: For any polynomial $P(x)$, the number $a$ is a multiple root of $P(x)$ if and only if $a$ is a common root of $P(x)$ and $P'(x)$. This is simple to prove, but widely useful.

-

You are right that all three roots must be real; but then you jump to claim that this implies all three roots (counting multiplicity) are rational. Is that really the case?

Since it has a double root, $f(x)$ (up to scaling by a rational factor) can be written as $f(x) = (x-a)^2(x-b)$. If $a=b$ then $f(x)$ satisfies the hypothesis, and you are correct this would $a$ is rational. But why? Because the coefficient of $x^2$ would be $3a$, and if $3a$ is rational, then $a$ is rational.

If $a\neq b$, then the coefficient of $x^2$ is $2a+b$, the coefficient of $x$ is $a^2+2ab$, and the constant coefficient is $a^2b$. If $a$ is rational, then so is $b$ since $2a+b$ is rational; and if $b$ is rational then so is $2a$, hence so is $a$.

Can we have $a$ and $b$ both irrational, and yet have $2a+b$, $a^2+2ab$, and $a^2b$ all rationals? You need to show this is impossible to conclude that all three roots are rational.

-

Sturm's Theorem can determine how many real roots a polynomial has in any interval (or on the real line). For rational roots, you can try the finite number of possibilities given by Rational Root Theorem.

If you are looking for distinct roots, divide the polynomial by the GCD of the polynomial and its derivative (gotten using the Euclidean Algorithm). That will remove any repeated roots. This is done before applying Sturm's Theorem, anyway.

-