Why is AM-GM giving 2 contradictory results for the same problem? The problem is the following:
given x and y such that $x+y=1$ and $x,y \geq 0$, find the maximum value of $x^2y$.
The point is, I tried to solve it in 2 different ways, which are shown below, but the second method I used gives a wrong result, and I can't understand where the mistake is.
First Method
Using AM-GM inequality you can say
$ \displaystyle{\left[{\frac{x}{2}\cdot \frac{x}{2} \cdot y}\right]^{\frac{1}{3}} \leq \frac{\frac{x}{2}+\frac{x}{2}+y}{3}}$
But we also have
$\displaystyle{\frac{x}{2}+\frac{x}{2}+y = x+y=1}$
Hence
$\displaystyle{\frac{x^2y}{4} \leq \left(\frac{1}{3}\right)^3  \quad {\LARGE\Rightarrow} \quad x^2y \leq \frac{4}{27}}$
So the solution is
$ max=\frac{4}{27} $, where $x= \frac {2}{3}$ and $y=\frac{1}{3}$
Second Method
Using AM-GM inequality again, we have
$ \displaystyle{\left[x\cdot x \cdot y\right]^{\frac{1}{3}} } \leq \frac{x+x+y}{3}$
Now if you substitute $x+y=1$, you get
$\displaystyle{\left[x\cdot x \cdot y\right]^{\frac{1}{3}} } \leq \frac{x+1}{3}$
Cubing both sides of the inequality, it becomes
$\displaystyle {x^2y\leq \frac{(x+1)^3}{27} }$
It follows that $x^2y$ is maximum when it is equal to the other side of the inequality, so we have:
$\displaystyle {x^2y - \frac{(x+1)^3}{27}= 0 }$
As it is given that $x+y =1$, then $ y=1-x$ and we have a cubic equation which is:
$\displaystyle {x^2(1-x) - \frac{(x+1)^3}{27}= 0 }$
I expected that its solution would be $ x= \frac{2}{3} $ as above, but instead, you can check that its only real solution is $x=y=\frac{1}{2}$
Clearly the correct solution is given by the first method that I showed, as it can also be confirmed by looking for the maximum using the derivative. I just don't know why this happens, apparently I don't see any mistake in the second method.
If anyone is able to come up with an explanation, I would appreciate it, thanks.
 A: Your mistake is in this assumption in your second approach:

It follows that $x^2y$ is maximum when it is equal to the other side of the inequality

This is not true; while at $x = \frac12$,
$$x^2y = \frac{(x+1)^3}{27},$$
the right-hand side is not a constant upper bound, but increasing.
Then it turns out (from the first approach) that the maximum value of $x^2y$ is at $x=\frac23$, when the right-hand side upper bound is larger than the value of $x^2y$.
The graph of the two sides of the (in)equality demonstrates better than my words.

From just the condition $0\le x \le 1$ and the inequality
$$x^2y \le \frac{(x+1)^3}{27},$$
the right-hand side has the global maximum $\frac 8{27}$ at $x=1$, so a rough constant upper bound from these would be
$$x^2y \le \frac{(x+1)^3}{27} \le \frac{8}{27}.$$
But the two equalities happen at different $x$, so overall it's a strict inequality
$$x^2y < \frac{8}{27}$$
and $\frac{8}{27}$ is not the maximum value of $x^2y$.
A: By your second way the equality occurs for $x=y=\frac{1}{2}$, which  gives $x^2y\leq\frac{1}{8},$ which is indeed the maximal value for $x=y$.
But why does $x=y$?
Maybe for $x\neq y$ we can get a greater value?
And indeed, your first solution does not depend on the assuming $x=y$ and it gives a right answer.
