I am using this YouTube video to learn Fourier Series. The question can be clearly seen in the picture. The instructor calculates $a_0$ as the area under the triangle which is fine. Nothing wrong with it, I get it.
However, I was trying to calculate is as a sum of integration as:
$$
a_0 = \frac{1}{2\pi}[\int_{-\pi}^{0}f(x)dx + \int_{0}^{\pi}f(x)dx]
$$
However, I am unable to get the right answer. I get my answer as $\frac{1}{4}$
Can someone please tell me what is going wrong?
The first integral is zero (which follows from the definition of $f$). The second integral is $x^2/2$ (again using the definition of $f$) evaluated at $\pi$, so $\ldots$