# 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.

-
That's a perfectly valid derivation and probably the quickest one. Alternatively, you can take inner products with the sin and cos functions with different periods to determine their coefficients in the expansion. That is the more general method. But in this particular case, what you did is the more clever way to go about it. – Alex B. Dec 15 '10 at 6:49
To add to Alex's comment: if you go the long way and do the inner products anyway, you'll find that you'll need to convert $\sin^2(x)$ to that form you derived to do the required integrations, and you'll easily see that all the expected higher terms zero out. – J. M. Dec 15 '10 at 9:12

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 ;-).

-
+1 for thinking about alternative interpretations. Good practice. – Ross Millikan Dec 16 '10 at 5:27
@cch, if you are still there, i am really interested in the other alternative that converges a little more slowly. the one that contains the sines. how do i get to it? because i need to plot a graph of a few terms of the partial sums. and i just don't see a way to do it with the cosine fourier series. thanks. – guthik Apr 26 '14 at 13:34

Sure. That is the Fourier series for the function.

-
@TLC @Alex. Thanks very much. – Jack Dec 15 '10 at 7:16
@Jack: But how do you prove that? – AD. Dec 15 '10 at 7:23
@AD: I'm not sure I understand your question. – Jack Dec 15 '10 at 7:52
@Jack: How do you know this is the Fourier expansion? In general the Fourier series is an infinite series (see the above comment of Alex, later you learn about the uniqueness theorem for Fourier series). – AD. Dec 15 '10 at 7:59
@AD. Uniqueness of the expansion follows from orthogonality of the sin and cos functions and is a general fact about orthogonal sets in inner product spaces. Concretely, take two Fourier expansions and take the inner product with some sin$(n\pi x)$. That will single out the coefficient of that particular sin in the decomposition. – Alex B. Dec 15 '10 at 8:48

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 cosecuence 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 disurves 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.

-

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)$.

-
You meant $b_n\sin(nx)$, no? – Asaf Karagila Dec 15 '10 at 8:37
Yes, of course. My bad. – Dan-George Filimon Dec 15 '10 at 9:07
Please see my answer where I explain what I mean. – AD. Dec 15 '10 at 19:58

honestly, i don't think that $b_n = 0$ people. unless somebody can convince because the integral of $sin(x)^2 * sin(nx) dx$ is not zero on $(0, \pi )$. it actually has a value and only zero when n = 2. just saying. the post mentioned this interval, i just wondered why most of you assumed $(-\pi, \pi)$ if this is still nonsense to you, you might as well delete this post too, mr.modulator.

-

it's easy to remember that $b_n=0$ with this: even function × even function = even, odd × odd = even, odd × even = odd, and sin × sin = odd × odd = even, so there is no coefficient $b_n$ wich differs from zero. $b_n$ belongs to sin and sin is an odd function and $sin^2$ is even as I said above.

Btw you think it wrong. The interval is not from $(0,\pi)$ but from $(-\pi/2, \pi/2)$. Check the definition of the Fourier series.

-