integral from 0 to pi/2 (cos x- cos^2 x) + integral from pi/2 to pi (cos^2 x- cos x)