Let's say we have $k$ real numbers $a_1, a_2, \dots, a_k$ and a positive real number $n$ that satisfy the following constraints:
- $\sum\limits_{i=1}^{k}a_i=n$,
- $\forall_{i\in\{1,2,\dots,k\}} \quad 0 \leq a_i \leq \sqrt{n}$.
Can we prove that the sum of squares of these numbers it not greater than $n\sqrt{n}$? Formally, we want to prove that \begin{equation*} \sum\limits_{i=1}^{k}a_i^2\leq n\sqrt{n}. \end{equation*}
What I can prove is that this sum is less than $4n(\sqrt{n}+1)$. The proof goes as follows:
- First we split our numbers into $d$ groups such that each of the numbers belongs to exactly one group and the sum of numbers in each of the groups is within $\Big[\sqrt{n}, \,\, 2\sqrt{n}\Big)$ except for one. We can do this by creating an empty group and inserting there numbers that don't belong to a group yet as long as the sum of the numbers in the group is less than $\sqrt{n}$. Then we create a next empty group and repeat the process as long as there are numbers that don't belong to any group. Because the numbers are not greater than $\sqrt{n}$, the sum of any group will always be less than $2\sqrt{n}$. A small subtlety here is that the sum of the numbers in the last group may be less than $\sqrt{n}$, but all the other groups will have their sum within $\Big[\sqrt{n}, \,\, 2\sqrt{n}\Big)$.
- Next we notice that $d$, the number of groups, is not greater than $\sqrt{n} + 1$. Why? The sum of numbers in each of the groups except for one is at least $\sqrt{n}$ and the sum of $a_1+a_2+\dots+a_k$ is $n$, which means that there is no more than $\sqrt{n}$ groups, excluding the one that may not follow our condition of the sum of its numbers being within $\Big[\sqrt{n}, \,\, 2\sqrt{n}\Big)$. If we include this remaining group we get that the number of our groups is indeed not greater than $\sqrt{n}+1$.
- Now we will use the fact the fact that for any sequence of positive real numbers the sum of squares of its elements is less or equal than the square of the sum of the elements. Then we have \begin{equation*} \quad \quad \quad \sum\limits_{i=1}^{k}a_i^2=\sum\limits_{i=1}^{d}\sum\limits_{x\in X_i}x^2\leq\sum\limits_{i=1}^{d}\Big(\sum\limits_{x\in X_i}x\Big)^2<d(2\sqrt{n})^2\leq(\sqrt{n}+1)4n, \end{equation*} where $X_i$ denotes the set of numbers that belong to the $i$-th group and the second inequality comes from the fact that the sum of numbers in each of the groups is less than $2\sqrt{n}$.
For me, intuitively it seems that this bound could be lowered to $n\sqrt{n}$, but unfortunately I can't prove it. Maybe someone will be able to help. I'd appreciate that a lot. Thanks in advance.