Step 1 :Given the integral, \(I = \int e^x \cos^2 x dx\)
Step 2 :Using the double angle formula, \(\cos^2 x = \frac{1 + \cos(2x)}{2}\)
Step 3 :Substitute the double angle formula into the integral, \(I = \int e^x \frac{1 + \cos(2x)}{2} dx\)
Step 4 :Separate the integral, \(I = \frac{1}{2} \int e^x dx + \frac{1}{2} \int e^x \cos(2x) dx\)
Step 5 :Integrate the first part, \(\frac{1}{2} \int e^x dx = \frac{1}{2} e^x + C_1\)
Step 6 :Use integration by parts for the second part, let \(u = e^x\) and \(dv = \cos(2x) dx\)
Step 7 :Then, \(du = e^x dx\) and \(v = \frac{1}{2} \sin(2x)\)
Step 8 :Apply integration by parts, \(\int u dv = uv - \int v du\)
Step 9 :\(\frac{1}{2} \int e^x \cos(2x) dx = \frac{1}{2} e^x \sin(2x) - \frac{1}{2} \int e^x \sin(2x) dx\)
Step 10 :Use integration by parts again for the remaining integral, let \(u = e^x\) and \(dv = \sin(2x) dx\)
Step 11 :Then, \(du = e^x dx\) and \(v = -\frac{1}{4} \cos(2x)\)
Step 12 :Apply integration by parts, \(\int u dv = uv - \int v du\)
Step 13 :\(-\frac{1}{2} \int e^x \sin(2x) dx = -\frac{1}{4} e^x \cos(2x) + \frac{1}{4} \int e^x \cos(2x) dx\)
Step 14 :Solve for the remaining integral, \(\frac{1}{2} \int e^x \cos(2x) dx = \frac{1}{3} e^x \sin(2x) - \frac{1}{6} e^x \cos(2x) + C_2\)
Step 15 :Combine the results, \(I = \frac{1}{2} e^x + \frac{1}{3} e^x \sin(2x) - \frac{1}{6} e^x \cos(2x) + C\)
Step 16 :\(\boxed{I = \frac{e^x}{2} + \frac{e^x \sin(2x)}{3} - \frac{e^x \cos(2x)}{6} + C}\)