<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] Suppose $\frac{ax+by}2 \le \sqrt{\frac{ax^2+by^2}{2}}$ is true, let $x=y=1$,
$$\frac{a+b}2\le \sqrt{\frac{a+b}2}$$
$$\frac{(a+b)^2}{4}\le \frac{a+b}2$$
Hence we must have $a+b \le 2$.

Suppose we have $a+b \le 2$, we want to investigate when does
$$(2a-a^2)x^2+(2b-b^2)y^2-2abxy \ge 0, \forall x, y$$
View it as a quadratic equation in $x$, since the coefficient $2a-a^2$ is positive, this is equivalent to the discriminant being non-positive.
$$4a^2b^2y^2 -4(2a-a^2)(2b-b^2)y^2 \le 0, \forall y$$
Equivalently,
$$ab - (2-a)(2-b) \le 0$$
$$-4+2a+2b \le 0$$
$$a+b \le 2$$
which is true as that is our assumption. That is $a+b \le 2 \implies \frac{ax+by}2 \le \sqrt{\frac{ax^2+by^2}{2}}$.

Conclusion: $a+b \le 2 \iff \frac{ax+by}2 \le \sqrt{\frac{ax^2+by^2}{2}}$.
</s>