# Fourier Series Expansion, getting an undefined coefficient

I'm asked to find the Fourier series of the following function as a sine series with period $$2\pi$$. $$f(x)= cosx \ on \ [0,\pi]$$

Since we wish to get a sine series we need to make $$a_n = 0 \ for \ all \ n\geq 0$$. Hence, we need an odd extension. Then I did the required calculations as follows: \begin{aligned} f ( x ) = & \sum _ { n = 1 } ^ { \infty } b _ { n } \cdot \sin \left( \frac { n \pi } { L } x \right) = \sum _ { n = 1 } ^ { \infty } b _ { n } \sin ( n x ) \end{aligned}

$$b _ { n } = \frac { 1 } { \pi } \int _ { 0 } ^ { \pi } \cos v \cdot \sin ( n x ) \cdot d x$$

$$b_n = \frac { 1 } { \pi } \left[ - \frac { \cos ( \pi + n \pi ) } { 1 + n } - \frac { \cos ( n n - \pi ) } { n - 1 } + \frac { 1 } { 1 + n } + \frac { 1 } { n - 1 } \right]$$

However, what bothers me is that we have now undefined terms for $$n=1$$ on the right hand side. I'm missing the point somewhere but I couldn't figure out. Can you help me what can be done to resolve this?

$$\begin{array} { l } b _ { 1 } = \frac { 1 } { L } \langle f ( x ) , \sin x \rangle \\ b _ { 1 } = \frac { 1 } { \pi } \int _ { - \pi } ^ { \pi } \cos x \cdot \sin x \cdot d x \\ b _ { 1 } = \frac { 2 } { \pi } \int _ { 0 } ^ { \pi } \cos x \cdot \sin x \cdot d x \\ b _ { 1 } = \frac { 1 } { \pi } \int _ { 0 } ^ { \pi } 2 \sin x \cdot \cos x = 0 \end{array}$$
The problem is that your last equality holds only when $$n\neq 1$$. To get $$b_1$$, you need to substitute in $$n=1$$ to the definition and calculate it separately.
And I think your task is to find the Fourier Sine Series of $$f$$, that is, extend it to an odd function with $$f(-x)=-f(x)$$, and calculate the Fourier Series of the resulting function on $$[-\pi,\pi]$$. But this is almost the same, because for an odd $$f$$, we have that: $$\int_{-\pi}^{\pi}f(x)\sin(nx)\mathrm{d}x=2\int_{0}^{\pi}f(x)\sin(nx)\mathrm{d}x$$
• $$\begin{array} { l } b _ { 1 } = \frac { 1 } { L } \langle f ( x ) , \sin x \rangle \\ b _ { 1 } = \frac { 1 } { \pi } \int _ { - \pi } ^ { \pi } \cos x \cdot \sin x \cdot d x \\ b _ { 1 } = \frac { 2 } { \pi } \int _ { 0 } ^ { \pi } \cos x \cdot \sin x \cdot d x \\ b _ { 1 } = \frac { 1 } { \pi } \int _ { 0 } ^ { \pi } 2 \sin x \cdot \cos x = 0 \end{array}$$ Edit: ah yes, you are right. I deleted the previous comment. Commented May 27, 2020 at 15:57