# How do you differentiate f(x)= 1/2 sin(2x) + cosx?

Jul 29, 2015

You use the sum rule and the chain rule.

#### Explanation:

The first thing to notice here is that your function can be written as the sum of two other functions, let's say $g \left(x\right)$ and $h \left(x\right)$, which means that you c an use the sum rule to differentiate it.

The sum rule tells you that the derivative of a sum of functions is equal to the sum of the derivatives of those functions

$\textcolor{b l u e}{\frac{d}{\mathrm{dx}} \left(f \left(x\right)\right) = {f}^{'} \left(x\right) + {g}^{'} \left(x\right)}$

$f \left(x\right) = y = \frac{1}{2} \sin \left(2 x\right) + \cos x$, so that

$\left\{\begin{matrix}g \left(x\right) = \frac{1}{2} \sin \left(2 x\right) \\ h \left(x\right) = \cos x\end{matrix}\right.$

The derivative of $f \left(x\right)$ will thus loook like this

${y}^{'} = \frac{d}{\mathrm{dx}} \left(\frac{1}{2} \cdot \sin \left(2 x\right)\right) + \frac{d}{\mathrm{dx}} \left(\cos x\right)$

${y}^{'} = \frac{1}{2} \cdot \frac{d}{\mathrm{dx}} \left(\sin \left(2 x\right)\right) + \frac{d}{\mathrm{dx}} \left(\cos x\right)$

At this stage, you need to realize that ${g}^{'} \left(x\right)$ can be differentiate by using he chain rule and that

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

$\frac{d}{\mathrm{dx}} \left(\sin x\right) = \cos x$

So, the chain rule tells you that you can differentiate a function $y$ that depends on a variable $u$, which in turn depends on another variable $x$, like this

$\textcolor{b l u e}{\frac{d}{\mathrm{dx}} \left(y\right) = \frac{d}{\mathrm{du}} \left(y\right) \cdot \frac{d}{\mathrm{dx}} \left(u\right)}$

In your case, you have $g \left(x\right) = \sin u$, where $u = 2 x$. This means that you have

$\frac{d}{\mathrm{dx}} \left(g \left(x\right)\right) = \frac{d}{\mathrm{du}} \left(\sin u\right) \cdot \frac{d}{\mathrm{dx}} \left(u\right)$

$\frac{d}{\mathrm{dx}} \left(g \left(x\right)\right) = \cos u \cdot 2 \frac{d}{\mathrm{dx}} \left(x\right)$

This is equivalent to

$\frac{d}{\mathrm{dx}} \left(g \left(x\right)\right) = \cos \left(2 x\right) \cdot 2$

${y}^{'} = \frac{1}{\textcolor{red}{\cancel{\textcolor{b l a c k}{2}}}} \cdot \left(\textcolor{red}{\cancel{\textcolor{b l a c k}{2}}} \cdot \cos \left(2 x\right)\right) + \left(- \sin x\right)$
${y}^{'} = \textcolor{g r e e n}{\cos \left(2 x\right) - \sin x}$