I've been working on optimization problems and have been having problems with this one. The only thing that I'm confused about is what's going on when I find the derivative of the function:

$\displaystyle \frac{d}{dx}[(x+d)^2(\frac{w^2}{x^2} +1)] $

Also, in case it matters, $\displaystyle d=24$ and $\displaystyle w=6$, but in the example, the derivative is found with respect to the variables rather than their respective values.

My attempt:

$\displaystyle [(2)(x+d) \cdot (1+1) \cdot (\frac{w^2}{x^2} +1)] + [(x+d)^2 \cdot (\frac{2wx^2-[2xw^2]}{x^4})]$

$\displaystyle [(2)(x+d) \cdot (2) \cdot (\frac{w^2}{x^2} +1)] + [(x+d)^2 \cdot (\frac{2wx-2w^2}{x^3})]$

$\displaystyle [(4)(x+d) \cdot (\frac{w^2}{x^2} +1)] + [(x+d)^2 \cdot (\frac{2wx-2w^2}{x^3})]$

From this point, I could do stuff like factor out a $\displaystyle 2(x+d)$, but it looks like mine won't be very easy to solve for zero.

This is what the derivative is supposed to be, which is easier to solve for zero:

$\displaystyle (x+d)^2(-\frac{2w^2}{x^3})+(\frac{w^2}{x^2}+1)(2)(x+d)$

What am I doing incorrectly?

Thanks!