Stuck with this integral

228 Views Asked by At

I want to compute this integral $$\int_{-\frac{\pi}{2}}^\frac{\pi}{2} \cos(x)\,e^{-inx} dx $$ to determine the fourier coefficients of $$y(x)=\max(\cos(x),0)$$ In order to calculate the sum of $$ \sum_{1}^\infty \frac{(-1)^n}{4n^{2}-1} $$

When I calculate the coefficients, I rewrite $\cos(x)$ in terms of exponentials: $$ \int_{-\frac{\pi}{2}}^\frac{\pi}{2} \frac{e^{ix}+e^{-ix}}{2}e^{-inx}\,dx $$

I'm able to integrate this integral, but I get something really messy in the end with several cases..not able to solve it in order to get something useful to compute the sum.

2

There are 2 best solutions below

8
On

The integral is

$$\frac{e^{-inx}}2\left(\left.\frac{e^{ix}}{i(1-n)}+\frac{e^{-ix}}{i(-1-n)}\right)\right|_{-\pi/2}^{\pi/2}\\ =\frac{e^{-in\pi/2}}2\left(\frac1{1-n}+\frac1{1+n}\right)-\frac{e^{in\pi/2}}2\left(-\frac1{1-n}-\frac1{1+n}\right)\\ =\frac{\cos\left(n\frac\pi2\right)}{1-n^2}.$$

0
On

For calculating the integral in a detailed and step-by-step manner,

$\displaystyle I = \int\limits_{-\pi/2}^{\pi/2} \cos x e^{-inx}\;dx \\ \displaystyle = \int\limits_{-\pi/2}^{\pi/2} \cos x e^{inx}\;dx $

By adding, $\displaystyle 2I =2\int\limits_{-\pi/2}^{\pi/2} \cos x \cos(nx)\;dx \\ \displaystyle = \int\limits_{-\pi/2}^{\pi/2} \left(\cos(n+1)x+\cos(n-1)x\right)\;dx \\ \displaystyle = \dfrac{2}{n+1}\sin\left(\dfrac{\pi (n+1)}{2}\right)+\dfrac{2}{n-1}\sin\left(\dfrac{\pi (n-1)}{2}\right)\\ \displaystyle =\dfrac{2}{n+1}\cos\left(\dfrac{\pi n}{2}\right)-\dfrac{2}{n-1}\cos\left(\dfrac{\pi n}{2}\right)\\ \displaystyle =2\cos\left(\dfrac{\pi n}{2}\right) \times \dfrac{-2}{n^2-1}$

Therefore, $\displaystyle I=\dfrac{2}{1-n^2}\cos\left(\dfrac{\pi n}{2}\right)$

Infact, $\displaystyle \sum_{n\in\mathbb{N}} \frac{(-1)^n}{4n^2-1} \\= \displaystyle \frac{1}{2}\sum_{n\in\mathbb{N}} \left(\frac{(-1)^n}{2n-1}-\frac{(-1)^n}{2n+1}\right) \\ = \displaystyle\frac{1}{2}-\frac{\pi}{4} \\$

where the last sum follows from $\displaystyle \sum_{n\in\mathbb{N}} \frac{(-1)^{n-1}}{2n-1}=\frac{\pi}{4}$