<s>[INST] Upper bound for $2(x+y+z)-3(xy+yz+zx)+4xyz$ Let $x,y,z\geq 0$ and $x+y+z\leq\frac12$. What is the maximum of $$S=2(x+y+z)-3(xy+yz+zx)+4xyz?$$
When $x=y=z\leq\frac{1}{6}$, we have $S=6x-9x^2+4x^3$, which is an increasing function in $[0,\frac16]$, so the maximum is attained when $x=y=z=\frac16$, which is $83/108$.
When $x=\frac12, y=z=0$, we have $S=1$. Is this the maximum?
It is not clear if we can assume without loss of generality that $x+y+z=\frac12$, since the effect of increasing one variable on $S$ is unclear.
 [/INST] For $y=z=0$ and $x=\frac{1}{2}$ we get a value $1$.
We'll prove that it's a maximal value.
Indeed, let $x=\frac{a}{6}$, $y=\frac{b}{6}$ and $z=\frac{kc}{6}$, where $k>0$ and $a+b+c=3$.
Hence, the condition gives $$\frac{a}{6}+\frac{c}{6}+\frac{kc}{6}\leq\frac{1}{2}$$ or
$$3-c+kc\leq3,$$
which gives $k\leq1$ and we need to prove that
$$\frac{a+b+kc}{3}-\frac{ab+kac+kbc}{12}+\frac{kabc}{54}\leq1$$ or
$$36(a+b+kc)-9(ab+kac+kbc)+2kabc\leq108$$ or
$$k(36c-9ac-9bc+2abc)+36(a+b)-9ab\leq108.$$
But $36c-9ac-9bc+2abc=12c(a+b+c)-9ac-9bc+2abc\geq0$ 
and since $k\leq1$, it's enough to prove that
$$36(a+b+c)-9(ab+ac+bc)+2abc\leq108$$ or
$$4(a+b+c)^3-3(ab+ac+bc)(a+b+c)+2abc\leq4(a+b+c)^3,$$
which is obviously true.
Done!
</s>