Take the integral: integral (cos(x))/sqrt(cos(x)+1) dx
For the integrand (cos(x))/sqrt(1+cos(x)), substitute u = 1+cos(x) and du = -sin(x) dx: = integral (u-1)/(sqrt(2-u) u) du
For the integrand (-1+u)/(sqrt(2-u) u), substitute s = sqrt(2-u) and ds = -1/(2 sqrt(2-u)) du: = integral -(2 (1-s^2))/(2-s^2) ds
Factor out constants: = -2 integral (1-s^2)/(2-s^2) ds
For the integrand (1-s^2)/(2-s^2), cancel common terms in the numerator and denominator: = -2 integral (s^2-1)/(s^2-2) ds
For the integrand (-1+s^2)/(-2+s^2), do long division: = -2 integral (1/(s^2-2)+1) ds
Integrate the sum term by term: = -2 integral 1/(s^2-2) ds-2 integral 1 ds
Factor -2 from the denominator: = -2 integral -1/(2 (1-s^2/2)) ds-2 integral 1 ds
Factor out constants: = integral 1/(1-s^2/2) ds-2 integral 1 ds
For the integrand 1/(1-s^2/2), substitute p = s/sqrt(2) and dp = 1/sqrt(2) ds: = sqrt(2) integral 1/(1-p^2) dp-2 integral 1 ds
The integral of 1/(1-p^2) is tanh^(-1)(p): = sqrt(2) tanh^(-1)(p)-2 integral 1 ds
The integral of 1 is s: = sqrt(2) tanh^(-1)(p)-2 s+constant
Substitute back for p = s/sqrt(2): = sqrt(2) tanh^(-1)(s/sqrt(2))-2 s+constant
Substitute back for s = sqrt(2-u): = sqrt(2) tanh^(-1)(sqrt(1-u/2))-2 sqrt(2-u)+constant
Substitute back for u = 1+cos(x): = sqrt(2) tanh^(-1)(sqrt(sin^2(x/2)))-2 sqrt(1-cos(x))+constant
Factor the answer a different way: = sqrt(1-cos(x)) (csc(x/2) tanh^(-1)(sin(x/2))-2)+constant
Which is equivalent for restricted x values to:
Answer: | | = (2 cos(x/2) (2 sin(x/2)+log(cos(x/4)-sin(x/4))-log(sin(x/4)+cos(x/4))))/sqrt(cos(x)+1)+constant