Maximum of product of numbers when the sum is fixed This is the problem I'm working on.
$$\begin{array}{rl}
\text{maximize} & (n+\ell+x_1)\cdots (n+\ell+x_{k-1})(\ell + x_k) \\
\text{subject to} & 0 \leq x_1, ..., x_k \leq n \\
& x_1 + \cdots + x_k = n
\end{array}
$$
You may assume that $\ell \neq n$ while $\ell$ and $n$ are some positive constants.

One rule of thumb I know is 'the maximum of $\prod_{i=1}^k y_k$ is attained when all the numbers $y_1,\cdots,y_k$ are equal.' Applying this ungrounded intuition to my problem, I think the maximum of the above is $(n+\ell)^k$ attained when $x_1=\cdots=x_{k-1}=0$ and $x_k= n$. Is this true? If it is, is there any intuitive way to prove my conjecture?
 A: The rule of thumb is the arithmetic-geometric-mean inequality, where equality holds if and only if the numbers are equal.
We can prove it higher-level using Lagrange multipliers, but we can also prove it lower-level:
Consider the continuous function $P \colon \mathbb{R}^k \to \mathbb{R};\;\; P(y_1,\,\dotsc,\, y_k) = \prod\limits_{i=1}^k y_i$. For $S > 0$, $P$ attains its maximum on the simplex $\Sigma(S) = \{ \mathbf{y} : \sum_{i=1}^k y_i = S, y_i \geqslant 0\}$ in the point $\mathbf{y}_S = (S/k,\,\dotsc,\,S/k)$.
$\Sigma(S)$ is compact, so the supremum is attained.
On the boundary $\partial\Sigma(S) = \{\mathbf{y} \in \Sigma(S) : (\exists i)(y_i = 0)\}$, $P$ vanishes, and in the interior, $P$ is strictly positive, hence the maximum is attained in an interior point of $\Sigma(S)$. For $\mathbf{y}_S \neq \mathbf{y}\in \Sigma(S)$, there are two indices $i < j$ with $y_i \neq y_j$. Then
$$y_iy_j = \left(\frac{y_j+y_i}{2} - \frac{y_j-y_i}{2}\right)\left(\frac{y_j+y_i}{2} + \frac{y_j-y_i}{2}\right) = \left(\frac{y_j+y_i}{2}\right)^2 - \left(\frac{y_j-y_i}{2}\right)^2 < \left(\frac{y_j+y_i}{2}\right)^2$$
and hence
$$P(\mathbf{y}) = \left(\prod_{m \notin\{i,\,j\}} y_m\right)\cdot y_iy_j < \left(\prod_{m \notin\{i,\,j\}} y_m\right)\cdot \left(\frac{y_j+y_i}{2}\right)^2 = P(\mathbf{y}').$$
Thus the only candidate for the point where the maximum is attained is $\mathbf{y}_S$. Since the maximum is attained somewhere, it is attained in $\mathbf{y}$.
To see that that proves your "ungrounded intuition" right, we still need a little bit of work, since your situation is slightly different.
Setting $y_i = n + \ell + x_i$ for $i < k$ and $y_k = \ell + x_k$, the target is to maximise $P$ subject to the conditions
$$y_i \geqslant n + \ell,\; i < k; \quad y_k \geqslant \ell$$
and $$\sum_{i=1}^k y_i = (k-1)\cdot(n+\ell) + \ell + \sum_{i=1}^k x_i = k\cdot(n+\ell).$$
This set is not the full simplex $\Sigma(k(n+\ell))$, but a proper subset of it.
However, since the point $\mathbf{y}_{k(n+\ell)}$ - corresponding to $x_i = 0$ for $i < k$, and $x_k = n$ - that maximises $P$ on the entire simplex lies in the subset under consideration, it is clear that it solves the problem.
