Example 6.2.4. Find the best value of $t=t(n)$ (smallest) for which the following inequality is true for all real numbers $x_{1}, x_{2}, \ldots, x_{n}$
$$x_{1}^{2}+\left(x_{1}+x_{2}\right)^{2}+\ldots+\left(x_{1}+x_{2}+\ldots+x_{n}\right)^{2} \leq t\left(x_{1}^{2}+x_{2}^{2}+\ldots+x_{n}^{2}\right)$$
(MYM 2004)
SOLUTION. Let $c_{1}, c_{2}, \ldots, c_{n}$ be positive real numbers (which will be chosen later). According to the Cauchy-Schwarz inequality, we have
$$\left(\sum_{i=1}^{k} x_{i}\right)^{2} \leq S_{k}\left(\sum_{i=1}^{k} \frac{x_{i}^{2}}{c_{i}}\right)$$
where $S_{1}, S_{2}, \ldots, S_{n}$ are determined as
$$S_{k}=\sum_{i=1}^{k} c_{i}, k \in\{1,2, \ldots, n\}$$

According to ( $\star$ ), we infer that (after adding up similar results for all $k \in\{1,2, \ldots, n\}$ )
$$\sum_{k=1}^{n}\left(\sum_{i=1}^{k} x_{i}\right)^{2} \leq \sum_{k=1}^{n}\left(\sum_{j=k}^{n} \frac{S_{j}}{c_{j}}\right) x_{i}^{2}$$

We will choose coefficients $c_{1}, c_{2}, \ldots, c_{n}$ such that
$$\frac{S_{1}+S_{2}+\ldots+S_{n}}{c_{1}}=\frac{S_{2}+S_{3}+\ldots+S_{n}}{c_{2}}=\cdots=\frac{S_{n}}{c_{n}}=t$$

After some computations, we find
$$c_{i}=\sin i \alpha-\sin (i-1) \alpha \forall k \in\{1,2, \ldots, n\}$$
where $\alpha=\frac{\pi}{2 n+1}$. So $t=\frac{1}{4 \sin ^{2} \frac{\pi}{2(2 n+1)}}$ and we conclude that
$$\sum_{k=1}^{n}\left(\sum_{i=1}^{k} x_{i}\right)^{2} \leq t\left(\sum_{k=1}^{n} x_{i}^{2}\right)=\frac{1}{4 \sin ^{2} \frac{\pi}{2(2 n+1)}}\left(\sum_{k=1}^{n} x_{i}^{2}\right)$$