We need the indefinite integral of [(tan x)^3 + tan x]/(tan x+1)

[(tan x)^3 + tan x]/(tan x+1)

=> tan x[(tan x)^2 + 1)/(tan x + 1)

=> (sec x)^2*tan x / (tan x + 1)

let y = tan x + 1

dy/dx = (sec x)^2

Int [((tan x)^3 + tan x)/(tan x+1) dx]

=> Int[(sec x)^2*tan x / (tan x + 1) dx]

=> Int [(y - 1)/y dy]

=> Int [1 dy ] - Int [(1/y) dy]

=> y - ln y

substitute y = tan x + 1

{take the constant 1 as a part of C}

=> tan x - ln( tan x + 1) + C

**The required indefinite integral is tan x - ln( tan x + 1) + C**

We'll factorize by tan x at numerator and we'll get:

f(x) = (tan x)*[(tan x)^2 + 1]/(tan x + 1)

Now, we'll calculate the indefinite integral:

Int f(x)dx = Int (tan x)*[(tan x)^2 + 1]dx/(tan x + 1)

We'll substitute tan x = t

x = arctan t => dx = dt/(1 + t^2)

We'll re-write the integral:

Int ydx = Int (t)*[(t)^2 + 1]dt/(1 + t^2)*(t+ 1)

We'll simplify by (1 + t^2) and we'll get:

Int tdt/(t+ 1) = Int (t+1)dt/(t+1) - Int dt/(t+1)

Int tdt/(t+ 1) = Int dt - Int dt/(t+1)

Int tdt/(t+ 1) = t - ln |t+1| + C

We'll substitute t by tan x and we'll get:

**The requested indefinite integral is: Int tanx dx/cosx(sinx+cosx) = tan x - ln |tan x + 1| + C.**