# Finding the Fourier Series of a step function

• Tony Hau
In summary, the conversation discusses the answer in a textbook that presents a formula for a trigonometric series. The formula involves two series, but the individual discussing the content is unsure about where the constant term of ##\frac{1}{4}## comes from. They question whether it should be ##\frac{1}{2}## instead. The expert summarizer explains that the constant term is the average value of ##f(x)## over the interval of interest, and since the function has a value of 1 on a fourth of the interval, the average value is ##\frac{1}{4}##. This is not mentioned in the book, but it is a useful property to remember when double-checking calculations.

#### Tony Hau

Homework Statement
Given : ## f(x) = \begin{cases}
0, & -\pi \lt x \lt 0 \\
1, & 0 \lt x \lt \frac{\pi}{2} \\
0, & \frac{\pi}{2} \lt x \lt \pi
\end{cases} ##,
Find the Fourier Series of ##f(x)##.
Relevant Equations
##a_n =\frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx)dx##
##b_n =\frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin(nx)dx##
The answer in the textbook writes: $$f(x) = \frac{1}{4} +\frac{1}{\pi}(\frac{\cos(x)}{1}-\frac{\cos(3x)}{3}+\frac{\cos(5x)}{5} \dots) + \frac{1}{\pi}(\frac{\sin(x)}{1}-\frac{2\sin(2x)}{2}+\frac{\sin(3x)}{3} + \frac{\sin(5x)}{5}\dots)$$

I am ok with the two trigonometric series in the answer. However, I don't understand where that ##\frac{1}{4}## comes from.
Since the formula for ##a_0## is ##a_0 =\frac{1}{\pi} \int_{0}^{\frac{\pi}{2}} dx##, which gives ##\frac{1}{2}##, isn't that constant equal to ##\frac{1}{2}## instead of ##\frac{1}{4}##.

Tony Hau said:
Since the formula for ##a_0## is ##a_0 =\frac{1}{\pi} \int_{0}^{\frac{\pi}{2}} dx##, which gives ##\frac{1}{2}##, isn't that constant equal to ##\frac{1}{2}## instead of ##\frac{1}{4}##.
The first term is the series is ##a_0/2##, not ##a_0##.

• Delta2 and Tony Hau
etotheipi said:
The first term is the series is ##a_0/2##, not ##a_0##.
Thanks. No joke but this thing has bothered me for the whole afternoon... :)

• Delta2 and etotheipi
Tony Hau said:
Thanks. No joke but this thing has bothered me for the whole afternoon... :)

That's annoying... but at least you will never forget it again! • DrClaude, Delta2 and Tony Hau
Note that the constant term of the Fourier series is simply the average value of ##f(x)## over the interval of interest (which is ##[-\pi,\pi]## in this case). Since your ##f(x)## has value ##1## on one fourth of this interval (namely on ##[0,\pi/2]##) and value 0 elsewhere, it's clear that the average value of ##f(x)## is ##1/4##. This is a useful property to keep in mind when double-checking your calculation.

• Tony Hau, etotheipi, DrClaude and 1 other person
jbunniii said:
Note that the constant term of the Fourier series is simply the average value of ##f(x)## over the interval of interest (which is ##[-\pi,\pi]## in this case). Since your ##f(x)## has value ##1## on one fourth of this interval (namely on ##[0,\pi/2]##) and value 0 elsewhere, it's clear that the average value of ##f(x)## is ##1/4##. This is a useful property to keep in mind when double-checking your calculation.
Thanks. This is a nice interpretation that is not mentioned in the book.