# Given $P(x)=x^{4}-4x^{3}+12x^{2}-24x+24,$ then $P(x)=|P(x)|$ for all real $x$

$$P(x)=x^{4}-4x^{3}+12x^{2}-24x+24$$

I'd like to prove that $$P(x)=|P(x)|$$. I don't know where to begin. What would be the first step?

• Well, the first and practically unique step would be, imo, to prove $\;P(x)\ge0\;\;,\;\;\forall\,,x\in\Bbb R\;$. What about the polynomial first derivative, minimum/maximum points and etc.? – DonAntonio Oct 23 '16 at 9:24
• Oh, I see. As for the derivatives etc. I shouldn't use them here, since we haven't learned about them in class yet. – lmc Oct 23 '16 at 9:28
• @No Well, I didn't know that since you tagged your question "real analysis". – DonAntonio Oct 23 '16 at 9:48
• I observe that $P(x)=x^4-P'(x)$, and a similar relation holds for all successive derivatives. I suspect this is meaningful, but I don't know what to make of it. – Tom Zych Oct 23 '16 at 10:34
• @TomZych Neat observation, thanks for posting it. One possible way to use it is shown in my answer. – dxiv Oct 24 '16 at 3:07

## 10 Answers

.In this question, you have to attempt to complete two squares, namely: $$x^4-4x^3 + 12x^2-24x+24 = x^4 -4x^3+6x^2-4x+1 + 6x^2-20x+23 \\ = (x-1)^4 + 6x^2 -20x+23$$

Now, as it turns out, we can complete the second square, and: $$6x^2-20x+23 = \frac{2}{3}(3x-5)^2 + \frac{19}{3}$$

Hence, we can rewrite the whole expression as: $$x^4-4x^3 + 12x^2-24x+24 = (x-1)^4 + \frac{2}{3}(3x-5)^2 + \frac{19}{3}$$

It is a sum of positive expressions, hence is always positive, hence $$P(x) = |P(x)|$$.

• This is brilliant, I wouldn't have ever thought of that. – lmc Oct 23 '16 at 9:30
• @Now_now_Draco_play_nicely To be fair, what gave me this hint is the first two terms of the expression, $x^4-4x^3$. It seemingly dropped a hint that I was to remove the fourth power from the expression. As luck would have it, the rest went through, otherwise I might have had trouble. – Teresa Lisbon Oct 23 '16 at 9:32
• Incidentally, a nicer sum of squares is $(x^2-2x)^2+2(2x-3)^2+6$, avoiding any fractional values. – Glen O Oct 24 '16 at 16:15
• @GlenO Thank you for the point out. – Teresa Lisbon Oct 24 '16 at 22:57
• @Now_now_Draco_play_nicely Good job, Sherlock, you have noticed that the minimum of this function is greater than $\frac{19}{3}$. Actually, if something is strictly positive, it is automatically non-negative, of course, In which case, $|P(x)| = P(x)$ would follow anyway. The absolute value function preserves non-negativity,therefore it preserves positivity as well. – Teresa Lisbon Oct 31 '16 at 10:33

Just for fun, observe that $$P(x) = \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix}^\intercal \begin{bmatrix} 1 && -2 && 0 \\ -2 && 12 && -12 \\ 0 && -12 && 24 \end{bmatrix} \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix} = 24 - 24x + 12x^2 - 4x^3 + x^4$$ and since the matrix in the middle is positive semi-definite (This can be determined from determinants of sub-matrices, etc.), it follows immediately $P(x) \geq 0$.

• Uh, that's way too advanced for me, – lmc Oct 23 '16 at 16:24
• A very cool answer! Thanks for posting. – 6005 Oct 23 '16 at 18:13

Here is an alternative solution. You can see that $$P(x)$$ is positive iff $$P(x+c)$$ is positive for all $$x$$ (think about why). So you can slightly simplify the polynomial by such substitution, for example

$$P(x+1) = x^4+6 x^2-8x+9$$

Now it's easy since you can check that $$6x^2-8x+9$$ corresponds to parabola with positive global minimum, hence all its values are positive. Since also $$x^4$$ is non-negative, you can combine it to see the whole polynomial is positive.

If you want to be a bit more explicit, you can rewrite the parabola on the right to get

$$P(x+1) = x^4 + 6\left(x-\frac{2}{3}\right)^2+\frac{19}{3}$$

• Or $P(x) = (x-1)^4 + 6\left(x-\frac{5}{3}\right)^2+\sqrt{\frac{19}{3}}^2$ – steven gregory Oct 23 '16 at 11:14
• Good answer, and sorry I'm late, but how did you know that 1 would do the trick? Of all the values of $c$, why 1? – Anurag B. Sep 20 '18 at 11:11
• Just tried couple of small integers. It is usually worth checking few simple substitutions just to see if it does not lead to more workable polynomial. – Sil Sep 20 '18 at 18:57

Alternative solution : you can note that

$$P(x)=2x^2+((x-2)^2)(x^2+6)$$

• How did you figure that out? – lmc Oct 23 '16 at 9:32
• @Now_now_Draco_play_nicely With a little bit of trial and error : first, I tried to factorize $P(x)$ and got nowhere. Then, I computed the minimum of $\frac{P(x)}{x^2}$ over $\mathbb R$ and found that it was equal to $2$. Then, I factorized $P(x)-2x^2$. – Ewan Delanoy Oct 23 '16 at 11:59

By completing the square for $x^4+12x^2\cdots$,

$$P(x)=(x^2+6)^2-4x^3-24x-12=(x^2+6)^2-4x(x^2+6)-12\\ =(x^2+6)(x^2-4x+6)-12.$$

The minimum value of the first factor is $6$ and that of the second is $2$.

Or completing the square for $x^2(x^2-4x\cdots)$,

$$P(x)=x^2(x-2)^2+8x^2-24x+24=x^2(x-2)^2+8(x^2-3x+3).$$

As you can easily check, the trinomial on the right has no real root.

Or completing the fourth power for $x^4-4x^3\cdots$,

$$P(x)=(x-1)^4+P(x)-(x^4-4x^3+6x^2-4x+1)\\=(x-1)^4+6x^2-20x+23$$ and the trinomial on the right has no real root.

The following builds on @TomZych's neat (and easy to verify) observation posted in a comment:

I observe that $P(x)=x^4 − P'(x)$

$P(x)$ cannot have negative roots by the Descartes' rule of signs.

$P(0)=24 \gt 0$ so any positive roots must be strictly positive.

Let $x_0 \gt 0$ be the smallest strictly positive root so that $P(x_0)=0$. The quoted identity $P(x)=x^4 − P'(x)$ implies $P'(x_0)=x_0^4 \gt 0$.

But $P(x) \gt 0$ on $[0,x_0)$ so $P(x)$ must cross the $x$ axis "from above" at $x_0$ thus it cannot be increasing at $x_0$.   ( More formally, $P'(x_0) > 0$ implies that there would exist an interval $(x_0-\delta,x_0)$ where $P(x) \lt 0$, which in turn would imply a root in $(0,x_0-\delta)$, which would contradict the assumption that $x_0$ is the smallest positive root. )

Therefore $P(x)$ has no real roots, neither negative, nor positive, so $P(x) \gt 0$ since $P(0) \gt 0$.

• Very nice! Short, sweet, and not hard to follow even for the mathematically rusty such as myself :) – Tom Zych Oct 24 '16 at 23:38
• @TomZych Thanks. Yours was too good a hint to pass up ;-) Plus, a similar argument can prove more general propositions e.g. if $P(a) \gt0$ and $P(x)+P'(x) \gt 0$ for all $x \gt a$ then $P(x) > 0$ on $[a, \infty)$. – dxiv Oct 25 '16 at 3:38

As the other answers pointed out, you need to prove that the polynomial is positive for all values of $x$. A very common way to do it is to express it as a sum of squares.

$$P(x)=x^4−4x^3+12x^2−24^x+24$$

The problems here are the two terms where X is at an odd power: $-4x^3$ and $-24x$

Trying to fit them into squares is almost automatic: \begin{align} P(x) & = x^4−4x^3+12x^2−24x+24 \\ & = (x^4 - 4x^3 + 4x^2) + 8X^2 - 24X + 24 \\ & = x^2(x-2)^2 + 6(x^2 - 4X + 4) + 2x^2 \\ & = x^2(x-2)^2 + 6(x-2)^2 + 2x^2 \end{align}

If a real polynomial $P$ has a lower bound then $$\min P(x)=\min \{P(x): P'(x)=0\}.$$ A polynomial of even degree and positive leading co-efficient has a lower bound. In this case we have $P'(x)=4x^3-12x^2+24x-24$. Now $$P''(x)=12(x^2-x+ 2)=12((x-1)^2+ 1)>0.$$ So $P'(x)$ is strictly increasing , with a unique real $x_0$ such that $P'(x_0)=0.$ So $\min P(x)=P(x_0).$

Using "synthetic division" , divide $P'(x)$ into $P(x)$: We have $P(x)=P'(x)(x-1)/4 +3(x^2-2x+2).$ So $$\min P(x)=P(x_0)=3(x_0^2-2x_0+2)=3((x_0-1)^2+1)>0.$$

$$x^{4} - 4 x^{3} + 12 x^{2} - 24 x + 24 = \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix}^\top \begin{bmatrix} 1 && -2 && t \\ -2 && 12 - 2t && -12 \\ t && -12 && 24 \end{bmatrix} \begin{bmatrix} x^2 \\ x \\ 1 \end{bmatrix}$$

where $$t \in \mathbb R$$. Using Sylvester's criterion, after some work, we learn that the (symmetric) matrix above is positive semidefinite when

$$t \in \left[ 2 - 4 \cos{\left(\frac{\pi}{9} \right)}, 2 + 4 \sin{\left(\frac{\pi}{18} \right)} \right]$$

Computing the Cholesky decomposition of the matrix for an admissible value of $$t$$, we obtain a sum of squares (SOS) decomposition, thereby proving that the given quartic polynomial is (globally) nonnegative.

$$\boxed{t = 1}$$

$$\begin{bmatrix} 1 && -2 && 1 \\ -2 && 10 && -12 \\ 1 && -12 && 24 \end{bmatrix} = {\rm L} {\rm L}^\top$$

where

$${\rm L} = \begin{bmatrix} \color{blue}{1} & 0 & 0\\ \color{blue}{-2} & \color{magenta}{\sqrt{6}} & 0\\ \color{blue}{1} & \color{magenta}{- \frac{5 \sqrt{6}}{3}} & \color{red}{\frac{\sqrt{57}}{3}} \end{bmatrix}$$

and, thus,

\begin{aligned} x^{4} - 4 x^{3} + 12 x^{2} - 24 x + 24 &= \left( \color{blue}{x^2 - 2 x + 1} \right)^2 + \left( \color{magenta}{\sqrt{6}\, x - \frac{5 \sqrt{6}}{3}} \right)^2 + \left( \color{red}{\frac{\sqrt{57}}{3}} \right)^2 \\ &= \left( x - 1\right)^4 + 6 \left( x - \frac{5}{3} \right)^2 + \frac{19}{3}\end{aligned}

which is the same sum of squares (SOS) decomposition in this answer.

$$\boxed{t = 0}$$

$$\begin{bmatrix} 1 && -2 && 0 \\ -2 && 12 && -12 \\ 0 && -12 && 24 \end{bmatrix} = {\rm L} {\rm L}^\top$$

where

$${\rm L} = \begin{bmatrix} \color{blue}{1} & 0 & 0\\ \color{blue}{-2} & \color{magenta}{2 \sqrt{2}} & 0\\ 0 & \color{magenta}{- 3 \sqrt{2}} & \color{red}{\sqrt{6}} \end{bmatrix}$$

and, thus,

\begin{aligned} x^{4} - 4 x^{3} + 12 x^{2} - 24 x + 24 &= \left( \color{blue}{x^2 - 2 x} \right)^2 + \left( \color{magenta}{2 \sqrt{2} \, x - 3 \sqrt{2} } \right)^2 + \left( \color{red}{\sqrt{6}} \right)^2 \\ &= x^2 \left( x - 2\right)^2 + 2 \left( 2 x - 3 \right)^2 + 6\end{aligned}

$$\boxed{t = 2}$$

$$\begin{bmatrix} 1 && -2 && 2 \\ -2 && 8 && -12 \\ 2 && -12 && 24 \end{bmatrix} = {\rm L} {\rm L}^\top$$

where

$${\rm L} = \begin{bmatrix} \color{blue}{1} & 0 & 0\\ \color{blue}{-2} & \color{magenta}{2} & 0\\ \color{blue}{2} & \color{magenta}{-4} & \color{red}{2}\end{bmatrix}$$

and, thus,

\begin{aligned} x^{4} - 4 x^{3} + 12 x^{2} - 24 x + 24 &= \left( \color{blue}{x^2 - 2 x + 2} \right)^2 + \left( \color{magenta}{2 x - 4} \right)^2 + \color{red}{2}^2 \end{aligned}

### SymPy code

>>> from sympy import *
>>> t = symbols('t', real=True)
>>> Q = Matrix( [[  1,       -2,   t],
[ -2, 12 - 2*t, -12],
[  t,      -12,  24]] )


For $$t=1$$,

>>> L = Q.subs(t,1).cholesky()
>>> L
Matrix([
[ 1,            0,          0],
[-2,      sqrt(6),          0],
[ 1, -5*sqrt(6)/3, sqrt(57)/3]])


For $$t=0$$,

>>> L = Q.subs(t,0).cholesky()
>>> L
Matrix([
[ 1,          0,       0],
[-2,  2*sqrt(2),       0],
[ 0, -3*sqrt(2), sqrt(6)]])


For $$t = 2 - 4 \cos{\left(\frac{\pi}{9} \right)}$$,

>>> L = simplify(Q.subs(t,2 - 4 * cos(pi/9)).cholesky())
>>> L
Matrix([
[              1,                                        0, 0],
[             -2,                  2*sqrt(1 + 2*cos(pi/9)), 0],
[2 - 4*cos(pi/9), -(4*cos(pi/9) + 4)/sqrt(1 + 2*cos(pi/9)), 0]])


For $$t = 2 + 4 \sin{\left(\frac{\pi}{18} \right)}$$,

>>> L = simplify(Q.subs(t,2 + 4 * sin(pi/18)).cholesky())
>>> L
Matrix([
[               1,                                          0, 0],
[              -2,                   2*sqrt(1 - 2*sin(pi/18)), 0],
[4*sin(pi/18) + 2, 4*(-1 + sin(pi/18))/sqrt(1 - 2*sin(pi/18)), 0]])


Note that the latter two $$\rm L$$ matrices are rank-$$2$$. Thus, the corresponding SOS decompositions are the sums of just $$2$$ squares.

For general $$t$$,

>>> L = simplify(Q.cholesky())
>>> L
Matrix([
[ 1,                           0,                                                                    0],
[-2,               sqrt(8 - 2*t),                                                                    0],
[ t, sqrt(2)*(t - 6)/sqrt(4 - t), sqrt(-t**2 + 24 - 2*(t - 6)**2*conjugate(1/sqrt(4 - t))/sqrt(4 - t))]])


which suggests that the case $$t = 2$$ is interesting. Is it?

>>> L = Q.subs(t,2).cholesky()
>>> L
Matrix([
[ 1,  0, 0],
[-2,  2, 0],
[ 2, -4, 2]])


Interesting, indeed.

### Related:

The first step is definitely recalling a modulus function's definition: $$|x| := \begin{cases}x & \text{if } x\ge 0 \\ -x & \text{if } x\le 0\end{cases}$$ So the requirement $P(x) = |P(x)|$ is equivalent to $P(x) \ge 0$.

Hope you can continue from that.

• I still wonder what is wrong with this answer. – CiaPan Jan 21 '20 at 9:17
• You have done the obvious part and left the hard part as an exercise for the reader. Usually, it's the other way round. – Rodrigo de Azevedo Feb 20 at 15:26