Begin by rewriting ∫tan4 xdx as ∫tan2 xtan2 xdx.
Now we can apply the Pythagorean Identity, tan2 x+1=sec2 x, or tan2 x=sec2 x −1
∫tan2 x tan2 x dx = ∫(sec2 x −1)tan2 xdx
Distributing the tan2 x:
= ∫sec2 xtan2 x −tan2 xdx
Applying the sum rule:
= ∫sec2 xtan2 xdx −∫tan2 xdx
We 'll evaluate these integrals one by one.
First Integral
This one is solved using a 
Let u = tanx

Applying the substitution,
Because u = tanx,

Second Integral
Since we don 't really know what ∫tan2 xdx is by just looking at it, try applying the tan2 x = sec2 x −1
identity again:
∫tan2 xdx = ∫(sec2 x −1)dx
Using the sum rule, the integral boils down to:
∫sec2 xdx −∫1dx
The first of these, ∫sec2 xdx, is just tanx + C.
The second one, the so-called "perfect integral ", is simply x+C.
Putting it all together, we can say:
∫tan2 xdx = tanx + C −x + C
And because C+C is just another arbitrary constant, we can combine it into a general constant C:
∫tan2 xdx = tanx −x + C
Combining the two results, we have:
∫tan4 xdx=∫sec2 xtan2 xdx −∫tan2 xdx
=(tan3 x/3 + C) −(tanx −x + C)
=tan3 x/3 −tanx + x + C
Again, because C+C is a constant, we can join them into one C.