How do you differentiate f(x)=(2x-cos^3x)^2-(lnx)^2 using the chain rule?

Nov 10, 2015

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(4 + 6 {\cos}^{2} \left(x\right) \sin \left(x\right)\right) \left(2 x - {\cos}^{3} \left(x\right)\right) - \frac{2 \ln \left(x\right)}{x}$

Explanation:

So we have

$y = {\left(2 x - {\cos}^{3} \left(x\right)\right)}^{2} - {\ln}^{2} \left(x\right)$

Derivating it

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{d}{\mathrm{dx}} {\left(2 x - {\cos}^{3} \left(x\right)\right)}^{2} - \frac{d}{\mathrm{dx}} \left({\ln}^{2} \left(x\right)\right)$

Let's solve the log part first, let's call $\ln \left(x\right) = u$

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{d}{\mathrm{dx}} {\left(2 x - {\cos}^{3} \left(x\right)\right)}^{2} - \frac{d}{\mathrm{du}} {u}^{2} \frac{\mathrm{du}}{\mathrm{dx}}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{d}{\mathrm{dx}} {\left(2 x - {\cos}^{3} \left(x\right)\right)}^{2} - 2 u \cdot \frac{1}{x}$

Let's say that $\left(2 x - {\cos}^{3} \left(x\right)\right) = v$

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{d}{\mathrm{dv}} {v}^{2} \frac{\mathrm{dv}}{\mathrm{dx}} - 2 u \cdot \frac{1}{x}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = 2 v \cdot \frac{d}{\mathrm{dx}} \left(2 x - {\cos}^{3} \left(x\right)\right) - 2 u \cdot \frac{1}{x}$

We break that derivative in two parts and apply the distributive

$\frac{\mathrm{dy}}{\mathrm{dx}} = 2 v \cdot \frac{d}{\mathrm{dx}} \left(2 x\right) - 2 v \cdot \frac{d}{\mathrm{dx}} \left({\cos}^{3} \left(x\right)\right) - 2 u \cdot \frac{1}{x}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = 4 v - 2 v \cdot \frac{d}{\mathrm{dx}} \left({\cos}^{3} \left(x\right)\right) - 2 u \cdot \frac{1}{x}$

Let's say that $w = \cos \left(x\right)$

$\frac{\mathrm{dy}}{\mathrm{dx}} = 4 v - 2 v \cdot \frac{d}{\mathrm{dw}} {w}^{3} \frac{\mathrm{dw}}{\mathrm{dx}} - 2 u \cdot \frac{1}{x}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = 4 v - 6 v {w}^{2} \cdot \frac{d}{\mathrm{dx}} \left(\cos \left(x\right)\right) - 2 u \cdot \frac{1}{x}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = 4 v + 6 v {w}^{2} \sin \left(x\right) - 2 u \cdot \frac{1}{x}$

Put everything in terms of $x$

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(4 + 6 {w}^{2} \sin \left(x\right)\right) v - \frac{2 u}{x}$
$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(4 + 6 {\cos}^{2} \left(x\right) \sin \left(x\right)\right) \left(2 x - {\cos}^{3} \left(x\right)\right) - \frac{2 \ln \left(x\right)}{x}$