Start by performing color(blue)(" Integration by parts") Integration by parts using the formula
color(blue)(int u dv=uv-int v du )∫udv=uv−∫vdu
the solution is quite long because it consists of two terms.
from the given:
int (x sin x - sec 2x) dx∫(xsinx−sec2x)dx
color (red)("First part:")First part:
int (x sinx) dx∫(xsinx)dx
Let u=xu=x, and dv=sin x dxdv=sinxdx
and v=-cos xv=−cosx and du=dxdu=dx
so that int (x sinx) dx=-x*cos x-int -cos x dx∫(xsinx)dx=−x⋅cosx−∫−cosxdx
then color (blue)(int (x sinx) dx=-x*cos x+sin x)∫(xsinx)dx=−x⋅cosx+sinx
color (red)(" second part:") second part:
Use the formula: int (sec u) du=ln (sec u+tan u)+C∫(secu)du=ln(secu+tanu)+C
so that
color(blue)(int sec 2x dx=1/2*ln(sec 2x+tan 2x))∫sec2xdx=12⋅ln(sec2x+tan2x)
Now , combine the first and second parts
color (magenta)(f(x)=int (x sin x - sec 2x) dx=f(x)=∫(xsinx−sec2x)dx=
color(magenta)(-x*cos x+sin x-1/2*ln(sec 2x+tan 2x)+C)−x⋅cosx+sinx−12⋅ln(sec2x+tan2x)+C
Solve for C: using f(pi/12)=-2f(π12)=−2 and then
-2=-(pi/12)*cos (pi/12)+sin (pi/12)-1/2*lnabs(sec 2*(pi/12)+tan 2*(pi/12))+C−2=−(π12)⋅cos(π12)+sin(π12)−12⋅ln∣∣sec2⋅(π12)+tan2⋅(π12)∣∣+C
-2=-(pi/12)*1/2*sqrt(2+sqrt3)+1/2*sqrt(2-sqrt3)-1/2*lnabs(2/sqrt3+1/sqrt3)+C−2=−(π12)⋅12⋅√2+√3+12⋅√2−√3−12⋅ln∣∣∣2√3+1√3∣∣∣+C
C=1/2 ln sqrt3+pi/24*sqrt(2+sqrt3)-1/2*sqrt(2-sqrt3)-2C=12ln√3+π24⋅√2+√3−12⋅√2−√3−2
The final answer is
color (magenta)(f(x)=-x*cos x+sin x-1/2 ln (sec 2x+tan 2x) + 1/2 ln sqrt3+pi/24*sqrt(2+sqrt3)-1/2*sqrt(2-sqrt3)-2)f(x)=−x⋅cosx+sinx−12ln(sec2x+tan2x)+12ln√3+π24⋅√2+√3−12⋅√2−√3−2
simplifying the square roots we have the following
color (magenta)(f(x)=-x*cos x+sin x-1/2 ln (sec 2x+tan 2x) -1.73129)f(x)=−x⋅cosx+sinx−12ln(sec2x+tan2x)−1.73129