Find the fourier series of

F(x) = 1, -L<=x<0
= 0, 0<=<L

f(x+2L) = f(x)

You can take the functions:

e_n(x) = exp(i pi n x/L)

to be your the basis functions. If you define the inner product as:

<f,g> = 1/(2 L) Integral from -L to L
of f(x)g*(x) dx

Then the e_n are orthonormal. So, you can expand a function f(x) as:

f(x) = sum over n of <f,e_n> e_n(x)

The coefficient of e_n is thus the integral from -L to 0 of
exp(-pi i n x/L) dx

If n is not equal to zero, this is:

-1/(2 pi i n) [1 - (-1)^n]

So, for nonzero n, only the coefficients for odd n are nonzero. The coefficient for n = 0 is easily found to be 1/2 . If you now combine the contribution from negative and positive n, you find that the Fourier series is given by:

1/2 - 2/pi sum from k = 0 to infinity of

2/(2k+1) Sin[(2k+1)x/L]