Is the AM-GM inequality the only obstruction for getting a specific sum and product?

If we choose $$ (a_1, \ldots, a_{n-1}, a_n) = (a, \ldots, a, \frac{P}{a^{n-1}}) $$ for some $a > 0$ then $\prod a_i = P$ is satisfied, and we need that $$ f(a) = \sum a_i = (n-1)a + \frac{P}{a^{n-1}} = S \, . $$ This equation has a solution because $f$ is continuous on $(0, \infty)$ with $$ \min_{a > 0} f(a) = f(\sqrt[n]P) = n \sqrt[n]P \le S $$ and $$ \lim_{a \to \infty} f(a) = + \infty \, . $$


Remarks about a possible generalization

The Maclaurin's inequalities state the following: If $a_1, \ldots, a_n$ are positive real numbers, and the “averages” $S_1, \ldots, S_n$ are defined as $$ S_k = \frac{1}{\binom n k} \sum_{1 \le i_1 < \ldots < i_k \le n} a_{i_1}a_{i_2} \cdots a_{i_k} $$ then $$ S_1 \ge \sqrt{S_2} \ge \sqrt[3]{S_3} \ge \ldots \ge \sqrt[n]{S_n} \, . $$ In particular, $$ \frac 1 n (a_1 + \ldots + a_n) = S_1 \ge \sqrt[n]{S_n} = \sqrt[n]{a_1 \cdots a_n} $$ so that this is a generalization of the inequality between the geometric and arithmetic means. Therefore a natural generalization of the above question would be:

Let $S_1, \ldots, S_n$ be given positive real numbers with $$ S_1 \ge \sqrt{S_2} \ge \sqrt[3]{S_3} \ge \ldots \ge \sqrt[n]{S_n} \, . $$ Are there positive real numbers $a_1, \ldots, a_n$ such that $$ S_k = \frac{1}{\binom n k} \sum_{1 \le i_1 < \ldots < i_k \le n} a_{i_1}a_{i_2} \cdots a_{i_k} $$ for $1 \le k \le n$?

This is equivalent to asking if the polynomial $$ p(x) = x^n - \binom n 1 S_1 x^{n-1} + \binom n 2 S_2 x_{n-2} + \ldots + (-1)^n \binom n n S_n $$ has $n$ positive real zeros.

Unfortunately, this generalization does not hold. The following counterexample is from

  • SIKLOS, STEPHEN. “Maclaurin's Inequalities: Reflections on a STEP Question.” The Mathematical Gazette, vol. 96, no. 537, 2012, pp. 499–507. JSTOR, https://www.jstor.org/stable/24496873.

We choose $n=3$ and $$ S_1 = \frac 3 2, \, S_2 = 2, \, S_3 = 1 \, . $$ The condition on the $S_k$ is satisfied (with strict inequalities), but a simple analysis shows that the polynomial $$ p(x) = x^3 - 3 S_1 x^2 + 3 S_2 x - S_3 = x^3 - \frac 9 2 x^2 + 6 x - 1 $$ has one real (positive) zero and two non-real zeros. It is therefore not possible to find real numbers $a_1, a_2, a_3$ such that $$ \frac{a_1+a_2+a_3}{3} = S_1, \, \frac{a_1a_2 + a_1 a_3 + a_2 a_3}{3} = S_2,\, a_1 a_2 a_3 = S_3 \, . $$


Let $\mu:=\frac{S}{n},\,\sigma:=P^{1/n}\le\mu$. We seek $a_i$ of AM $\mu$ & GM $\sigma$. Take $a_1=\cdots=a_{n-2}=\sigma$ so we want $a_{n-1}+a_n=n\mu-(n-2)\sigma=n(\mu-\sigma)+2\sigma,\,a_{n-1}a_n=\sigma^2$. This is achievable because it implies$$(a_{n-1}+a_n)^2-4a_{n-1}a_n=(n(\mu-\sigma)+2\sigma)^2-4\sigma^2\ge0.$$Edit: it's been pointed out we need to verify these roots of a quadratic equation are positive. That's easy: their product is positive, as is their sum.