I=∫dxa+bcosx
Substituting a+b=u,a−b=v and x2=t⇒dx2=dt, we get
I=∫dtu+vt2
A) For v=0
I=∫dtu=2tu+c=2utanx2+c
B) For v>0
I=2v∫dtt2+u/v=2v√vutan−1(t√vu)+c=2√uvtan−1((tan(x2))√vu)+c
C) For v<0
I=−2v∫dtu−v+t2=2√−v−v2√ulog∣∣
∣
∣
∣∣√u−v+t√u−v−t∣∣
∣
∣
∣∣+c=−1√−uvlog∣∣∣√u+√−vtan(x/2)√u−√−vtan(x/2)∣∣∣+c
D) For v=−1, substituting this in (C)
I=−1√ulog∣∣∣√u+tan(x/2)√u−tan(x/2)∣∣∣+c