# Find Fourier series of Indicator function

Find Fourier series of $$f(x)$$: $$f(x)=\begin{cases} 1,\ \ a\leqslant x\leqslant b\\ 0\ \ \ \text{otherwise} \end{cases};\ \ \ \ \ [a,b]\in[-\pi;\pi]$$

Here is my attempt: \begin{aligned} &f(x)\sim a_0+\sum_{n=1}^\infty \left(a_n\cos nx+b_n\sin nx\right)=S(x)\\ &a_0=\frac{1}{2\pi}\int\limits_a^b 1\cdot dx=\frac{b-a}{2\pi}\\ &a_n=\frac{1}{\pi}\int\limits_a^b\cos nx dx=\frac{1}{\pi n}(\sin bn-\sin an)\\ &b_n=\frac{1}{\pi}\int\limits_a^b\sin nx dx=\frac{1}{\pi n}(\cos an-\cos bn)\\ &\Rightarrow S(x)=\frac{b-a}{2\pi}+\frac{1}{\pi}\sum_{n=1}^\infty\frac{1}{n}((\sin bn-\sin an)\cos nx+(\cos an-\cos bn)\sin nx)=\\ &=\frac{b-a}{2\pi}+\frac{1}{\pi}\sum_{n=1}^\infty\frac{1}{n}(\sin(n(b-x))-\sin(n(a-x))) \end{aligned} The question is can I simplify it even more? Or should my last expression be the final answer?

## 1 Answer

$$\sin(A) - \sin(B) = 2 \sin(A/2 - B/2) \cos(A/2 + B/2)$$

$$A = nb - nx$$ and $$B = na - nx$$ $$A/2 - B/2 = \left( n \frac{b-a}{2} \right)$$ $$A/2 + B/2 = \left( n x \right)$$ Would be a more dense writing.

• I think it should be $\cos(A/2+B/2)$ in the first line. – Bonrey Feb 18 at 19:51
• Thank you that was a typo – PackSciences Feb 18 at 19:53