First, we expand the binomial, and make use of the linearity of the integral:
#int ( 1 - tan x )^2\ d x = int \ d x - 2 int tan x\ d x + int tan^2 x\ d x =#
#= x - 2 int tan x\ d x + int tan^2 x\ d x#.
Now we have two simple integrals to solve. The first one:
#int tan x\ d x =#
#= int \frac{sin x}{cos x}\ d x =#
#= [ - int \frac{1}{t}\ d t ]_{t = cos x} =#
#= - ln | cos x | + C#.
And the second one:
#int tan^2 x\ d x =#
#= int \frac{sin^2 x}{cos^2 x}\ d x =#
#= int \frac{1 - cos^2 x}{cos^2 x}\ d x =#
#= int \frac{1}{cos^2 x} - 1\ d x =#
#= tan x - x + C#.
Putting it all together, we arrive at
#x - 2 int tan x\ d x + int tan^2 x\ d x =#
#x + 2 ln | cos x | + tan x - x + C=#
#2 ln | cos x | + tan x + C#.