How to find condition on the constant term of a cubic equation with no square term such that the cubic equation has atleast two integer roots? The number of integers $k$ for which the equation $x^3-27x+k=0$ has at least two distict integer roots is ?
a. 1      b. 2      c. 3      d. 4
My attempt is to differentiate this cubic, I get a quadratic with real and distinct roots that is this cubic has a maximum and minimum, hence it cuts the $x$ axis always at three distinct points for any $k$.
Now using Vieta's formulas I conclude that if two roots of the cubic have to be integers, k as well as the third root should be an integer ?
Also there will be one root between $-3$ and $3$ i.e. points of maximum and minimum. Hence taking integer roots between them i.e. $1,2,-1,-2,0$, I get that for none of it I get integer roots for the remaining cubic.
Hence no $k$ exists, i.e. $No.\; of\; k = 0$ which is incorrect.
Where am I wrong or is there a simpler way to find ? Please use basic techniques of algebra to solve not with the help of very advanced topics.
 A: The local extrema of $f(x)=x^3 -27x +k$ are given by $f'(x)=3 x^2 - 27=0$ i.e. $x=\pm 3$.
If two roots of the cubic are to be real, then the third one must be real as well. Also, one of the roots must be between the points of extrema $\pm 3$.
Therefore one of the two integer roots must be in $[-3,3]$. Trying the eligible values for root $x_1$:


*

*$x_1 = 0 \implies k=0 \implies f(x)=x(x^2 - 27)$ with only integer root $0$

*$x_1 = \pm 1 \implies k=\pm 26 \implies f(x)=(x \mp 1)(x^2 \pm x -26)$ with only integer root $\pm 1$

*$x_1 = \pm 2 \implies k=\pm 46 \implies f(x)=(x \mp 2)(x^2 \pm 2 x -23)$ with only integer root $\pm 2$

*$x_1 = \pm 3 \implies k=\pm 54 \implies f(x)=(x \mp 3)^2(x \pm 6)$ with all integer roots $\pm 3, \mp 6$
So, the only values of $k$ for which the equation has two integer roots are $-54,+54$.
A: In another way, 
you already found that
$$
\begin{gathered}
  x_{\,1} ,\,x_{\,2} ,\,x_{\,3} ,k\;\text{integers} \hfill \\
  x_{\,1}  \leqslant  - 3,\quad  - 3 \leqslant x_{\,2} \, \leqslant 3,\quad 3 \leqslant x_{\,3}  \hfill \\ 
\end{gathered} 
$$
where we include the $=$ sign since the roots may coincide at the abscissa of max or min.
Besides that, for the values of the max and min we shall have that
$$
\left\{ \begin{gathered}
  0 \leqslant p( - 3) = \max  = 54 + k \hfill \\
  p(3) = \min  =  - 54 + k \leqslant 0 \hfill \\ 
\end{gathered}  \right.\quad  \Rightarrow  - 54 \leqslant k \leqslant 54
$$
Then, Vieta's formulas tell us that
$$
\left\{ \begin{gathered}
   - x_{\,1} x_{\,2} x_{\,3}  = k \hfill \\
  x_{\,1}  + x_{\,2}  + x_{\,3}  = 0 \hfill \\
  x_{\,1} x_{\,2}  + x_{\,1} x_{\,3}  + x_{\,2} x_{\,3}  =  - k\left( {\frac{1}
{{x_{\,1} }} + \frac{1}
{{x_{\,2} }} + \frac{1}
{{x_{\,3} }}} \right) =  - 27 \hfill \\ 
\end{gathered}  \right.
$$
wherefrom
$$
0 = \left( {x_{\,1}  + x_{\,2}  + x_{\,3} } \right)^{\,2}  = x_{\,1} ^{\,2}  + x_{\,2} ^{\,2}  + x_{\,3} ^{\,2}  + 2\left( {x_{\,1} x_{\,2}  + x_{\,1} x_{\,3}  + x_{\,2} x_{\,3} } \right)
$$
which implies:
$$
x_{\,1} ^{\,2}  + x_{\,2} ^{\,2}  + x_{\,3} ^{\,2}  = 54\quad  \Rightarrow \quad x_{\,3} ^{\,2} ,x_{\,1} ^{\,2}  \leqslant 54
$$
Combining the above with previous equality for the sum, we get the ellipse
$$
\begin{gathered}
  \left\{ \begin{gathered}
  x_{\,1}  + x_{\,2}  + x_{\,3}  = 0 \hfill \\
  x_{\,1} ^{\,2}  + x_{\,2} ^{\,2}  + x_{\,3} ^{\,2}  = 54 \hfill \\ 
\end{gathered}  \right.\quad  \Rightarrow \quad x_{\,1} ^{\,2}  + \left( { - \left( {x_{\,1}  + x_{\,3} } \right)} \right)^{\,2}  + x_{\,3} ^{\,2}  = 54\quad  \Rightarrow  \hfill \\
   \Rightarrow \quad x_{\,1} ^{\,2}  + x_{\,3} ^{\,2}  + x_{\,1} x_{\,3}  = 27\quad  \Rightarrow \quad \frac{{\left( {x_{\,3}  + x_{\,1} } \right)}}
{{6^{\,2} }}^{\,2}  + \frac{{\left( {x_{\,3}  - x_{\,1} } \right)}}
{{\left( {6\sqrt 3 } \right)^{\,2} }}^{\,2}  = 1\quad  \Rightarrow  \hfill \\
   \Rightarrow \quad \frac{{x_{\,2} ^{\,2} }}
{{6^{\,2} }} + \frac{{\left( {x_{\,3}  - x_{\,1} } \right)}}
{{\left( {6\sqrt 3 } \right)^{\,2} }}^{\,2}  = 1 \hfill \\ 
\end{gathered} 
$$
finally reaching to:
$$
\left( {x_{\,3}  - x_{\,1} } \right) = 6\sqrt 3 \sqrt {1 - \frac{{x_{\,2} ^{\,2} }}
{{6^{\,2} }}} \quad \left| {\; - 3 \leqslant x_{\,2} \, \leqslant 3} \right.
$$
and we get that the only possible solutions are:
$$
\left\{ \begin{gathered}
  x_{\,2}  =  \pm 3 \hfill \\
  \left( {x_{\,3}  - x_{\,1} } \right) = 9 \hfill \\
  k =  \pm 54 \hfill \\ 
\end{gathered}  \right.
$$
