# Solve this

Question:

If $y=e^{x} \cos x$, prove that $\frac{d y}{d x}=\sqrt{2} e^{x} \cos \left(x+\frac{\pi}{4}\right)$

Solution:

Given $y=e^{x} \cos (x)$

On differentiating y with respect to $x$, we get

$\frac{d y}{d x}=\frac{d}{d x}\left(e^{x} \cos x\right)$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left(\mathrm{e}^{\mathrm{x}} \times \cos \mathrm{x}\right)$

Recall that (uv)' $=v u^{\prime}+u v^{\prime}$ (product rule)

$\Rightarrow \frac{d y}{d x}=\cos x \frac{d}{d x}\left(e^{x}\right)+e^{x} \frac{d}{d x}(\cos x)$

We know $\frac{d}{d x}\left(e^{x}\right)=e^{x}$ and $\frac{d}{d x}(\cos x)=-\sin x$

$\Rightarrow \frac{d y}{d x}=\cos x\left(e^{x}\right)+e^{x}(-\sin x)$ [chain rule]

$\Rightarrow \frac{d y}{d x}=e^{x} \cos x-e^{x} \sin x$

$\Rightarrow \frac{d y}{d x}=e^{x}(\cos x-\sin x)$

$\Rightarrow \frac{d y}{d x}=e^{x}(\cos x-\sin x) \times \frac{\sqrt{2}}{\sqrt{2}}$

$\Rightarrow \frac{d y}{d x}=\sqrt{2} e^{x}\left(\frac{\cos x-\sin x}{\sqrt{2}}\right)$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\sqrt{2} \mathrm{e}^{\mathrm{x}}\left(\cos \mathrm{x} \times \frac{1}{\sqrt{2}}-\sin \mathrm{x} \times \frac{1}{\sqrt{2}}\right)$

We know $\cos \left(\frac{\pi}{4}\right)=\sin \left(\frac{\pi}{4}\right)=\frac{1}{\sqrt{2}}$

$\Rightarrow \frac{d y}{d x}=\sqrt{2} e^{x}\left(\cos x \cos \frac{\pi}{4}-\sin x \sin \frac{\pi}{4}\right)$

However, $\cos (A) \cos (B)-\sin (A) \sin (B)=\cos (A+B)$

$\therefore \frac{\mathrm{dy}}{\mathrm{dx}}=\sqrt{2} \mathrm{e}^{\mathrm{x}} \cos \left(\mathrm{x}+\frac{\pi}{4}\right)$

Thus, $\frac{d y}{d x}=\sqrt{2} e^{x} \cos \left(x+\frac{\pi}{4}\right)$