For an assignment, I am required to calculate the fourier series of this function:
$$ \\ f(x) = \begin{cases} 0 & -1 < x < 0\\ \sin(\pi x) & 0 < x < 1 \end{cases} $$
To do this, I need to find these integrals for $n \ge 1$:
$$\int_{-1}^1 f(x) \cos(n \pi x) \, dx$$ and $$\int_{-1}^1 f(x) \sin(n \pi x) \, dx$$. These are zero for the range where $f(x)$ is zero, and so I still need:
$$ \int_0^1 \sin(\pi x)\cos(n \pi x) \, dx$$ , and
$$ \int_0^1 \sin(\pi x)\sin(n \pi x) \, dx$$
But I'm having trouble with these. The only thing I can see to try is integration by parts, but I get a mess. The first one gives me:
$$ \frac{\sin(\pi x) \cos(n \pi x)}{n\pi} - \frac{1}{n}\int_0^1 sin(\pi x) \sin(n \pi x)$$
So this actually depends on the result of the other one, which seems.. slightly nice, I guess. But treating this integral the same way gives me:
$$ \frac{-\sin(\pi x) \cos(n \pi x)}{n \pi} + \frac{1}{n}\int_0^1 \cos(\pi x) \cos(n \pi x) \, dx$$
And it does look like this will end up with the original integral in it again after another iteration, but the algebra this is generating is already getting beyond me. Is there any easier way to do this that I've missed?
Try the product and sum formulas:
$$\sin x \cos y=\frac{1}{2}[\sin(x+y)+\sin(x-y)]\\ \sin x\sin y=-\frac{1}{2}[\cos(x+y)-\cos(x-y)]$$