$\int_0^\pi \cos^2 x$ - Where did I go wrong?

We have that

$$I = \int_{0}^{\pi} \cos^2 x \ dx= 2 \int_{0}^{\pi/2} \cos^2 x \ dx = 2 \int_{0}^{\pi/2} \cos^2 (\pi/2 - x) \ dx = 2 \int_{0}^{\pi/2} \sin^2 x \ dx$$

and thus

$$I = \int_{0}^{\pi/2} (\cos^2 x +\sin^2 x)\ dx = \pi/2$$


You need to integrate the integrand $\cos^2(x)$ first. The identity $\displaystyle\cos^2(x)=\frac{1+\cos(2x)}{2}$ is of use here.


From the addition identity:

$$\cos (a+b)=\cos a\cdot \cos b-\sin a\cdot \sin b,$$

we get (setting $a=b$)

$$\cos (2a)=\cos ^{2}a-\sin ^{2}a.$$

Applying the Pythagorean trigonometric identity $\cos^2a+\sin^2a=1$, in the form $$\sin^2a=1-\cos^2a,$$

yields

$$\cos (2a)=\cos ^{2}a-\sin ^{2}a=\cos ^{2}a-1+\cos^2a=2\cos ^{2}a-1,$$

or, equivalently

$$\cos ^{2}a=\dfrac{1+\cos (2a)}{2}.$$

Setting $x=a$ results in

$$\cos ^{2}(x)=\dfrac{1+\cos (2x)}{2}=\dfrac{1}{2}+\dfrac{\cos (2x)}{2}.$$

Then

$$\int_{0}^{\pi} \cos^2 x \ \text{d}x=\int_{0}^{\pi}\dfrac{1}{2}+\dfrac{\cos (2x)}{2} \ \text{d}x=\dfrac{1}{2}\pi+\dfrac{1}{2}\int_{0}^{\pi}\cos (2x)\ \text{d}x=\dfrac{1}{2}\pi+\dfrac{1}{4}\int_{0}^{2\pi }\cos t\;\mathrm{d}t.$$

I leave to you the evaluation of $\displaystyle\int_{0}^{2\pi}\cos t\ \text{d}t$. Remember that you have to find the antiderivative of $\cos t$, or just observe that the period of $\cos t$ is equal to $2\pi$.