upper bound $\sum_{i=1}^n a_i (a_i-1)/2$ using a function of $\sum_{i=1}^n a_i$

96 Views Asked by At

Given $a_i \in \mathbb{N}\cup\{0\}$ and define $$ A(n) = \sum_{i=1}^n a_i (a_i-1)/2 $$ and $$ B(n) = \sum_{i=1}^n a_i $$ Any ideas how to upper bound $A(n)$ as a "function" of $B(n)$? (the tighter, the better; form of this "function" does not matter).

2

There are 2 best solutions below

0
On

If $a_i =0 $ then $a_i (a_i -1 ) \leq a_i^2.$

If $a_i \geq 1$ then $a_i (a_i -1 ) \leq \left(\frac{2a_i -1}{2}\right)^2 =\left( a_i -\frac{1}{2}\right)^2\leq a_i^2 $

hence

$$2A(n) \leq \sum_i a_i^2 \leq \left(\sum_i a_i \right)^2 =B(n) ^2$$

so

$$A(n)\leqslant \frac{B(n)^2}{2}.$$

0
On

Let $f(x)=\dfrac{x(x-1)}{2}$. We note first that $$\forall\,x,y\ge0,\quad f(x+y)-f(x)-f(y)=xy\ge0$$ Thus, by induction, for nonnegative numbers $a_1,\ldots,a_n$ we have $$\sum_{i=1}^n f(a_i)\le f\left(\sum_{i=1}^na_i\right)$$ Thus, $$A(n)\le \frac{B(n)(B(n)-1)}{2}$$ With equality if $a_1=\cdots=a_{n-1}=0$ for example. So, this is an optimal inequality.