<s>[INST] Proving that inequality holds under condition. 
Let $a$ and $b$ be positive numbers. Prove that inequality $$\frac{ax+by}{2} \leqslant \sqrt{\frac{ax^2+by^2}{2}}$$
holds for all real $x$ and $y$ only and only if $a+b \leqslant2$

Problem needs to be done using "basic" algebraic methods.
I tried expanding this into form $$2ax^2+2by^2-a^2x^2-b^2y^2-2abxy \geqslant 0$$
and then take oustide parenthesis $2-a-b$. Inequalities between means did not help either.
Can you give me some clues?
 [/INST] Let $a+b\leq2$.
Thus, by C-S $$\sqrt{\frac{ax^2+by^2}{2}}=\sqrt{\frac{(a+b)(ax^2+by^2)}{2(a+b)}}\geq\frac{|ax+by|}{\sqrt{2(a+b)}}\geq\frac{|ax+by|}{2}\geq\frac{ax+by}{2}.$$
Let $a$ and $b$ are positives and  $$\sqrt{\frac{ax^2+by^2}{2}}\geq\frac{ax+by}{2}$$ is true for any reals $x$ and $y$.
Thus, for $x=y=1$ we obtain:
$$\sqrt{\frac{a+b}{2}}\geq\frac{a+b}{2},$$ which gives $$a+b\leq2.$$
</s>