$\sum_{i=1}^nx_i^2+2\sum_{1\le k For $x_i\ge0$, where $i=1,2,...,n$, satisfying
$$\sum_{i=1}^n\,x_i^2+2\,\sum_{1\le k <j\le n}\,\sqrt{\frac{k}{j}}\,x_kx_j=1\,,$$
find the maximum and minimum of $\sum_{i=1}^n x_i.$
 A: Actually the minimum is pretty trivial:
$$\left(\sum_{i=1}^n\,x_i\right)^2\ge \sum_{i=1}^{n}\,x_{i}^{2}+2\,\sum_{1\le k <j\le n}\,\sqrt{\frac{k}{j}}\,x_{k}x_{j}=1 \,.$$ For equality can we take $x_1=1$ and $x_i=0$ for $i>1$.
The maximum is much more interesting.
A: Let $y_i:=\frac{x_i}{\sqrt{i}}$ for every $i=1,2,\ldots,n$.  Then, 
$$1=\sum_{i=1}^n\,x_i^2+2\,\sum_{1\leq k<j\leq n}\,\sqrt{\frac{k}{j}}\,x_kx_j=\sum_{i=1}^n\,i\,y_i^2+2\sum_{1\leq k < j \leq n}\,k\,y_ky_j=\sum_{i=1}^n\left(\sum_{j=i}^n\,y_j\right)^2\,.$$
Define $z_i:=\sum_{j=i}^n\,y_j$ for all $i=1,2,\ldots,n$.  We have $\sum_{i=1}^n\,z_i^2=1$ and
$$\sum_{i=1}^n\,x_i=\sum_{i=1}^n\,\sqrt{i}\,y_i=\sum_{i=1}^n\,\left(\sqrt{i}-\sqrt{i-1}\right)\,z_i\,.$$
Thus, by the Cauchy-Schwarz Inequality, we have
$$\sum_{i=1}^n\,\left(\sqrt{i}-\sqrt{i-1}\right)\,z_i\leq\sqrt{\sum_{i=1}^n\,z_i^2}\sqrt{\sum_{i=1}^n\,\left(\sqrt{i}-\sqrt{i-1}\right)^2}=\sqrt{n^2-2\,\sum_{i=1}^n\,\sqrt{i(i-1)}}\,.$$
The equality holds if and only if $z_i=\frac{\sqrt{i}-\sqrt{i-1}}{\lambda}$ for every $i=1,2,\ldots,n$, where $$\lambda:=\sqrt{n^2-2\,\sum_{i=1}^n\,\sqrt{i(i-1)}}\,.$$
Hence, the maximum value of $\sum_{i=1}^n\,x_i$ is $\lambda$, which occurs if and only if 
(1) $y_i=\frac{2\sqrt{i}-\sqrt{i+1}-\sqrt{i-1}}{\lambda}$, or $x_i=\frac{2i-\sqrt{i(i+1)}-\sqrt{i(i-1)}}{\lambda}$ for all $i=1,2,\ldots,n-1$, and 
(2) $y_n=\frac{\sqrt{n}-\sqrt{n-1}}{\lambda}$, or equivalently, $x_n=\frac{n-\sqrt{n(n-1)}}{\lambda}$.
