Where is my solution wrong for this AM-GM Maxima question? Question 

For $x> 0$, maximize $f(x)=(1+x)(1+x)(1-x)$.

My solution Using AM-GM for two variables, $a$ and $b$, $a = (1+x)^4$ and $b = (1-x)^2$, we get f(x) is maximum when $a=b$.
But when I solve for $x$ by equating $a=b$, it has  a negative root and 2 complex roots.
The correct answer is $1.185$.
Where is my solution wrong? How can we solve this using two variables by AM-GM inequality?
Thank you.
 A: $$2f(x)  = (1+x)(1+x)(2-2x)\leq \Big({1+x+1+x+2-2x\over 3}\Big)^3 = \Big({4\over 3}\Big)^3$$
Equality is iff $1+x=2-2x$, i.e. $x=1/3$ and $y_{\max} = {32\over 27}$
A: Perhaps given this is a cubic, calculus is simpler. You are maximizing
$$
\begin{split}
f(x)   &= -x^3-x^2 + x + 1\\
f'(x)  &= -3x^2 -2x + 1\\
f''(x) &= -6x-2 = -2(x+3)
\end{split}
$$
and $f'(x) = 0$ yields via the quadratic formula
$$
x_\pm = \frac{2 \pm 4}{-6} = \{-1,1/3\}.
$$
Note that $f''(x) < 0$ for $x>-3$. Can you finish?
A: You did it correctly, but your AM is not a constant, but a variable. 
$$(1+x)^4+(1-x)^2\ge 2(1+x)^2|1-x|,$$
the equality occurs for $(1+x)^4=(1-x)^2 \Rightarrow x=-3,0$. Indeed, the equality occurs, but it does not mean it is the maximum value. 
Similarly, you can consider $a=\frac38(1+x)^4,b=\frac83(1-x)^2$:
$$\frac38(1+x)^4+\frac83(1-x)^2\ge 2(1+x)^2|1-x|,$$
the equality occurs for $a=b \Rightarrow x=-5,\frac13$ and this time the maximum occurs at $x=\frac13$. How do I know? I found the answer other way and chose such $a$ and $b$ deliberately. What is the other way? You can see other answers. Note that in Aqua's answer the AM (the right hand side) is a constant number, so it is true for all values of $x$. Here I just wanted to answer your question: "Where is my solution wrong?" 
