TITLE: How find the maximum of the $x^3_{1}+x^3_{2}+x^3_{3}-x_{1}x_{2}x_{3}$
QUESTION [5 upvotes]: Let $$0\le x_{i}\le i,\, i=1,2,3$$ be real numbers. Find the maximum of the expression
$$x^3_{1}+x^3_{2}+x^3_{3}-x_{1}x_{2}x_{3}$$

My idea: I guess
$$x^3_{1}+x^3_{2}+x^3_{3}-x_{1}x_{2}x_{3}\le 0^3+2^3+3^3-0\cdot2\cdot 3=35$$ 
But I can't prove it. Can you help ?
This problem is a special case of:

REPLY [2 votes]: The general question: Given is
$$
f(x_1,\cdots,x_n) = \sum_k x_k^n - \prod_k x_k,
$$
and let
$$
\forall 1 \le k \le n : 0 \le x_k \le k.
$$
Find the maximum of $f(x_1,\cdots,x_n)$.

First we define
$$
x_k = k \sin^2(\phi_k),
$$
whence the condition
$$
\forall 1 \le k \le n : 0 \le x_k \le k.
$$
is satisfied.

For a maximum, we have the condition
$$
\frac{\partial f}{\partial \phi_p} = 0 \wedge
  \frac{\partial^2 f}{\partial \phi_p^2} < 0.
$$

We now have
$$
f(\phi_1,\cdots,\phi_n) = \sum_k k^n \sin^{2n}(\phi_k) - n! \prod_k \sin^2(\phi_k),
$$
whence
$$
\frac{\partial f}{\partial \phi_p} =
  \sin(2 \phi_p) \left( n p^n \sin^{2n-2}(\phi_p)  - n! \prod_{k \ne p} \sin^2(\phi_k) \right),
$$
and
$$
\begin{eqnarray}
\frac{\partial^2 f}{\partial \phi_p^2} &=&
  n(2n-2) p^n \sin^2(2 \phi_p) \sin^{2n-4}(\phi_p) \\
&& + 2\cos(2 \phi_p) \left( n p^n \sin^{2n-2}(\phi_p)  - n! \prod_{k \ne p} \sin^2(\phi_k) \right),
\end{eqnarray}
$$

The extreme value of $f(\phi_1\cdots,\phi_n)$ is given by the condition
$$
\frac{\partial f}{\partial \phi_p} = 0 \Rightarrow
  \sin(2 \phi_p) \left( n p^n \sin^{2n-2}(\phi_p)  - n! \prod_{k \ne p} \sin^2(\phi_k) \right) = 0\\
\Downarrow\\
\sin(2\phi_p) = 0 \vee \sin(\phi_p) = 0 \vee p \sin^2(\phi_p) =q \sin^2(\phi_q).
$$
We have:

The condition $p \sin^2(\phi_p) =q \sin^2(\phi_q)$,
implies that $\displaystyle \frac{\partial^2 f}{\partial \phi_p^2} > 0$,
i.e. a minimum.
The condition $\sin(\phi_p) = 0$,
implies that $\displaystyle \frac{\partial^2 f}{\partial \phi_p^2} = 0$.
The condition $\sin(2\phi_p) = 0$,
implies that $\displaystyle \frac{\partial^2 f}{\partial \phi_p^2} = n! - np^n$,
thus $\displaystyle \frac{\partial^2 f}{\partial \phi_p^2} < 0$,
if $p>1$, i.e. een maximum for $p>1$.

The maximum is therefore given for
$$
\phi_1 = 0 \wedge p>1 : \phi_p = \pi/2,
$$
and the maximum is given by
$$
\boxed{
f_\textrm{max} = \sum_{p>1} p^n.
}
$$

A small modification due to some minor errors, thanks to Thomas Andrews!