I also have limits - zero and Pi.

I seem to have obtained an expression for the integral but substituting Pi makes it troublesome.

so, (apologies for the lack of LaTeX)

let u = tan(x/2)

u = sin(x/2) / cos(x/2)

u cos(x/2) = sin(x/2)

u^2 cos^2(x/2) = sin^2(x/2)

u^2 cos^2(x/2) = (1 - cos^2(x/2)

cos^2(x/2)(1 + u^2) = 1

cos^2(x/2) = 1/ (1 + u^2)

sin^2(x/2) = 1 - 1 /(1 + u^2) = u^2/(1 + u^2)

cos x = cos^2(x/2) - sin^2(x/2)

= 1 / (1 + u^2) - u^2/(1 + u^2) = (1 - u^2)/(1 + u^2)

cos x = (1 - u^2)/(1 + u^2)

when u = tan(x/2)

x/2 = arctan(u)

dx = 2du / (1 + u^2)

substituting these into integral

∫ dx /(5 + 4 cos x)

= ∫ 2du /(1 + u^2)(5 + 4(1 - u^2)/(1 + u^2)

= ∫ 2du/ (5 + 5u^2 + 4 - 4u^2)

= ∫ 2du/ (9 + u^2)

= 2/9 ∫du/ [1 + (u/3)^2)]

= (2/3) ∫(du/3)/ [1 + (u/3)^2)]

= (2/3) arctan(u/3) + C

substitute u/3 = (1/3)tan(x/2)

= (2/3) arctan[1/3tan(x/2) ] + C

but putting Pi into tan(x/2) makes the expression undefined! where did i go wrong?

thank you