# A periodic function f(x) of period T=2∏ is defined as f(x)=1 for -∏/2 ≤ x ≤ ∏/2 and f(x)=0 otherwise. Find the Fourier series expansion of f(x).

The fourier series expansion of the function `f(x)` is `f(x)=1/2a_0+sum_{n=1}^infty(a_n cos nx+b_n sin nx)`

where the coefficients are given by `a_n=1/pi int_{-pi/2}^{pi/2} f(x) cos nx dx` and `b_n=1/pi int_{-pi/2}^{pi/2} f(x) sin nx dx` since the function is zero outside the limits `-pi/2` and `pi/2` .

Since sine is odd and the function is even, then the product is odd, so all coefficients `b_n=0`

The coefficient `a_0` is

`a_0=1/pi int_{-pi/2}^{pi/2} dx=1`

The rest of the coefficients are given by

`a_n=1/pi int_{-pi/2}^{pi/2} cos nx dx` let `u=nx` then `du=ndx` and limits `+- {npi}/2` .

`=2/{n pi} int_{0}^{{n pi}/2} cos u du` since function is even

`=2/{n pi}( sin({n pi}/2)-sin 0)`

`=2/{n pi} sin ({n pi}/2)`

Since `sin({n pi}/2)=0` for even n then let `n=2k+1` and `sin({(2k+1)pi}/2)=(-1)^k` for `k=0,1,2,3, ldots` .

**This means that the fourier series is**

**`f(x)=1/2+2/pi sum_{k=0}^infty (-1)^k/{2k+1}cos (2k+1)x` **