Considering that:
#(dsinx)/dx = cosx#
#(dcosx)/dx = -sinx#
#int cos^2xdx =int cosx * cosx dx =int cosx d(sinx)#
Integrating by parts:
#int cos^2xdx = sinxcosx - int sinx dcosx = #
# = sinxcosx + int sin^2x dx = #
# = sinxcosx + int (1-cos^2x) dx = #
# = sinxcosx + x - int cos^2x dx #
So:
#2int cos^2xdx = sinxcosx + x#
and finally:
#int cos^2xdx = 1/2(x+1/2sin2x) + C#
An alternative method is to use the identity:
#cos(2x) = cos^2x-sin^2x = cos^2x - (1-cos^2x) = #
# = 2cos^2x-1#
so that:
#cos^2x = (1+cos2x)/2#
#int cos^2xdx = int (1+cos2x)/2 dx = 1/2(x+1/2sin2x) + C#