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!

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]

To find the Fourier series of the given square wave function, we need to compute the coefficients a_k and b_k using the given integrals. Let's start by calculating a_k:

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

To evaluate this integral, we can use the trigonometric identity:

∫ cos(kt) dt = (1/k) * sin(kt) + C

Applying the limits of integration, we get:

a_k = 1/pi * ((1/k) * sin(kt)] from -pi to pi

Evaluating the expression:

a_k = 1/pi * ((1/k) * sin(kpi) - (1/k) * sin(-kpi))

Since sin(-kpi) = -sin(kpi), we have:

a_k = 1/pi * ((1/k) * sin(kpi) + (1/k) * sin(kpi))

a_k = 1/pi * (2/k * sin(kpi))

Using the property sin(n*pi) = 0 for any integer n, we can simplify further:

a_k = 0 for all k (except k = 0)

Next, let's find b_k:

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

Using the same trigonometric identity, we have:

∫ sin(kt) dt = -(1/k) * cos(kt) + C

Applying the limits of integration:

b_k = 1/pi * (-(1/k) * cos(kt)) from -pi to pi

Evaluating the expression:

b_k = 1/pi * (-(1/k) * cos(kpi) + (1/k) * cos(-kpi))

Since cos(-kpi) = cos(kpi), we have:

b_k = 1/pi * (-(1/k) * cos(kpi) + (1/k) * cos(kpi))

b_k = 1/pi * (2/k * cos(kpi))

Using the property cos(n*pi) = (-1)^n for any integer n, we can simplify further:

b_k = (-2/pi) * (1/k) * ((-1)^k)

Now, we have the expressions for a_k and b_k:

a_k = 0 for all k (except k = 0)
b_k = (-2/pi) * (1/k) * ((-1)^k)

These coefficients obtained will allow us to write the Fourier series of the given square wave function.

To find the Fourier series of the given function, which is a square wave, you have correctly started by writing the function as a piecewise function.

Now, let's focus on finding the coefficients, a_k and b_k, which are the constants in front of the cosine and sine terms respectively in the Fourier series representation.

To find a_k, you need to evaluate the integral of cos(kt) from -pi to pi:

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

For cosine, the integral will be zero except when k = 0. When k = 0, the integral will give the average value of the function over one period. In this case, the average value of the square wave function is 1.

So, a_0 = (1/pi) ∫[1 dt] (from -pi to pi) = (1/pi)(2pi) = 2

For b_k, you need to evaluate the integral of sin(kt) from -pi to pi:

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

The integral of sin(kt) will be zero for all values of k.

Since all the terms for b_k are zero, the Fourier series for the square wave function will only have the cosine term.

Therefore, the Fourier series representation of the given function is:

f(t) = a_0/2 + ∑[a_k * cos(kt)]

In this case, a_0/2 = 1 (since a_0 = 2)

So, the Fourier series representation of the square wave function is:

f(t) = 1 + ∑[a_k * cos(kt)]

where the summation is over all k except k = 0.

So, the resulting Fourier series will have cosine terms only, with the coefficient a_0 being 2 and all other coefficients, a_k, being zero.