∫cosx/(1+cosx)dx
=2∫[cos^2(x/2)-sin^2(x/2)]/[cos^2(x/2)]dx
=2∫[1-tan^2(x/2)]dx
=2∫[2-sec^2(x/2)]dx
=4x-4tan(x/2)+C