Inequality : $ab^2+bc^2+cd^2+da^2 \leq 4$ I have a excercise like that: let $a;b;c \geq 0$ and $a+b+c=3$, prove: $ab^2+bc^2+ca^2 \leq 4$
We can assume $b=mid\{a;b;c\}$, then $(a-b)(b-c) \geq 0$, by that way, the problem is solved.
But I have a question: what should I do if the problem is for 4 variables, eg:

Let $a;b;c;d \geq 0$ and $a+b+c+d=3$, prove: $ab^2+bc^2+cd^2+da^2 \leq 4$

Thank you.
 A: We have
If $x,\,y,\,z$ are non-negative real numers satisfy $x+y+z=3,$ then
$$xy^2+yz^2+zx^2\leqslant 4.$$
Now, suppose $b = \max \{a,\,b,\,c,\,d\}.$ From this inequality we put $x=a,\,y=b,\,z=c+d,$ we get
$$a^2(c+d)+ab^2+b(c+d)^2 \leqslant 4.$$
But
$$a^2(c+d)+ab^2+b(c+d)^2$$
$$= ab^2+bc^2+cd^2+da^2 + c(a^2+2bd)+d^2(b-c)$$
$$ \geqslant ab^2+bc^2+cd^2+da^2.$$
Therefore
$$ab^2+bc^2+cd^2+da^2 \leqslant 4.$$
The proof is completed.
A: If we fix $b$ and $d$ and write $a=x, c=s-x$ where $s=3-b-d\ge 0$ then
$$f(x) = ab^2+bc^2+cd^2+da^2 = b^2 x+b(s-x)^2+d^2(s-x)+dx^2, x \in [0,s]$$
is quadratic with leading coefficient $b+d \ge 0$ so its maximum is obtained at either $x=0 (a=0) $ or $x=s (c=0)$.
Similarly if we fix $a$ and $c$, then setting either $b=0$ or $d=0$ will increase $ab^2+bc^2+cd^2+da^2$. Now WLOG we can assume $c=d=0$. Then we need to prove
$$ab^2 \le 4 \text { where } a+b=3$$
which is obvious via AM-GM:
$$\frac 14 ab^2 = a \cdot \frac b2 \cdot \frac b2 \le \left( \frac{a+\frac b2 + \frac b2}{3} \right)^3 = 1$$
Remark 1: We can easily generalize to: if $a_i\ge 0, \sum_{i=1}^n a_i = 3$ then $S=\sum_{i=1}^n a_i a_{i+1}^2 \le 4$. Note that $a_{n+1}$ is defined as $a_1$.
For any non-adjacent $a_i$, $a_j$ we can show that if we fix everything else, then $S$ obtains maximum at either $a_i=0$ or $a_j=0$ so we are left with two adjacent $a_k, a_{k+1}\ge 0$ while every other terms are zeros. Then we apply AM-GM and we are done.
Remark 2: It's easy to see that your inequality becomes equality if and only if $(a_1, \cdots, a_n)=(1,2,0, \cdots,0)$ or one of its cyclic permutations.
