# What is the derivative of f(x) = x(2-x)^2?

Feb 16, 2016

$f ' \left(x\right) = 3 {x}^{2} - 8 x + 4$

#### Explanation:

The derivative using the product rule is

(df)/dx=x'*(2-x)^2+x*[(2-x)^2]'=(2-x)^2+2*x*(-1)*(2-x)=(2-x)^2-2x*(2-x)= =3x^2-8x+4

Expanding on the above
The Product Rule for Differentiation says that
if $\textcolor{w h i t e}{\text{XX}} g \left(x\right) = \textcolor{red}{a} \cdot \textcolor{b l u e}{b}$
then $\textcolor{w h i t e}{\text{XX}} \frac{d g \left(x\right)}{\mathrm{dx}} = \frac{\mathrm{dc} o l \mathmr{and} \left(red\right) \left(a\right)}{\mathrm{dx}} \cdot \textcolor{b l u e}{b} + \textcolor{red}{a} \cdot \frac{\mathrm{dc} o l \mathmr{and} \left(b l u e\right) \left(b\right)}{\mathrm{dx}}$

For $f \left(x\right) = x {\left(2 - x\right)}^{2}$ we can treat $\textcolor{red}{x}$ as $\textcolor{red}{a} a$ and $\textcolor{b l u e}{{\left(2 - x\right)}^{2}}$ as $\textcolor{b l u e}{b}$

So color(green)((d f(x))/(dx) = dcolor(red)(x)/(dx) * color(blue)((2-x)^2) + color(red)(x) * (d(color(blue)((2-x)^2))/(dx))

$\frac{\mathrm{dx}}{\mathrm{dx}} = 1$ so that part is easy

but (d(2-x)^2)/(dx)=? is a little more challenging.

Noting that ${\left(2 - x\right)}^{2} = \left(\textcolor{\mathmr{and} a n \ge}{2 - x}\right) \left(\textcolor{b r o w n}{2 - x}\right)$
we can apply the Product Rule again to get
$\textcolor{w h i t e}{\text{XXX}} \frac{d {\left(2 - x\right)}^{2}}{\mathrm{dx}} = \frac{d \left(\textcolor{\mathmr{and} a n \ge}{2 - x}\right)}{\mathrm{dx}} \cdot \left(\textcolor{b r o w n}{2 - x}\right) + \left(\textcolor{\mathmr{and} a n \ge}{2 - x}\right) \cdot \frac{d \left(\textcolor{b r o w n}{2 - x}\right)}{\mathrm{dx}}$

Since $\frac{d \left(2 - x\right)}{\mathrm{dx}} = - 1$
we have
$\textcolor{w h i t e}{\text{XXX}} \frac{d {\left(2 - x\right)}^{2}}{\mathrm{dx}} = 2 \times \left(- 1\right) \left(2 - x\right) = 2 {x}^{2} - 4$

and our original equation becomes
$\textcolor{g r e e n}{\frac{d f \left(x\right)}{\mathrm{dx}} = \left(1\right) \cdot {\left(2 - x\right)}^{2} + x \cdot \left(2 x - 4\right)}$
$\textcolor{w h i t e}{\text{XXX}} = \left(4 - 4 x + {x}^{2}\right) + \left(2 {x}^{3} - 4 x\right)$
$\textcolor{w h i t e}{\text{XXX}} = 3 {x}^{2} - 8 x + 4$

Feb 17, 2016

Konstantios's answer provides some important concepts
but for this particular problem there may be a simpler method.

If we expand $x {\left(2 - x\right)}^{2}$
we get
$\textcolor{w h i t e}{\text{XXX}} f \left(x\right) = {x}^{3} - 4 {x}^{2} + 4 x$

then using Exponent Reduction Rule for polynomial derivatives
$\textcolor{w h i t e}{\text{XXX}} f ' \left(x\right) = 3 {x}^{2} - 8 x + 4$