How to solve properly #int tan(x)/cos^2x#?

I have a doubt on how to solve this integral.

The first and the correct way to solve is:
#int (tan x) /cos^2x dx#
Let's rewrite
#int sin x / cos^3x dx#
With the #u# substitution:
#u = cos x#, so #du = -sin x#
#-int1/u^3du# = #1/(2u^2) + C#
Substitute the original value and the result is:
#1/(2cos^2x)+C#

The second way with the mistake is:
#int (tan x) /cos^2x dx#
#int (tan x) * 1/cos^2x dx#
#u = tan(x)#, so #du = 1/cos^2x#
Which means:
#int u \ du# = #u^2/2+C#
#tan^2x/2 + C#

1 Answer
Jan 13, 2018

The answer is #=1/(2(1-sin^2x))+C#

Explanation:

Reminder :

#intx^ndx=x^(n+1)/(n+1)+C(n!=-1)#

Apply #tanx=sinx/cosx#

Therefore,

#int(tanxdx)/cos^2x=int(sinxdx)/(cos^3x)#

Perform the substitution

#u=cosx#, #=>#, #du=-sinxdx#

Therefore,

#int(tanxdx)/cos^2x=-int(du)/u^3=-intu^-3du#

#=-(-u^-2/2)#

#=1/(2cos^2x)+C#

#=1/(2(1-sin^2x))+C#