# find the maximum of the value $\left(\sum_{i=1}^{n}ia_{i}\right)\left(\sum_{i=1}^{n}\frac{a_{i}}{i}\right)^2$

let $$a_{i}\ge 0$$ and such $$a_{1}+a_{2}+\cdots+a_{n}=1$$ find the maximum of the value $$\left(\sum_{i=1}^{n}ia_{i}\right)\left(\sum_{i=1}^{n}\dfrac{a_{i}}{i}\right)^2$$ I try to use From Pólya-Szegö’s inequality, we have for $$0 < m_1 \leqslant u_k \leqslant M_1$$ and $$0 < m_2 \leqslant v_k \leqslant M_2$$, $$\left(\sum u_k^2 \right) \left( \sum v_k^2 \right) \leqslant \frac14 \left( \sqrt{\frac{M_1 M_2}{m_1m_2}} + \sqrt{\frac{m_1 m_2}{M_1 M_2}} \right)^2 \left( \sum u_k v_k\right)^2$$

But I can't it.Thanks

• This seems amenable to Lagrange multipliers: with $S_1=\sum_j j a_j$ and $S_2=\sum_j a_j/j$, you have that $i S_2 + 2 S_1/i$ is independent of $i$. Setting those equal to $\lambda$ and requiring $\sum_j a_j=1$ is then $n+1$ linear equations in $n+1$ unknowns. I see no immediate reason why this system should have some nice solution.
– Ian
Commented Feb 27, 2019 at 2:05
• can you find this inequality when $=?$ Commented Feb 27, 2019 at 2:10
• How would this inequality help you deal with the square on the outside of the second sum?
– Ian
Commented Feb 27, 2019 at 2:11
• Note that $$\sqrt{(\sum ia_i)(\sum \frac{a_i}{i})^2}\leq (\sum \sqrt{ia_i})(\sum \frac{a_i}{i})\leq (\sum \frac{i+a_i}{2})(\sum \frac{a_i}{i}) \leq(\frac{n(n+1)}{4}+\frac{1}{2})(\sum \frac{a_i}{i})$$ $$\leq(\frac{n(n+1)}{4}+\frac{1}{2})(\sum a_i) =\frac{n(n+1)}{4}+\frac{1}{2}.$$ Maybe it can works. Commented Feb 27, 2019 at 2:13
• @Ian for $n>2$ you can get $\dfrac{((n+1)/3)^3}{(n/2)^2}>1$ Commented Feb 27, 2019 at 4:02

Here's the same answer but via different approach. Let $$X$$ be an integer-valued random variable such that $$\Bbb P(X=i)=a_i\ \ \ \text{ for all }\ i=1,2,\ldots,n.$$ We have that $$\Bbb E\left[\frac1 X\right]=\sum_{i=1}^n\frac{a_i}i,\quad \Bbb E\left[X\right]=\sum_{i=1}^n ia_i,$$ so we need to maximize $$\Bbb E\left[\frac1 X\right]^2 \Bbb E\left[X\right]$$. Observe that by AM-GM inequality $$3\sqrt[3]{\Bbb E\left[\frac{n} X\right] \Bbb E\left[\frac {n} X\right] E\left[2X\right]}\le \Bbb E\left[\frac{n} X\right] +\Bbb E\left[\frac{n} X\right]+\Bbb E\left[2X\right]= \Bbb 2\Bbb E\left[X+\frac n X\right].$$ Since $$1\le X\le n$$, we have that $$0\le \frac{(X-1)(n-X)}X\implies X+\frac n X\le n+1,$$ with equality holding when $$\Bbb P(X\in \{1,n\})=1$$. This gives $$3\sqrt[3]{2n^2\Bbb E\left[\frac{1} X\right]^2E\left[X\right]}\le 2(n+1),$$ which is equivalent to $$\Bbb E\left[\frac{1} X\right]^2\Bbb E\left[X\right]\le \frac1{2n^2}\left(\frac{2(n+1)}3\right)^3=\frac{4(n+1)^3}{27n^2}.$$ Equality holds when $$\Bbb E\left[\frac{n} X\right]=2\Bbb E\left[X\right],\quad \Bbb P(X\in \{1,n\})=1,$$ that is, $$a_1=\Bbb P(X=1)=\frac{2n-1}{3(n-1)}$$ and $$a_n=\Bbb P(X=n)=\frac{n-2}{3(n-1)}$$ (with other $$a_i=0$$ and $$n\ge 2$$.)

If $$n=1$$, $$\Bbb E\left[\frac{1} X\right]^2\Bbb E\left[X\right]=1$$ holds trivially.

Note: In fact, $$X$$ does not have to be integer-valued; $$\Bbb P(1\le X\le n)$$ provides the same upper bound. So, for instance, we have that $$\left(\int_1^n \frac{f(x)\ dx}x\right)^2\left(\int_1^n xf(x)\ dx\right)\le\frac{4(n+1)^3}{27n^2}$$ for all $$f\ge 0$$ with $$\int_1^n f(x)\ dx=1$$, $$n\ge 2$$.

Let $$f(k_1,\cdots,k_m)$$ for distinct positive integers $$k_1 be the maximum possible value of

$$\left(\sum_{i=1}^m k_ia_i\right)\left(\sum_{i=1}^m \frac{a_i}{k_i}\right)^2$$

across all nonnegative reals $$a_1,\cdots,a_m$$ with sum $$1$$.

For $$m=1$$ the value is simply $$1$$. For $$m\geq 2$$ we claim

$$f(k_1,\cdots,k_m)=\max\left(\frac{2(k_1+k_m)^2}{9k_1k_m},1\right).$$

We show this by induction on $$m$$. Use Lagrange multipliers. Letting $$S_1=\sum_{i=1}^m k_ia_i$$ and $$S_2=\sum_{i=1}^m \frac{a_i}{k_i}$$ gives that the derivative with respect to $$a_i$$ is

$$\frac{2S_1}{k_i}+S_2k_i;$$

the derivative vector of our condition is the all-ones vector, so we require that

$$\frac{2S_1}{k_i}+S_2k_i=\lambda$$

is fixed across all $$k_i$$. However

$$\frac{2S_1}{k_i}+S_2k_i = \frac{2S_1}{k_j}+S_2k_j \implies S_2(k_i-k_j) = S_1\left(\frac{k_i-k_j}{k_ik_j}\right) \implies 2S_1=k_ik_jS_2,$$

which cannot occur for all pairs $$(i,j)$$ if $$m\geq 3$$. Thus one variable is $$0$$, and we are thus reduced to the case of $$k_1,\cdots,k_m$$ with one element removed. If $$m=2$$, the system expands to

$$0=a_1(2k_1-k_2)+a_2(2k_2-k_1),$$

which, in addition to the normalization condition $$a_1+a_2=1$$, has solution

$$a_1=\frac{2k_2-k_1}{3(k_2-k_1)},\ \ a_2=\frac{k_2-2k_1}{3(k_2-k_1)}.$$

If $$k_2\geq 2k_1$$ this is a valid point and gives the desired value of $$\frac{2(k_1+k_2)^2}{9k_1k_2}$$; otherwise one $$a_i$$ must be $$0$$ which gives the value of $$1$$. Thus, the base case is proven. For the inductive step, we have that, per our inductive hypothesis, as one $$a_i$$ must be $$0$$, this is $$\frac{2(k_1+k_m)^2}{9k_1k_m}$$ unless we have chosen to remove $$k_1$$ or $$k_m$$, in which case it is $$\frac{2(k_1+k_{m-1})^2}{9k_1k_{m-1}}$$, $$\frac{2(k_2+k_m)^2}{9k_2k_m}$$, or $$1$$. The observation that $$f(x)=x+\frac{1}{x}$$ is increasing on $$x\geq 1$$ finishes the proof.

Thus, the maximum possible value is

$$\frac{2(n+1)^2}{9n},$$

at $$n\geq 2$$ and $$1$$ otherwise, reached at $$a_1=\frac{2n-1}{3(n-1)}, a_2=\cdots=a_{n-1}=0,$$ $$a_n=\frac{n-2}{3(n-1)}.$$

Alternative solution

Problem: Let $$a_i\ge 0, \forall i$$ with $$a_1 + a_2 + \cdots + a_n = 1$$. Prove that the maximum of $$\left(\sum_{i=1}^n i a_i\right)\left(\sum_{i=1}^n \frac{a_i}{i}\right)^2$$ is $$\frac{4(n+1)^3}{27n^2}$$.

We may use the approach in my answer to this equation: An upper bound of product of two inner products

Consider the optimization problem $$\max_{a_i\ge 0, \forall i; \ \sum_{i=1}^n a_i = 1} \left(\sum_{i=1}^n i a_i\right)\left(\sum_{i=1}^n \frac{a_i}{i}\right)^2.$$ Let $$(a_1^\ast, a_2^\ast, \cdots, a_n^\ast)$$ be a global maximizer.

We claim that if $$1 < k < n$$, then $$a_k^\ast = 0$$. Indeed, if $$a_k^\ast > 0$$, let $$a_1' = a_1^\ast + (1 - y) a_k^\ast, \quad a_k' = 0, \quad a_n' = a_n^\ast + y a_k^\ast$$ where $$\frac{k-1}{n-1} < y < \frac{n}{k}\cdot \frac{k-1}{n-1}$$. We have $$a_1' + a_k' + a_n' = a_1^\ast + a_k^\ast + a_n^\ast,$$ and \begin{align} &a_1' + ka_k' + na_n' - (a_1^\ast + ka_k^\ast + na_n^\ast)\\ =\ & (n-1)\left(y - \frac{k-1}{n-1}\right) a_k^\ast\\ >\ & 0, \end{align} and \begin{align} &a_1' + \frac{a_k'}{k} + \frac{a_n'}{n} - \left(a_1^\ast + \frac{a_k^\ast}{k} + \frac{a_n^\ast}{n}\right)\\ =\ & \frac{n-1}{n}\left(\frac{n}{k}\cdot \frac{k-1}{n-1} - y\right)a_k^\ast\\ >\ & 0. \end{align} However, this contradicts the optimality of $$(a_1^\ast, a_2^\ast, \cdots, a_n^\ast)$$.

Now, since $$a_2^\ast = a_3^\ast = \cdots = a_{n-1}^\ast = 0$$, we have \begin{align} &\left(\sum_{i=1}^n i a_i^\ast\right)\left(\sum_{i=1}^n \frac{a_i^\ast}{i}\right)^2\\ =\ & (a_1^\ast + n a_n^\ast)\left(a_1^\ast + \frac{a_n^\ast}{n}\right)^2\\ =\ & (1 - a_n^\ast + na_n^\ast)\left(1 - a_n^\ast + \frac{a_n^\ast}{n}\right)^2\\ =\ & \frac{1}{2n^2}[2 + 2(n-1)a_n^\ast][n - (n-1)a_n^\ast]^2\\ \le\ & \frac{1}{2n^2} \left(\frac{2 + 2(n-1)a_n^\ast + n - (n-1)a_n^\ast + n - (n-1)a_n^\ast}{3}\right)^3\\ =\ & \frac{4(n+1)^3}{27n^2} \end{align} with equality if $$a_n^\ast = \frac{n-2}{3(n-1)}$$, where we have used AM-GM inequality.

Thus, the desired maximum is $$\frac{4(n+1)^3}{27n^2}$$ at $$a_1 = \frac{2n-1}{3(n-1)}, a_2 = a_3 = \cdots = a_{n-1} = 0, a_n = \frac{n-2}{3(n-1)}$$.