We can use the fact that #d(e^x) = e^xdx# to use #e^x# as differential part:
#int e^x cos^2xdx = int cos^2x d(e^x)#
#int e^x cos^2xdx = e^xcos^2x -int e^xd(cos^2x)#
#int e^x cos^2xdx = e^xcos^2x + 2 int e^xcosxsinxdx#
#(1) int e^x cos^2xdx = e^xcos^2x + int e^xsin2xdx#
Solve the resulting integral by parts again:
#int e^xsin2xdx = int sin2xd(e^x)#
#int e^xsin2xdx = e^x sin2x - int e^x d(sin2x)#
#int e^xsin2xdx = e^x sin2x - 2 int e^x cos2xdx#
Now use the trigonometric identity:
#cos2x = cos^2x -sin^2x = 2cos^2x -1#
to have:
#int e^xsin2xdx = e^x sin2x - 2 int e^x (2cos^2x-1)dx#
#int e^xsin2xdx = e^x sin2x - 4 int e^x cos^2xdx + 2 int e^xdx#
#int e^xsin2xdx = e^x sin2x - 4 int e^x cos^2xdx + 2 e^x #
Substitute this expression in #(1)#:
#int e^x cos^2xdx = e^xcos^2x + e^x sin2x - 4 int e^x cos^2xdx + 2 e^x #
#5int e^x cos^2xdx = e^xcos^2x + e^x sin2x + 2 e^x #
and finally:
#int e^x cos^2xdx = (e^x(cos^2x + sin2x + 2))/5+C #
which can also be written as:
#int e^x cos^2xdx = (e^x((cos2x+1)/2 + sin2x + 2))/5+C #
#int e^x cos^2xdx = (e^x(cos2x + 2sin2x + 5))/10+C #