# Fourier series for $\sin x$ is zero?

I have no practical reason for wanting to do this, but I was wondering why the Fourier series for $\sin x$ is the identical zero function.

I'm probably doing something wrong or missing some important condition.

Could someone help me see?

-
What have you done? –  draks ... Oct 16 '12 at 10:48
Why do you believe it is the zero function? $\sin(x)=1\cdot \sin(x)+0\cdot \sin(2x)+0\cdot \sin(3x)+\cdots$. –  Per Manne Oct 16 '12 at 10:48
@draks Oh then I must've gotten the coefficients wrong. The period of $\sin x$ is $2\pi$, so I got wolframalpha.com/input/?i=2%2Fpi+*+integrate+sin+x+sin+nx+from+0+to+p‌​i as the general term for the coefficients, which I figure is zero since $\sin (n\pi)$ is zero for all integers n. –  Ryan Oct 16 '12 at 10:52
But for $n=1$ you need to integrate $\sin^2 x$. –  Javier Badia Oct 16 '12 at 10:55

Wolfram gives the following:

$$\frac2{\pi}\int_{0}^{\pi} \sin x \sin (nx)\ dx = -\frac{2\sin(n\pi)}{\pi(n^2-1)}$$

You are almost correct in that this is zero for all $n$ because $\sin(n\pi) = 0$ for every integer. But when $n=1$, the formula doesn't work, because the $n^2-1$ in the denominator becaomes zero too. You need to consider that as a special case:

$$\frac2{\pi}\int_{0}^{\pi} \sin x \sin (1x)\ dx = \frac2{\pi}\int_0^{\pi} \sin^2 x \ dx = \frac2{\pi} \frac{\pi}{2} = 1.$$

-
Oh yes, I just saw that too. The special case needed to be introduced at the point of trying to integrate $\cos( (1-n)x)$. Heehee! Thanks Javier. –  Ryan Oct 16 '12 at 11:17
We can still use the formula. Take the limit $n\to 1$. (+1) by the way. –  user26872 Oct 16 '12 at 11:18

You can use the same formula. But need to take the limit for n=1 case.

 r = (1/Pi) Integrate[Sin[x] Sin[n x], {x, -Pi, Pi}]


b1 = Limit[r, n -> 1]


Assuming[Element[k, Integers], Integrate[Sin[x] , {x, -Pi, Pi}]]


Hence $b_1=1$ and all others zero. Hence Fourier series of $\sin(x)= b_1 \sin(x) = \sin(x)$

-