1
$\begingroup$

in a Fourier series for function $$f(x)=\begin{cases}-1&\text{for }-\pi<x<0\\\sin x&\text{for }0<x<\pi\end{cases}$$ with $f(x)=f(x+ 2 \pi)$, is $f(x)= \dfrac{a_0}{2}+ \sum\limits_{n=1}^{ \infty}(a_n \cos nx+b_n \sin nx) $. we have:

$a_n=0, n=2k+1; b_n=0, n=2k$

I get stuck in this problem. How this coefficient was calculated?‌ a bit more explanation was highly appreciated.

$\endgroup$

closed as off-topic by Rolf Hoyer, user147263, Claude Leibovici, ASB, N. F. Taussig Apr 18 '15 at 11:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Rolf Hoyer, Community, Claude Leibovici, ASB, N. F. Taussig
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ You may check this $\endgroup$ – thanasissdr Apr 17 '15 at 21:49
  • $\begingroup$ @thanasissdr my problem is via my example not your example. $\endgroup$ – user223812 Apr 18 '15 at 5:49
1
$\begingroup$

The function is defined on the interval $(- \pi, 0) \cup (0,\pi)$, which means that the length of the interval (which happens to be the period) is $\boxed{L = 2\pi}$. We know that: $$\displaystyle a_n= \dfrac 2L \cdot \int_{-\pi}^{\pi} f(x)\cdot \cos\left(\dfrac{2n\pi x} L\right) \,dx.$$


However,

$$\displaystyle \int_{-\pi}^0 -1\cdot \cos (nx)\,dx = -\dfrac{\sin(n\pi)}\pi=0, \quad \text{since $n$ is an integer}.$$

How to compute $$\displaystyle \int_0^\pi \sin x \cdot \cos (nx)\, dx.$$

Integrals of the form $$\displaystyle \int \sin (\alpha x)\cdot \cos (\beta x)\,dx$$ are evaluated using the formula: $$\boxed{2 \sin\alpha \cos \beta = \sin(\alpha+\beta) +\sin(\alpha - \beta)}.$$

Thus, we have:

$\displaystyle \int_0^\pi \sin x \cos(nx)\,dx = \dfrac 12 \int_0^\pi 2 \sin x \cos (nx)\,dx =\displaystyle\dfrac 12 \int_0^\pi \sin(x+nx) + \sin(x-nx) \, dx\\ =\displaystyle\dfrac 12 \int_0^\pi \sin[(n+1) x]\, dx + \dfrac 12 \int_0^\pi \sin[(1-n)x]\, dx\\ =-\displaystyle\dfrac 12 \cdot \left[\dfrac {\cos[(n+1)x]}{n+1}\right]_0^\pi -\dfrac 12 \cdot \left[\dfrac{\cos[(1-n)x]}{1-n}\right]_0^\pi\\ = \cdots\\ = \dfrac 12 \cdot \left(\dfrac{n-1}{n^2 -1} - \dfrac{(n-1) \cos[(n+1) \pi]}{n^2-1} - \dfrac{(n+1)\cos[(1-n)\pi]}{1-n^2} + \dfrac{n+1}{1-n^2}\right)\\ = \dfrac 12 \cdot \dfrac{2 + (n-1) \cos[(n+1)\pi] - (n+1) \cos[(n-1)\pi]}{1-n^2}\\ =\dfrac 12 \cdot \dfrac {2 - 2\cos[(n+1)\pi]}{1-n^2}, \quad\text{because $\cos[(n+1)\pi] = \cos[(n-1)\pi]$, for $n\geqslant 1$}\\ = \dfrac 12 \cdot \dfrac{1 - \cos[(n+1) \pi]} {1-n^2}\\ = \dfrac {1+\cos(n\pi)}{1-n^2}, \quad \text{because $\cos[(n+1)\pi] = -\cos(n\pi)$}. $

Also, I used the fact that $\cos[(n-1) \pi ] = \cos [(1-n)\pi]$.

Thus, $$a_n = \dfrac 2 {2\pi} \cdot \dfrac{1+\cos(n\pi)}{1-n^2}.$$

For $b_n$ you will need to evaluate $\displaystyle \int \sin x \sin(nx)\, dx$. Thus, you will need to use the identity $$\boxed{2 \sin\alpha \sin \beta = \cos(\alpha - \beta) - \cos(\alpha +\beta)}.$$

P.S. I cannot do all the math, since the answer is going to be too long!

$\endgroup$
  • $\begingroup$ you agree with a_n,b_n that I‌ mentioned in question ? $\endgroup$ – user223812 Apr 18 '15 at 13:06
  • $\begingroup$ no b_n is zero when is odd. a_n is zero when is even. $\endgroup$ – user223812 Apr 18 '15 at 13:19
  • $\begingroup$ Final result: $a_n = 0,$ when $n$ is odd ($n = 2k+1)$. $b_n = 0$, when $n$ is even($n=2k$), which agrees with what you have written. $\endgroup$ – thanasissdr Apr 18 '15 at 13:33
  • 1
    $\begingroup$ I think if you complete your answer, get more + points. it's messy now. +1 for nice answer. $\endgroup$ – user153695 Apr 18 '15 at 13:40
  • 1
    $\begingroup$ Whenever I get some time, I may write down the whole process for evaluating $a_n$. Calculating $b_n$ is similar. $\endgroup$ – thanasissdr Apr 18 '15 at 13:57
0
$\begingroup$

Here's my attempt: I'm not sure I get those answers either - are you sure they are right?

The formula for $a_{n}, b_{n}$ are: $$a_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)cos(\frac{n\pi x}{L})dx $$ $$b_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)sin(\frac{n\pi x}{L})dx $$

Since L is half the period, L = $\pi$ in this example.

$$ f(x) = \begin{cases} -1 & \text{if } -\pi< x < 0 \\ sin(x) & \text{if } 0 < x < pi \end{cases} $$

Then

$$a_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1cos(nx)dx + \int\limits_{0}^{\pi}sin(x)cos(nx) dx) = \frac{1}{\pi} \int\limits_{0}^{\pi}sin(x)cos(nx) dx = \frac{1}{\pi} \frac{cos(n\pi)+1}{1-n^2}$$

$$b_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1sin(nx)dx + \int\limits_{0}^{\pi}sin(x)sin(nx) dx)=\frac{1}{\pi} (\frac{cos(nx)}{n}|_{-\pi}^{0} + \frac{\pi}{2}) = \frac{1}{\pi} (\frac{1-(-1)^n}{n}+\frac{\pi}{2}) $$

$\endgroup$
  • $\begingroup$ I accept it, but not understand why my book short answer that I mentioned it the question is differ from your last answer? would you please complete to get last result numerically ? $\endgroup$ – user223812 Apr 18 '15 at 5:50