Hello,

I'm trying to find the Fourier Series of a function which is 1 from -pi/2 to pi/2, and zero everywhere else
inside of -pi to pi. I realize this is a square wave and I began the problem with a piecewise function

s(t) = 1 abs(t) < pi/2
0 abs(t) > pi/2

Then I had

a_k = 1/pi integral(from -pi to pi) of [cos(kt)dt]

and

b_k = 1/pi integral(from -pi to pi) of [sin(kt)dt]

but I don't know what to do from here.

Any help is greatly appreciated, thank you!

1 answer

a_k should be (for k > 0)

1/pi integral(from -pi/2 to pi/2) of [cos(kt)dt] = 2 sin(pi k/2)/(pi k)

For even k this is zero. For odd k we can put k = 2n+1:

a_{2n+1} = 2(-1)^n/[pi(2n+1)]

For k = 0 the prefactor of 1/pi is replaced by 1/(2pi). So, you find

a_0 = 1/(2pi) integral(from -pi/2 to p2) dt = 1/2

The b_k are zero because the function is even:

b_k = 1/pi integral(from -pi/2 to pi/2) of [sin(kt)dt] = 0

So, the Fourier series of s(t) is given by:

s(t) = 1/2 + 2/pi sum over n from zero to infinity of
(-1)^n/(2n+1) cos[(2n+1)t]