# What is f(x) = int xsinx^2 + tan^2x -cosx dx if f(pi)=-2 ?

Mar 21, 2018

$f \left(x\right) = \tan x - \frac{1}{2} \cos {x}^{2} - x - \sin x - 2 + \frac{1}{2} \cos {\pi}^{2} + \pi$

#### Explanation:

$f \left(x\right) = \int \left(x \sin \left({x}^{2}\right) + {\tan}^{2} x - \cos x\right) \mathrm{dx} = \frac{1}{2} \int 2 x \sin \left({x}^{2}\right) \mathrm{dx} + \int {\sec}^{2} x \mathrm{dx} - \int 1 \mathrm{dx} - \int \cos x \mathrm{dx} = - \frac{1}{2} \cos {x}^{2} + \tan x - x - \sin x + \text{c}$

We are also told

$f \left(\pi\right) = - \frac{1}{2} \cos {\pi}^{2} + \tan \pi - \pi - \sin \pi + \text{c"=-1/2cospi^2-pi+"c} = - 2 \Rightarrow c = - 2 + \frac{1}{2} \cos {\pi}^{2} + \pi$

So

$f \left(x\right) = \tan x - \frac{1}{2} \cos {x}^{2} - x - \sin x - 2 + \frac{1}{2} \cos {\pi}^{2} + \pi$

Mar 21, 2018

$f \left(x\right) = - \frac{1}{2} \cos {x}^{2} + \tan x - x - \sin x + \left(\pi - 2 - \frac{1}{2} \cos {\pi}^{2}\right)$

#### Explanation:

Let
$I = \int \left(x \sin {x}^{2} + {\tan}^{2} x - \cos x\right) \mathrm{dx}$
By sum rule

$I = \int \left(x \sin {x}^{2}\right) \mathrm{dx} + \int \left({\tan}^{2} x\right) \mathrm{dx} + \int \left(\cos x\right) \mathrm{dx}$
Let
${I}_{1} = \int \left(x \sin {x}^{2}\right) \mathrm{dx}$

${I}_{2} = \int \left({\tan}^{2} x\right) \mathrm{dx}$

${I}_{3} = \int \left(\cos x\right) \mathrm{dx}$

$I = {I}_{1} + {I}_{2} - {I}_{3}$

Now,

${I}_{1} = \int \left(x \sin {x}^{2}\right) \mathrm{dx}$

Rearranging

${I}_{1} = \int \left(\sin {x}^{2}\right) \left(x \mathrm{dx}\right)$

Let
$u = {x}^{2}$

$\sin {x}^{2} = \sin u$

$\frac{\mathrm{du}}{\mathrm{dx}} = 2 x$

$x \mathrm{dx} = \frac{1}{2} \mathrm{du}$

${I}_{1} = \int \sin u \left(\frac{1}{2} \mathrm{du}\right)$

${I}_{1} = - \frac{1}{2} \int \left(- \sin u \mathrm{du}\right)$

$\int - \sin u \mathrm{du} = \cos u$

$u = {x}^{2}$

${I}_{1} = - \frac{1}{2} \cos {x}^{2}$

${I}_{2} = \int \left({\tan}^{2} x\right) \mathrm{dx}$

${\sec}^{2} x - {\tan}^{2} x = 1$

${\tan}^{2} x = {\sec}^{2} x - 1$

$\int \left({\tan}^{2} x\right) \mathrm{dx} = \int \left({\sec}^{2} x - 1\right) \mathrm{dx}$

$= \int {\sec}^{2} x \mathrm{dx} - \int 1 \mathrm{dx}$

$\int {\sec}^{2} x \mathrm{dx} = \tan x$

$\int 1 \mathrm{dx} = x$

$\int \left({\tan}^{2} x\right) \mathrm{dx} = \tan x - x$

${I}_{2} = \tan x - x$

${I}_{3} = \int \left(\cos x\right) \mathrm{dx}$

$\int \cos x \mathrm{dx} = \sin x$

${I}_{3} = \sin x$

$I = {I}_{1} + {I}_{2} - {I}_{3}$

$I = \int \left(x \sin {x}^{2} + {\tan}^{2} x - \cos x\right) \mathrm{dx}$

${I}_{1} = - \frac{1}{2} \cos {x}^{2}$

${I}_{2} = \tan x - x$

${I}_{3} = \sin x$

$\int \left(x \sin {x}^{2} + {\tan}^{2} x - \cos x\right) \mathrm{dx} = - \frac{1}{2} \cos {x}^{2} + \tan x - x - \sin x$

Also

$f \left(\pi\right) = - 2$

Here,

$f \left(x\right) = \int \left(x \sin {x}^{2} + {\tan}^{2} x - \cos x\right) \mathrm{dx} + C$

$f \left(\pi\right) = - \frac{1}{2} \cos {\pi}^{2} + \tan \pi - \pi - \sin \pi + C$

$\tan \pi = 0$

sinpi=0

$- 2 = - \frac{1}{2} \cos {\pi}^{2} - \pi + C$

$C = \pi - 2 - \frac{1}{2} \cos {\pi}^{2}$

$f \left(x\right) = - \frac{1}{2} \cos {x}^{2} + \tan x - x - \sin x + \left(\pi - 2 - \frac{1}{2} \cos {\pi}^{2}\right)$