<s>[INST] Differentiating two trig functions. Check. I have two problems that I'd like a quick checkup on. I am trying to differentiate these two functions:


*

*$f(x) = x \cdot \cos x + 2\cdot \tan x$
and


*$f(x) = e^x \cdot \cos x$
Here are my attempts:


*

*Going to use a combo of sum and product rules. 


$$f'(x) = \frac{d}{dx} (x\cdot cosx) + \frac{d}{dx} (2\cdot tanx)$$
$$= x\cdot(-sinx) + cosx + 2sec^2x$$
Is there anyway to simplify from here? It looks like I'm missing something...


*$$f'(x) = e^x\cdot sinx + cosx \cdot e^x$$
$$e^x(\sin x + \cos x)$$
Here's another check:


*Differentiate $y = sec\theta \cdot tan\theta$
$$= y' = sec\theta \cdot sec^2\theta + tan\theta \cdot sec\theta \cdot tan\theta$$
$$= sec^3\theta + tan^2\theta \cdot sec\theta$$
$$= sec\theta \cdot (sec^2\theta + tan^2\theta)$$
 [/INST] Perhaps extending the steps will help. We have 
$$f(x) = x\cos(x) + 2\tan(x)$$ 
Then 
\begin{align*}
f'(x) &= \frac{d}{dx}\left(x\cos(x) + 2\tan(x)\right)\\
&= \frac{d}{dx}\bigg( x \bigg) \cos(x) + x\frac{d}{dx}\bigg( \cos(x) \bigg) + \frac{d}{dx}\bigg(2\tan(x) \bigg )\\
&= \cos(x) - x\sin(x) + 2\sec^2(x)
\end{align*}
For the second we have 
$$f(x) = e^{x}\cos(x)$$
Then 
\begin{align*}
f'(x) &= \frac{d}{dx}\bigg(e^{x}\cos(x)\bigg)\\
&= \frac{d}{dx}\bigg(e^{x}\bigg)\cos(x) + e^{x}\frac{d}{dx}\bigg(\cos(x)\bigg)\\
&= e^{x}\cos(x) - e^{x}\sin(x)\\
&= e^{x}\left(\cos(x) - \sin(x)\right)
\end{align*}
</s>