Note a couple things:
- cos2x=2cos^2x-1" "=>" "cos^2x=1/2(1+cos2x)cos2x=2cos2x−1 ⇒ cos2x=12(1+cos2x)
- d/dxtanx=sec^2x" "=>" "intsec^2xdx=tanx+Cddxtanx=sec2x ⇒ ∫sec2xdx=tanx+C
So the integral becomes:
f(x)=intcos^2xdx-intsec^2xdx=1/2int(1+cos2x)dx-tanxf(x)=∫cos2xdx−∫sec2xdx=12∫(1+cos2x)dx−tanx
Splitting the remaining integral up:
=1/2intdx+1/2intcos2xdx-tanx=12∫dx+12∫cos2xdx−tanx
The first integral is simple. For the other, let u=2xu=2x so du=2dxdu=2dx. Then:
=1/2x+1/4intcos2x(2dx)-tanx=1/2x+1/2intcosudu-tanx=12x+14∫cos2x(2dx)−tanx=12x+12∫cosudu−tanx
The integral of cosine is sine:
f(x)=1/2x+1/4sinu-tanx=1/2x+1/4sin2x-tanx+Cf(x)=12x+14sinu−tanx=12x+14sin2x−tanx+C
We can determine CC by using the initial condition f(pi/8)=-1f(π8)=−1. We could do this with decimals, but for fun we'll do it using identities. Note that tan(x/2)=(1-cosx)/sinxtan(x2)=1−cosxsinx:
-1=1/2(pi/8)+1/4sin(pi/4)-tan(pi/8)+C−1=12(π8)+14sin(π4)−tan(π8)+C
-1=pi/16+1/4(1/sqrt2)-(1-cos(pi/4))/sin(pi/4)+C−1=π16+14(1√2)−1−cos(π4)sin(π4)+C
-1-pi/16-1/(4sqrt2)+(1-1/sqrt2)/(1/sqrt2)=C−1−π16−14√2+1−1√21√2=C
C=-1-pi/16-1/(4sqrt2)+(sqrt2-1)C=−1−π16−14√2+(√2−1)
C=sqrt2-2-pi/16-1/(4sqrt2)C=√2−2−π16−14√2
Then:
f(x)=1/2x+1/4sin2x-tanx+sqrt2-2-pi/16-1/(4sqrt2)f(x)=12x+14sin2x−tanx+√2−2−π16−14√2