An inequality involving square roots and sums

I've been trying to prove (maybe even disprove) the following inequality: $$\sum_{n=1}^{N} \frac{a_n}{\sqrt{\sum_{i=1}^{n}a_i}} \leq C \sqrt{\sum_{n=1}^{N}a_n}$$ Where $$a_1,...,a_N\geq 0$$ are some non-negative numbers, and $$C$$ is an absolute constant. Help will be much appreciated.

• $C$ is absolute means that it is independent of $N$, right? Also, although it probably doesn't much matter, you say symbolically that the $a$'s are non-negative, but then write that they are positive. – LSpice Apr 12 '20 at 23:45
• @LSpice You're right, my bad. As Iosif Pinelis expalined though, it doesn't really matter – GuyK Apr 13 '20 at 10:25

For every $$n\in\{1,\dotsc,N\}$$, we have $$2\sqrt{\sum_{i\leq n} a_i}-2\sqrt{\sum_{i\leq n-1} a_i}=\frac{2a_n}{\sqrt{\sum_{i\leq n} a_i}+\sqrt{\sum_{i\leq n-1} a_i}}>\frac{a_n}{\sqrt{\sum_{i\leq n} a_i}}.$$ Summing these up, we obtain the inequality with $$C=2$$. It is also straightforward to see that for $$C<2$$ the inequality fails, hence $$C=2$$ is the optimal constant.
Rewrite your inequality as $$lhs:=\sum_{n=1}^N \frac{s_n-s_{n-1}}{\sqrt{s_n}}\le C\sqrt{s_N},$$ where $$s_n:=\sum_{i=1}^n a_i$$. Note that $$\sum_{n=1}^N \frac{s_n-s_{n-1}}{\sqrt{s_n}}$$ is a lower Riemann sum for the integral $$\int_0^{s_N}\frac{ds}{\sqrt s}=2\sqrt{s_N}.$$ So, $$lhs\le2\sqrt{s_N},$$ as desired.
In the above proof, it was tacitly assumed that $$a_i>0$$ for all $$i$$. This can be obviously extended to the case when we only know that $$a_i\ge0$$ for all $$i$$ -- assuming that, by continuity, $$\frac{a_n}{\sqrt{\sum_{i=1}^{n}a_i}}:=0$$ whenever $$a_n=0$$.