Question:
Evaluate the following integrals:
$\int\left(e^{\log x}+\sin x\right) \cos x d x$
Solution:
Let $\mathrm{I}=\int\left(\mathrm{e}^{\log \mathrm{x}}+\sin \mathrm{x}\right) \cos \mathrm{x} \mathrm{dx}$
$=\int(x+\sin x) \cos x d x$
$=\int x \cos x d x+\int \sin x \cos x d x$
Using integration by parts,
$=x \int \cos x d x-\int \frac{d}{d x} x \int \cos x d x+\frac{1}{2} \int \sin 2 x d x$
$=x \times \sin x-\int \sin x d x+\frac{1}{2}\left(\frac{-\cos 2 x}{2}\right)+c$
$=x \sin x+\cos x-\frac{1}{4} \cos 2 x+c$
$=x \sin x+\cos x-\frac{1}{4}\left[1-2 \sin ^{2} x\right]+c$
$I=x \sin x+\cos x-\frac{1}{4}+\frac{1}{2} \sin ^{2} x+c$
$I=x \sin x+\cos x+\frac{1}{2} \sin ^{2} x+c-\frac{1}{4}$
$I=x \sin x+\cos x+\frac{1}{2} \sin ^{2} x+k$ where, $k=c-\frac{1}{4}$