# Fourier Series of $f(x) = \sin x$ on $-\pi \leq x \leq \pi$

Find the Fourier series of,

$$f(x) = \sin (x)$$

on the interval $- \pi \leq x \leq \pi.$ I am not quite sure if my workings are correct or if I have chose the right formulas to use since this is my first encounter of Fourier series of trigonometric functions.

My logic here is that $f(x)$ is a period function so I have to use the formula,

$$f(x) = \frac{A_0}{2} + \sum _ {n=1}^{\infty}\Big(A_n\cos(nx) + B_n\sin (nx)\Big)$$

where,

$$A_0 = \frac{1}{\pi} \int^{\pi}_{-\pi} f(x)dx$$ $$A_n = \frac{1}{\pi} \int^{\pi}_{-\pi} f(x)\cos (nx)dx$$ $$B_n = \frac{1}{\pi} \int^{\pi}_{-\pi} f(x)\sin (nx)dx$$

Looking at the function $f(x) = \sin x$ this is a odd function so $A_0$ is a odd function, so $A_0=0$.

Next looking at $A_n$, $f(x)$ is a odd function at $\cos(nx)$ is a even function, so a even function multiplied by a odd function is a odd function and therefore $A_n = 0$

Finally considering $B_n$,

$$B_n = \frac{1}{\pi } \int^{\pi}_{-\pi} \sin (x) \sin(nx) = \frac{cos(x)sin(nx)-nsin(x)cos(nx)}{n^2-1}\Bigg|_{-\pi}^{\pi} = - \frac{2sin(\pi n )}{n^2-1}$$

Therefore, the Fourier series of $f(x) = \sin x$ on $-\pi \leq x \leq \pi$ is,

$$f(x) = \sum_{n=1}^{\infty} - \frac{2sin(\pi n )}{n^2-1}\sin(nx) = \sum _{n=1}^{\infty} \sin x$$

• ... and $\sin\pi n=$? But note that you have something wrong if $n=1$ (where $n^2-1=0$). Don't be too surpriesed when at the end, afer dropping all summands with zero coefficient, something very familiar turns out to be the result – Hagen von Eitzen Oct 26 '17 at 20:52
• Did you consider that $\sin(x)$ can be expressed as a fourier series simply by setting the coefficient of $\sin(1x)$ to $1$ and all other coefficients to $0$? – Austin Weaver Oct 26 '17 at 20:57
• does $\sin \pi n = 0$? – fr14 Oct 26 '17 at 20:57
• @AustinWeaver no I am unaware of this technique, could you show me how? – fr14 Oct 26 '17 at 20:57
• Your integration for $B_n$ looks wrong. $\int_{-\pi}^{\pi} \sin(x)\sin(nx)\ dx = \frac{1}{2} \int_{-\pi}^{\pi} (\cos((n-1)x) - \cos((n+1)x)\ dx$, which is zero unless $n= \pm 1$. – Bungo Oct 26 '17 at 21:05

You can skip all of the difficult work in this problem and a similar set of problems by thinking slightly differently about the problem. The Fourier series is simply a sum of the form:

$$A_0+\sum^\infty_{n=1}(A_n\cos(nx)+B_n\sin(nx)).$$

Where $A$ and $B$ are such that the sum equals $f(x)$ on a specific domain. For trig functions, no calculus is necessary. Simply realize that the sum is really just

$$A_0 + (A_1\cos(1x) + A_2\cos(2x) + \cdots) + (B_1\sin(1x) + B_2\sin(2x) + \cdots)$$

and so if we want to find the $A$s and $B$s necessary to have that sum equal $\sin(kx)$ or $\cos(kx)$ for an integer $k$, we just set all but one of them to $0$.

In this case, we set $B_1$ to $1$ and everything else to $0$:

$$A_0 + (A_1\cos(1x) + A_2\cos(2x) + \cdots) + (B_1\sin(1x) + B_2\sin(2x) + \cdots)\\ = 0 + (0\cos(1x)+0\cos(2x)+\cdots) + (1\sin(1x)+0\sin(2x) + \cdots)\\=\sin(x).$$