[Math] Find the half-range Fourier series expansion of $f(x) = cos(x)$

fourier series

I am stuck on the problem of calculating the half-range Fourier series expansion of $$f(x) = cos(x),$$ $$0 < x < \frac{\pi}{2}$$

I am at the point where I have calculated the definite integral of $b_n$.

$$b_n = \frac{4}{\pi}\int_{0}^{\frac{\pi}{2}} cos(x)sin(nx) dx = \frac{4}{\pi} \cdot \frac{n – sin(\frac{\pi n}{2})}{(n^2 – 1)}$$

According to this Wikipedia link, the correct answer for $b_n$ is

$$b_n = \frac{4}{\pi} \int_{0}^{\frac{\pi}{2}} cos(x)sin(nx) dx = \frac{4}{\pi} \cdot \frac{n((-1)^n + 1)}{(n^2 – 1)}.$$

Can someone please explain to me how to go from
$$\frac{n – sin(\frac{\pi n}{2})}{(n^2 – 1)}$$
to $$\frac{n((-1)^n + 1)}{(n^2 – 1)}.$$

I understand that, for example, $$cos(n\pi)$$ can be written as $$(-1)^n,$$
because $cos(n\pi)$ has alternating $1's$ and $0's$ as $n$ increases.
However, for $sin(\frac{n\pi}{2})$ the alteration is $1$, $0$, $-1$, $0$.

I have been stuck on this problem for hours now.
I will greatly appreciate any explanation 🙂

Best Answer

for $n=1,5,9,....$ the $\sin(\frac{n\pi}{2})=1$ $$\frac{n-\sin(\frac{n\pi}{2})}{n^2-1}=\frac{n-1}{n^2-1}=\frac{1}{n+1}$$

for $n=2,4,6,8....$ all terms equal zero

for $n=3,7,11,...$ the $\sin(\frac{n\pi}{2})=-1$ $$\frac{n-\sin(\frac{n\pi}{2})}{n^2-1}=\frac{n+1}{n^2-1}=\frac{1}{n-1}$$

now add the $\frac{1}{n+1}$ with $\frac{1}{n-1}$ to get what you want $$\frac{1}{n+1}+\frac{1}{n-1}=\frac{2n}{n^2-1}=\frac{n((-1)^n + 1)}{(n^2 - 1)}.$$

Related Question