# How do you find the derivative of  y = sin(x cos x) using the chain rule?

Nov 4, 2016

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\cos x - x \sin x\right) \cdot \cos \left(x \cos x\right)$

#### Explanation:

You will need to use the product rule to find $\frac{d}{\mathrm{dx}} \left(x \cos x\right)$, and then the chain rule to find $\frac{d}{\mathrm{dx}} \sin \left(x \cos\right)$, so I will explain both;

Use of the Product Rule
If you are studying maths, then you should learn the Product Rule for Differentiation, and practice how to use it:

$\frac{d}{\mathrm{dx}} \left(u v\right) = u \frac{\mathrm{dv}}{\mathrm{dx}} + v \frac{\mathrm{du}}{\mathrm{dx}}$, or, $\left(u v\right) ' = \left(\mathrm{du}\right) v + u \left(\mathrm{dv}\right)$

I was taught to remember the rule in words; "The first times the derivative of the second plus the second times the derivative of the first ".

So with $x \cos x$ we have;

$\frac{d}{\mathrm{dx}} \left(x \cos x\right) = \left(x\right) \left(\frac{d}{\mathrm{dx}} \cos x\right) + \left(\cos x\right) \left(\frac{d}{\mathrm{dx}} x\right)$
$\therefore \frac{d}{\mathrm{dx}} \left(x \cos x\right) = \left(x\right) \left(- \sin x\right) + \left(\cos x\right) \left(1\right)$
$\therefore \frac{d}{\mathrm{dx}} \left(x \cos x\right) = \cos x - x \sin x$ .... [1]

Use of the Chain Rule
You should learn the Chain Rule for Differentiation, and practice how to use it:

If $y = f \left(x\right)$ then $f ' \left(x\right) = \frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}}$

I was taught to remember that the differential can be treated like a fraction and that the "$\mathrm{dx}$'s" of a common variable will "cancel" (It is important to realise that $\frac{\mathrm{dy}}{\mathrm{dx}}$ isn't a fraction but an operator that acts on a function, there is no such thing as "$\mathrm{dx}$" or "$\mathrm{dy}$" on its own!). The chain rule can also be expanded to further variables that "cancel", E.g.

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{dv}} \frac{\mathrm{dv}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}}$ etc, or $\left(\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\textcolor{red}{\cancel{\mathrm{dv}}}} \frac{\textcolor{red}{\cancel{\mathrm{dv}}}}{\textcolor{b l u e}{\cancel{\mathrm{du}}}} \frac{\textcolor{b l u e}{\cancel{\mathrm{du}}}}{\mathrm{dx}}\right)$

So, If $y = \sin \left(x \cos x\right)$, Then:

$\left\{\begin{matrix}\text{Let "u=xcosx & => & (du)/dx=cosx-xsinx " from [1]" \\ "Then } y = \sin u & \implies & \frac{\mathrm{dy}}{\mathrm{du}} = \cos u\end{matrix}\right.$

Using $\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\frac{\mathrm{dy}}{\mathrm{du}}\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right)$ we get:

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\cos u\right) \left(\cos x - x \sin x\right)$
$\therefore \frac{\mathrm{dy}}{\mathrm{dx}} = \left(\cos x - x \sin x\right) \cdot \cos \left(x \cos x\right)$