Use the parametric formula:
#cosx = (1-tan^2(x/2))/(1+tan^2(x/2))#
and substitute:
#t= tan(x/2)#
#x = 2 arctan t#
#dx = (2dt)/(1+t^2)#
we have:
# int dx/(cosx+cosa) = 2 int dt/(1+t^2) 1/((1-t^2)/(1+t^2) +cosa)#
# int dx/(cosx+cosa) = 2 int dt/((1-t^2) +cosa(1+t^2)#
# int dx/(cosx+cosa) = 2 int dt/( (1+cosa) -t^2(1-cosa) )#
Factor the denominator:
# int dx/(cosx+cosa) = 2 int dt/(( sqrt(1+cosa) - tsqrt(1-cosa)) ( sqrt(1+cosa) + tsqrt(1-cosa) )#
and use partial fractions decomposition:
#1/(( sqrt(1+cosa) - tsqrt(1-cosa)) ( sqrt(1+cosa) + tsqrt(1-cosa) ) )= A/( sqrt(1+cosa) - tsqrt(1-cosa)) + B/( sqrt(1+cosa) + tsqrt(1-cosa))#
#A( sqrt(1+cosa) + tsqrt(1-cosa)) + B(sqrt(1+cosa) - tsqrt(1-cosa)) = 1#
#{ ( (A+B) sqrt(1+cosa) = 1) , ((A-B) sqrt(1-cosa) = 0):}#
#A=B= 1/(2sqrt(1+cosa))#
# int dx/(cosx+cosa) = 1/sqrt(1+cosa) int dt/( sqrt(1+cosa) - tsqrt(1-cosa)) +1/sqrt(1+cosa) int dt/( sqrt(1+cosa) + tsqrt(1-cosa))#
Simplify the expression:
# int dx/(cosx+cosa) = int dt/((1+cosa) - tsqrt((1-cosa)(1+cosa)) )+int dt/( (1+cosa) + tsqrt((1-cosa)(1+cosa))#
# int dx/(cosx+cosa) = int dt/((1+cosa) - tsqrt(1-cos^2a) )+int dt/( (1+cosa) + tsqrt(1-cos^2a))#
Now:
#sqrt(1-cos^2a) = abs sin a#
however because of the symmetry of the expression we can ignore the absolute value, as changing #sin a # with #-sin a# leaves everything unchanged:
# int dx/(cosx+cosa) = int dt/((1+cosa) - tsina )+int dt/( (1+cosa) + tsina)#
# int dx/(cosx+cosa) = 1/sina (int dt/((1+cosa)/sina - t )+int dt/( (1+cosa)/sina + t))#
# int dx/(cosx+cosa) = 1/sina (-ln((1+cosa)/sina - t )+ln( (1+cosa)/sina + t)) +C#
Using now the properties of logarithms:
# int dx/(cosx+cosa) = 1/sina ln (( (1+cosa)/sina + t) / ((1+cosa)/sina - t ))+C#
# int dx/(cosx+cosa) = 1/sina ln (( 1+cosa + tsina) / (1+cosa - t sina))+C#
Undoing the substitution:
# int dx/(cosx+cosa) = 1/sina ln (( 1+cosa + tan(x/2)sina) / (1+cosa - tan(x/2) sina))+C#
Multiply by #cos(x/2)# numerator and denominator of the argument:
# int dx/(cosx+cosa) = 1/sina ln (( cos(x/2)+cosacos(x/2) + sin(x/2)sina) / (cos(x/2)+cos(x/2)cosa - sin(x/2) sina))+C#
# int dx/(cosx+cosa) = 1/sina ln (( cos(x/2)+cos(x/2-a) ) / (cos(x/2)+cos(x/2+a)))+C#
Use now the identity:
#cos alpha + cos beta = 2cos((alpha+beta)/2)cos((alpha-beta)/2)#
# int dx/(cosx+cosa) = 1/sina ln (( 2cos((x-a)/2)cos(a/2) ) / (2cos((x+a)/2)cos(a/2)))+C#
# int dx/(cosx+cosa) = 1/sina ln ( cos((x-a)/2) / cos((x+a)/2))+C#
Further trigonometric semplification is possible, but the answer is getting too long...