Given $x+y+z=3$, how do I maximize $xy+yz+zx-xyz$? Given non-negative numbers $x,y,z$ such that $x+y+z=3$. How do I maximize $xy+yz+zx-xyz$. I found out that the maximum is 2 and equality holds when one of the numbers is 1 and the other two sum up to 2 but had no idea how to prove it. Can someone help please?

We can equivalently want to maximize:
$$
\begin{aligned}
(1-x)(1-y)(1-z)
&=1-\underbrace{(x+y+z)}_{=3}+(xy+yz+zx)-xyz\\
&=-2 + (xy+yz+zx)-xyz\\[3mm]
&\qquad\text{ so let us substitute }\\
X&=1-x\ ,\\
Y&=1-y\ , \\
Z&=1-z\ .\qquad\text{ These variables satisfy:}\\
X+Y+Z &= 3-(x+y+z)=0\ ,\text{ and}\\
(*)\qquad 1&\ge X,Y,Z\ .
\end{aligned}
$$
The maximum of $XYZ$ is of course positive, obtained when we arrange for two of the variables to be negative, and one positive. We will assume (w.l.o.g) for this $X,Y\le 0$, so $Z\ge 0$.
The positive variable $Z$ is then the only one suffering from the restriction $(*)$, and we have only the condition $Z\le 1$. If $Z< 1$, we can change multiplicatively $X,Y,Z$ by multiplying them each by $1/Z$, the sum remains zero, the product gets bigger by the factor $(1/Z)^3>1$. So we may and do assume $Z=1$ while maximizing. This implies $X+Y=-1$, and of course the product $XY$ is maximal for $X=Y=-\frac12$.
We come back to the $(x,y,z)$ world and obtain a maximal value for $x=y=1-\left(-\frac 12 \right)=\frac 32$ and $z=1-1=0$. Since $z=0$, the only term surviving is $xy$, the maximal value is thus $\left(\frac 32\right)^2=\frac 94>2$.
