Fourier series for $\sin^2(x)$
I was asked to compute the Fourier series for $\sin^2(x)$ on $[0,\pi]$. Now this is what I did and I'd like to know if I'm right. $\sin^2(x)=\frac12-\frac12\cos(2x)$ . I got the right hand side using trig identities. I'm wondering If I can do this without using the formulas. Thanks.
One small point...
The way the question is stated, there may be a slight ambiguity. One way (and almost certainly the intended way) to read the question is: given the (periodic) function $\sin^2(x)$, find its Fourier series on the interval $[0, \pi]$. In this case, $(1 - \cos(2x))/2$ is correct.
However, we could also read it as follows: given the function $\sin^2(x)$ defined on the interval $[0, \pi]$, find its Fourier series. In this case, we must first decide how to extend the function to be periodic. Of course the natural choice is to extend it to equal $\sin^2(x)$ for all $x$. Again, the cosine series is correct.
But... we do have the freedom to extend $\sin^2(x)$ to an odd function on $[-\pi, \pi]$ instead, in which case the Fourier series will contain only sine functions (with the coefficients computed in the usual way). The point being that there is in fact another series, featuring only sines, that converges to $\sin^2(x)$ on the interval $[0, \pi]$. Of course, the convergence isn't as fast ;-).
Regarding the uniqueness theorem for Fourier series.
I felt the obligation to say something due to all comments and the directed answer. What I meant is that it is in general one can not just say that a trigonometric expansion is a Fourier expansion, you must relay on something (for example that you have a trigonometric polynomial of basis elements, hence it is the Fourier series of the function).
If we look at $I=(0,2\pi)$, then $\Sigma=\{1,\sin(nx),\cos(nx)\}$ makes up an orthonormal basis for $L^2(I)$ (or piecewise continuous complex valued functions on $I$ below denoted by $C_p(I)$) in the sense $$(1)\qquad\langle e,f\rangle=0$$ for all $e_1,e_2\in\Sigma$ where $e_1\ne e_2$, and if $f\in L^2(I)$ (or $f\in C_p(I)$ satisfy) $$(2)\qquad \langle e,f\rangle=0$$ for all $e\in\Sigma$ then $f=0$. Here $$ \langle e,f\rangle =\frac{1}{\pi}\int_0^{2\pi}e(x)\bar{f(x)}dx.$$
The property (2) is called the uniquness of Fourier expansion for $L^2(I)$ (or $C_p(I)$) and is a consequence of the more general statement
Theorem. If $f\in L^1(I)$ then $\langle f,e\rangle=0$ for all $e\in\Sigma$ if and only if $f=0$.
The theorem deserves some comment even though it seams easy. Let us write $$ a_n=\frac{1}{2\pi}\int_0^{\pi}f(x)\cos(nx)dx\qquad\text{and}\qquad b_n=\frac{1}{\pi}\int_0^{2\pi}f(x)\sin(nx)dx.$$ The difficult part of the theorem is that in general we do not know if the Fourier series $\frac{a_0}{2}+\sum_{k=1}^\infty a_n\cos(nx)+b_n\sin(nx)$ converges to $f$, and also if it is not obvious that it is it possible to interchange integration and summation like this $$\int_0^{2\pi}f(x)\sin(kx)dx=\int_0^{2\pi}(\frac{a_0}{2}+\sum_{k=1}^\infty a_n\cos(nx)+b_n\sin(nx))\sin(kx)dx =$$ $$\qquad\sum_{k=1}^\infty \int_0^{2\pi}(a_n\cos(nx)+b_n\sin(nx))\sin(kx).$$ Also, there are convergent trigonometric series that are not Fourier series an example is (see Katznelson, Yitzhak (1976) An introduction to harmonic analysis.) $$\sum_{k=2}^\infty \frac{\sin(nx)}{\log n}$$ A way to prove the theorem is to use that $K_n*f\to f$ in $L^1$-norm where $K_n$ is a trigonometric summation kernel such as the Fejér kernel.
Sure. That is the Fourier series for the function.
@AD
Even though the question has been answered... the Fourier expansion is:
$f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left[a_n\cos(nx) + b_n\sin(nx)\right]$
which is a decomposition over the set of orthogonal trigonometric functions $\{1, \sin(kx), \cos(kx)\}, \forall k \in \mathbb{Z}$.
So, that means that really the Fourier expansion of a function is unique. And so, simply by identifying $a_0 = \frac{1}{2}$, $a_2 = -\frac{1}{2}$ and all of the other coefficients 0, we find a pairing that has the desired form of a Fourier Series, and which therefore is the Fourier expansion of $f(x)$.