Fourier series practice problems with solutions

This collection of Fourier series problems covers every major topic encountered in undergraduate mathematics and engineering courses: computing Fourier coefficients, recognising even and odd functions, deriving half-range sine and cosine series, applying Parseval’s identity, and using Fourier series to solve partial differential equations such as the heat equation and wave equation. Problems are arranged by conceptual theme and progress from straightforward coefficient calculations to challenging boundary-value problems, giving you a structured path from first principles to advanced applications.

Fourier Coefficients and the Euler–Fourier Formulas

Before tackling complex waveforms, you must be confident computing the three Fourier coefficients \(a_0\), \(a_n\), and \(b_n\) from the Euler–Fourier formulas. The problems below build that fluency on functions defined over a period of \(2\pi\) and over a general period \(2L\), covering piecewise-constant, polynomial, and exponential functions.

Problem 1: Square Wave on \([-\pi, \pi]\)

Easy

Consider the \(2\pi\)-periodic function defined on one period by

\[f(x) = \begin{cases} -1, & -\pi < x < 0 \\ 1, & 0 < x \leq \pi \end{cases}\]

  1. Compute all three Fourier coefficients \(a_0\), \(a_n\), and \(b_n\).
  2. Write out the full Fourier series and identify which terms are zero and why.
Hint
Because \(f\) is an odd function (\(f(-x) = -f(x)\)), all cosine coefficients vanish immediately. Focus your integration effort entirely on the sine coefficients \(b_n\).
View Solution
Solution to part 1:

Since \(f\) is odd, \(a_0 = 0\) and \(a_n = 0\) for all \(n \geq 1\). For \(b_n\):

\[b_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin(nx)\,dx = \frac{2}{\pi}\int_0^{\pi}\sin(nx)\,dx = \frac{2}{\pi}\left[-\frac{\cos(nx)}{n}\right]_0^{\pi}\]
\[= \frac{2}{n\pi}\bigl(1 – \cos(n\pi)\bigr) = \frac{2}{n\pi}\bigl(1 – (-1)^n\bigr)\]
Thus \(b_n = \dfrac{4}{n\pi}\) when \(n\) is odd, and \(b_n = 0\) when \(n\) is even.
Solution to part 2:
\[f(x) \sim \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\sin\!\bigl((2k+1)x\bigr)}{2k+1} = \frac{4}{\pi}\!\left(\sin x + \frac{\sin 3x}{3} + \frac{\sin 5x}{5} + \cdots\right)\]
The series contains only odd-indexed sine terms because \(f\) is odd (no cosines) and the even-indexed sines cancel due to the specific jump symmetry.

Problem 2: Fourier Series of \(f(x) = x\) on \([-\pi, \pi]\)

Easy

Let \(f(x) = x\) on \((-\pi, \pi)\), extended periodically with period \(2\pi\).

  1. Compute the Fourier series of \(f\).
  2. To what value does the series converge at \(x = \pi\)? Explain using the Dirichlet convergence theorem.
Hint
Again, \(f(x) = x\) is an odd function on a symmetric interval, so \(a_0 = a_n = 0\). Use integration by parts to evaluate \(b_n = \frac{2}{\pi}\int_0^{\pi} x\sin(nx)\,dx\). At a jump discontinuity the series converges to the average of the left and right limits.
View Solution
Solution to part 1:

Since \(f\) is odd, only sine terms survive. Using integration by parts:

\[b_n = \frac{2}{\pi}\int_0^{\pi} x\sin(nx)\,dx = \frac{2}{\pi}\!\left[-\frac{x\cos(nx)}{n} + \frac{\sin(nx)}{n^2}\right]_0^{\pi} = \frac{2(-1)^{n+1}}{n}\]
\[f(x) \sim 2\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin(nx) = 2\!\left(\sin x – \frac{\sin 2x}{2} + \frac{\sin 3x}{3} – \cdots\right)\]
Solution to part 2:

At \(x = \pi\) the periodic extension has a jump discontinuity: \(f(\pi^-) = \pi\) and \(f(\pi^+) = -\pi\). By the Dirichlet theorem the series converges to

\[\frac{f(\pi^-) + f(\pi^+)}{2} = \frac{\pi + (-\pi)}{2} = 0\]
which is consistent because every \(\sin(n\pi) = 0\).

Problem 3: Fourier Series of \(f(x) = x^2\) on \([-\pi, \pi]\)

Easy

Let \(f(x) = x^2\) on \([-\pi, \pi]\), extended \(2\pi\)-periodically.

  1. Find the complete Fourier series of \(f\).
  2. Substitute an appropriate value of \(x\) to deduce the identity \(\displaystyle\sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi^2}{6}\).
Hint
\(f(x) = x^2\) is even, so \(b_n = 0\) for all \(n\). Compute \(a_0\) directly and use integration by parts twice for \(a_n\). Once you have the series, set \(x = \pi\) where the series converges to \(f(\pi) = \pi^2\).
View Solution
Solution to part 1:
\[a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi} x^2\,dx = \frac{2\pi^2}{3}\]
\[a_n = \frac{2}{\pi}\int_0^{\pi} x^2\cos(nx)\,dx = \frac{4(-1)^n}{n^2}\]
\[f(x) \sim \frac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\cos(nx)\]
Solution to part 2:

Since \(f\) is continuous everywhere on \([-\pi,\pi]\) and the periodic extension is continuous, the series converges to \(f(\pi) = \pi^2\) at \(x = \pi\):

\[\pi^2 = \frac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}(-1)^n = \frac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\frac{1}{n^2}\]
\[\Longrightarrow \quad \sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi^2}{6}\]

Problem 4: Fourier Series on a General Interval \([-L, L]\)

Medium

Let \(L = 2\) and define the \(4\)-periodic function

\[f(x) = \begin{cases} 0, & -2 \leq x < 0 \\ x, & 0 \leq x < 2 \end{cases}\]

  1. Compute the Fourier series of \(f\) on \([-2, 2]\).
  2. Determine the sum of the series at \(x = 0\) and at \(x = 2\).
Hint
For a period-\(2L\) function the formulas become \(a_n = \frac{1}{L}\int_{-L}^{L}f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx\) and similarly for \(b_n\). This function is neither even nor odd, so you must compute all three coefficients. Use the Dirichlet theorem at the discontinuity points \(x = 0\) and \(x = \pm 2\).
View Solution
Solution to part 1:
\[a_0 = \frac{1}{2}\int_{-2}^{2}f(x)\,dx = \frac{1}{2}\int_0^2 x\,dx = 1\]
\[a_n = \frac{1}{2}\int_0^2 x\cos\!\left(\frac{n\pi x}{2}\right)dx = \frac{2}{n^2\pi^2}\bigl((-1)^n – 1\bigr)\]
So \(a_n = -\dfrac{4}{n^2\pi^2}\) for odd \(n\), and \(a_n = 0\) for even \(n \geq 2\).
\[b_n = \frac{1}{2}\int_0^2 x\sin\!\left(\frac{n\pi x}{2}\right)dx = \frac{-2(-1)^n}{n\pi}\]
\[f(x) \sim \frac{1}{2} – \frac{4}{\pi^2}\sum_{k=0}^{\infty}\frac{\cos\!\left(\frac{(2k+1)\pi x}{2}\right)}{(2k+1)^2} + \sum_{n=1}^{\infty}\frac{-2(-1)^n}{n\pi}\sin\!\left(\frac{n\pi x}{2}\right)\]
Solution to part 2:

At \(x = 0\): the left limit (approaching from below in the periodic extension) gives \(f(0^-) = 0\) and \(f(0^+) = 0\), so the series converges to \(0\).

At \(x = 2\): the periodic extension has \(f(2^-) = 2\) and \(f(2^+) = 0\) (start of next period), so the series converges to \(\dfrac{2+0}{2} = 1\).

Even and Odd Functions: Symmetry and Half-Range Extensions

Recognising whether a function is even or odd — or constructing an even or odd periodic extension — can halve the computation. These problems practise the half-range cosine series and half-range sine series, a topic that appears frequently in heat and wave problems with specific boundary conditions.

Problem 5: Half-Range Sine Series of \(f(x) = x\) on \([0, \pi]\)

Easy

Given \(f(x) = x\) for \(0 < x < \pi\), construct its half-range sine series.

  1. Compute the sine coefficients \(b_n\) and write the series.
  2. Sketch the odd periodic extension of \(f\) over three periods and identify where the series converges to a value different from \(f(x)\).
Hint
For a half-range sine series on \([0, L]\) use \(b_n = \frac{2}{L}\int_0^L f(x)\sin\!\left(\frac{n\pi x}{L}\right)dx\). The odd extension maps \(f(x)\) to \(-f(-x)\) for \(-\pi < x < 0\), making it \(2\pi\)-periodic. The extension is discontinuous at the endpoints \(0, \pm\pi, \pm 2\pi, \ldots\)
View Solution
Solution to part 1:
\[b_n = \frac{2}{\pi}\int_0^{\pi} x\sin(nx)\,dx = \frac{2(-1)^{n+1}}{n}\]
\[f(x) \sim 2\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin(nx),\quad 0 < x < \pi\] Solution to part 2:

The odd periodic extension \(f_\text{odd}\) satisfies \(f_\text{odd}(-x) = -f_\text{odd}(x)\) and has period \(2\pi\). It has jump discontinuities at \(x = 0, \pm\pi, \pm 2\pi, \ldots\) where the one-sided limits are \(\pm\pi\). At each such point the series converges to \(0\) (the average of \(\pi\) and \(-\pi\)), while the original function values are \(0\) or \(\pi\).

Problem 6: Half-Range Cosine Series of \(f(x) = x^2\) on \([0, 1]\)

Easy

Consider \(f(x) = x^2\) on \([0, 1]\). Construct the half-range cosine series.

  1. Derive the coefficients \(a_0\) and \(a_n\) and state the series.
  2. Use the result at \(x = 0\) to find a closed-form expression for \(\displaystyle\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2\pi^2}\).
Hint
The half-range cosine series on \([0,L]\) uses \(a_0 = \frac{2}{L}\int_0^L f(x)\,dx\) and \(a_n = \frac{2}{L}\int_0^L f(x)\cos\!\left(\frac{n\pi x}{L}\right)dx\). After finding the series, substitute \(x = 0\) where \(f(0) = 0\), since the even extension is continuous there.
View Solution
Solution to part 1:
\[a_0 = 2\int_0^1 x^2\,dx = \frac{2}{3}, \qquad a_n = 2\int_0^1 x^2\cos(n\pi x)\,dx = \frac{4(-1)^n}{n^2\pi^2}\]
\[f(x) \sim \frac{1}{3} + \frac{4}{\pi^2}\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\cos(n\pi x), \quad 0 \leq x \leq 1\]
Solution to part 2:

At \(x = 0\) the even extension is continuous and equals \(f(0) = 0\):

\[0 = \frac{1}{3} + \frac{4}{\pi^2}\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2} \implies \sum_{n=1}^{\infty}\frac{(-1)^n}{n^2} = -\frac{\pi^2}{12}\]
\[\therefore \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2\pi^2} = \frac{1}{12}\]

Problem 7: Comparing Sine and Cosine Extensions of \(f(x) = \pi – x\)

Medium

Let \(f(x) = \pi – x\) on \([0, \pi]\).

  1. Find the half-range sine series of \(f\).
  2. Find the half-range cosine series of \(f\).
  3. At \(x = \pi/2\), determine the value each series converges to, and confirm it equals \(f(\pi/2)\).
Hint
Both \(f\) and its extensions are piecewise smooth. For the sine series, integrate by parts. For the cosine series, note that \(\pi – x\) is neither even nor odd but its even extension is a triangle wave. At \(x = \pi/2\) both extensions are continuous, so both series converge to \(f(\pi/2) = \pi/2\).
View Solution
Solution to part 1 (Sine series):
\[b_n = \frac{2}{\pi}\int_0^{\pi}(\pi – x)\sin(nx)\,dx = \frac{2}{n}\]
\[f(x) \sim 2\sum_{n=1}^{\infty}\frac{\sin(nx)}{n} = 2\!\left(\sin x + \frac{\sin 2x}{2} + \frac{\sin 3x}{3} + \cdots\right)\]
Solution to part 2 (Cosine series):
\[a_0 = \frac{2}{\pi}\int_0^{\pi}(\pi-x)\,dx = \pi,\qquad a_n = \frac{2}{\pi}\int_0^{\pi}(\pi-x)\cos(nx)\,dx = \frac{2}{n^2\pi}\bigl(1 – (-1)^n\bigr)\]
So \(a_n = \dfrac{4}{n^2\pi}\) for odd \(n\), and \(0\) for even \(n\).
\[f(x) \sim \frac{\pi}{2} + \frac{4}{\pi}\sum_{k=0}^{\infty}\frac{\cos\!\bigl((2k+1)x\bigr)}{(2k+1)^2}\]
Solution to part 3:

At \(x = \pi/2\) both extensions are continuous. Each series converges to \(f(\pi/2) = \pi – \pi/2 = \pi/2\). One may verify this for the cosine series by noting \(\cos\!\bigl((2k+1)\pi/2\bigr) = 0\) for all \(k\), leaving only the constant term \(\pi/2\). ✓

Parseval’s Identity and Norm Calculations

Parseval’s identity links the energy of a function to its Fourier coefficients, providing both a powerful computational shortcut and a way to derive classic infinite series identities. Mastering it is essential for signal processing and functional analysis.

Problem 8: Applying Parseval’s Identity to Derive \(\pi^4/90\)

Medium

Recall that the Fourier series of \(f(x) = x^2\) on \([-\pi,\pi]\) is

\[f(x) \sim \frac{\pi^2}{3} + 4\sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}\cos(nx)\]

  1. State Parseval’s identity for a \(2\pi\)-periodic function in terms of \(a_0\), \(a_n\), \(b_n\).
  2. Apply it to the Fourier series of \(f(x) = x^2\) to prove that \(\displaystyle\sum_{n=1}^{\infty}\frac{1}{n^4} = \frac{\pi^4}{90}\).
Hint
Parseval’s identity for period \(2\pi\) reads \(\frac{1}{\pi}\int_{-\pi}^{\pi}|f(x)|^2\,dx = \frac{a_0^2}{2} + \sum_{n=1}^{\infty}(a_n^2 + b_n^2)\). Compute the left-hand side directly, then substitute the known coefficients on the right.
View Solution
Solution to part 1:
\[\frac{1}{\pi}\int_{-\pi}^{\pi}|f(x)|^2\,dx = \frac{a_0^2}{2} + \sum_{n=1}^{\infty}\bigl(a_n^2 + b_n^2\bigr)\]
Solution to part 2:

For \(f(x) = x^2\): \(a_0 = \frac{2\pi^2}{3}\), \(a_n = \frac{4(-1)^n}{n^2}\), \(b_n = 0\).

\[\text{LHS} = \frac{1}{\pi}\int_{-\pi}^{\pi}x^4\,dx = \frac{2\pi^4}{5}\]
\[\text{RHS} = \frac{1}{2}\cdot\frac{4\pi^4}{9} + \sum_{n=1}^{\infty}\frac{16}{n^4} = \frac{2\pi^4}{9} + 16\sum_{n=1}^{\infty}\frac{1}{n^4}\]
Setting LHS = RHS:
\[\frac{2\pi^4}{5} = \frac{2\pi^4}{9} + 16\sum_{n=1}^{\infty}\frac{1}{n^4} \implies 16\sum_{n=1}^{\infty}\frac{1}{n^4} = \frac{2\pi^4}{5} – \frac{2\pi^4}{9} = \frac{8\pi^4}{45}\]
\[\therefore\quad \sum_{n=1}^{\infty}\frac{1}{n^4} = \frac{\pi^4}{90}\]

Problem 9: Parseval’s Identity for a Piecewise Function

Medium

Let \(f(x)\) be the \(2\pi\)-periodic function with \(f(x) = x\) on \((-\pi, \pi)\).

  1. Use the Fourier series from Problem 2 and Parseval’s identity to prove \(\displaystyle\sum_{n=1}^{\infty}\frac{1}{n^2} = \frac{\pi^2}{6}\) independently of Problem 3.
  2. Interpret Parseval’s identity physically: what does each side represent in terms of signal energy?
Hint
From Problem 2, \(b_n = \frac{2(-1)^{n+1}}{n}\) and all cosine coefficients are zero. Compute \(\frac{1}{\pi}\int_{-\pi}^{\pi}x^2\,dx\) on the left side of Parseval’s identity and match with the sum of squared coefficients on the right.
View Solution
Solution to part 1:
\[\frac{1}{\pi}\int_{-\pi}^{\pi}x^2\,dx = \frac{2\pi^2}{3}\]
\[\sum_{n=1}^{\infty} b_n^2 = \sum_{n=1}^{\infty}\frac{4}{n^2}\]
Parseval: \(\dfrac{2\pi^2}{3} = 4\displaystyle\sum_{n=1}^{\infty}\dfrac{1}{n^2} \implies \displaystyle\sum_{n=1}^{\infty}\dfrac{1}{n^2} = \dfrac{\pi^2}{6}\). ✓
Solution to part 2:

In signal processing, \(\frac{1}{2\pi}\int_{-\pi}^{\pi}|f(x)|^2\,dx\) is the total power (energy per period) of the signal. The right-hand side \(\frac{a_0^2}{2} + \sum(a_n^2 + b_n^2)\) is the sum of the powers carried by each harmonic component. Parseval’s identity states that total power equals the sum of powers of all harmonics — energy is conserved in the Fourier representation.

Fourier Series with Arbitrary Period and Piecewise Functions

Real-world signals rarely have period \(2\pi\). These problems develop skill in rescaling the Euler–Fourier formulas to a general period \(T = 2L\) and handling piecewise-defined functions with multiple integration sub-intervals — a common challenge in engineering applications.

Problem 10: Sawtooth Wave with Period 4

Medium

Define the \(4\)-periodic sawtooth wave by \(f(t) = t\) on \(-2 < t \leq 2\).

  1. Find the Fourier series of \(f\).
  2. Evaluate the series at \(t = 2\) and explain the result in terms of the Dirichlet theorem.
Hint
For a function with period \(2L = 4\), so \(L = 2\), the sine coefficients are \(b_n = \frac{1}{2}\int_{-2}^{2} t\sin\!\left(\frac{n\pi t}{2}\right)dt\). Since \(f\) is odd, no cosine terms appear. Use integration by parts.
View Solution
Solution to part 1:
\[b_n = \frac{1}{2}\int_{-2}^{2}t\sin\!\left(\frac{n\pi t}{2}\right)dt = \frac{4(-1)^{n+1}}{n\pi}\]
\[f(t) \sim \frac{4}{\pi}\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin\!\left(\frac{n\pi t}{2}\right)\]
Solution to part 2:

At \(t = 2\) the function has a jump: \(f(2^-) = 2\) and \(f(2^+) = -2\) (start of next period). By the Dirichlet theorem the series converges to \(\frac{2 + (-2)}{2} = 0\). Substituting \(t = 2\) confirms this since \(\sin(n\pi) = 0\) for all integers \(n\).

Problem 11: Fourier Series of the Rectified Sine Wave

Medium

The full-wave rectified sine is \(f(x) = |\sin x|\), which is periodic with period \(\pi\).

  1. Compute the Fourier series of \(f\) (with period \(\pi\), using harmonics of frequency \(2, 4, 6, \ldots\)).
  2. Verify that the series at \(x = \pi/2\) gives \(f(\pi/2) = 1\).
Hint
\(f(x) = |\sin x|\) is an even function with period \(\pi\). Use the half-range cosine series on \([0, \pi]\) with \(L = \pi/2\). The trigonometric identity \(2\sin x\sin(nx) = \cos((n-1)x) – \cos((n+1)x)\) simplifies the integral for \(a_n\).
View Solution
Solution to part 1:

Since period \(T = \pi\), the fundamental angular frequency is \(\omega_0 = 2\pi/T = 2\). All terms involve harmonics \(2, 4, 6, \ldots\)

\[a_0 = \frac{2}{\pi}\int_0^{\pi}\sin x\,dx = \frac{4}{\pi}\]
\[a_n = \frac{2}{\pi}\int_0^{\pi}\sin x\cos(2nx)\,dx = \frac{-4}{\pi(4n^2-1)}\]
\[f(x) \sim \frac{2}{\pi} – \frac{4}{\pi}\sum_{n=1}^{\infty}\frac{\cos(2nx)}{4n^2 – 1}\]
Solution to part 2:
\[\text{At } x = \tfrac{\pi}{2}: \quad \frac{2}{\pi} – \frac{4}{\pi}\sum_{n=1}^{\infty}\frac{\cos(n\pi)}{4n^2-1} = \frac{2}{\pi} – \frac{4}{\pi}\sum_{n=1}^{\infty}\frac{(-1)^n}{4n^2-1}\]
Using the known result \(\sum_{n=1}^{\infty}\frac{(-1)^n}{4n^2-1} = \frac{1-\pi/2}{2} \cdot \frac{2}{\pi}\), the sum evaluates to \(1 = f(\pi/2)\). ✓

Problem 12: Fourier Series of \(f(x) = e^x\) on \([-\pi, \pi]\)

Hard

Find the complete Fourier series of \(f(x) = e^x\) on \((-\pi, \pi)\), extended \(2\pi\)-periodically.

  1. Compute all coefficients \(a_0\), \(a_n\), and \(b_n\) in closed form.
  2. Use the series and Parseval’s identity to show that \(\displaystyle\sum_{n=-\infty}^{\infty}\frac{1}{1+n^2} = \pi\coth\pi\).
Hint
Use the formula \(\int e^x\cos(nx)\,dx = \frac{e^x(\cos(nx)+n\sin(nx))}{1+n^2}\) and its sine analogue. The factor \((-1)^n\) appears because \(e^{\pm i n\pi} = (-1)^n\). For Parseval, apply the identity with \(\int_{-\pi}^{\pi}e^{2x}\,dx\) on the left and the sum of squared coefficients on the right.
View Solution
Solution to part 1:
\[a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi}e^x\,dx = \frac{2\sinh\pi}{\pi}\]
\[a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}e^x\cos(nx)\,dx = \frac{2(-1)^n\sinh\pi}{\pi(1+n^2)}\]
\[b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}e^x\sin(nx)\,dx = \frac{-2n(-1)^n\sinh\pi}{\pi(1+n^2)}\]
\[e^x \sim \frac{\sinh\pi}{\pi}\!\left(1 + 2\sum_{n=1}^{\infty}\frac{(-1)^n}{1+n^2}\bigl(\cos(nx) – n\sin(nx)\bigr)\right)\]
Solution to part 2:

Apply Parseval: \(\frac{1}{\pi}\int_{-\pi}^{\pi}e^{2x}\,dx = \frac{a_0^2}{2} + \sum_{n=1}^{\infty}(a_n^2 + b_n^2)\).

\[\text{LHS} = \frac{e^{2\pi} – e^{-2\pi}}{2\pi} = \frac{\sinh(2\pi)}{\pi}\]
\[a_n^2 + b_n^2 = \frac{4\sinh^2\!\pi}{\pi^2}\cdot\frac{1+n^2}{(1+n^2)^2} = \frac{4\sinh^2\!\pi}{\pi^2(1+n^2)}\]
\[\text{RHS} = \frac{2\sinh^2\!\pi}{\pi^2} + \frac{4\sinh^2\!\pi}{\pi^2}\sum_{n=1}^{\infty}\frac{1}{1+n^2} = \frac{2\sinh^2\!\pi}{\pi^2}\!\left(1 + 2\sum_{n=1}^{\infty}\frac{1}{1+n^2}\right)\]
Setting equal and using \(\sinh(2\pi) = 2\sinh\pi\cosh\pi\):
\[\pi\coth\pi = 1 + 2\sum_{n=1}^{\infty}\frac{1}{1+n^2} = \sum_{n=-\infty}^{\infty}\frac{1}{1+n^2}\]

Complex Fourier Series and Exponential Form

The complex exponential form of the Fourier series — using coefficients \(c_n = \frac{1}{2L}\int_{-L}^{L}f(x)e^{-in\pi x/L}dx\) — is indispensable in signal processing, communication theory, and the study of the discrete Fourier transform. The problems here bridge the real and complex representations.

Problem 13: Complex Fourier Coefficients of a Rectangular Pulse

Medium

A \(2\pi\)-periodic rectangular pulse is defined by

\[f(x) = \begin{cases} 1, & |x| < \delta \\ 0, & \delta \leq |x| \leq \pi \end{cases}\] where \(0 < \delta < \pi\) is a fixed duty-cycle parameter.

  1. Compute the complex Fourier coefficients \(c_n\) for all integers \(n\).
  2. Show that the coefficients can be written using the sinc function: \(c_n = \frac{\delta}{\pi}\,\mathrm{sinc}(n\delta)\) where \(\mathrm{sinc}(u) = \frac{\sin u}{u}\).
Hint
The complex coefficients are \(c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)e^{-inx}dx\). Since \(f\) is zero outside \((-\delta, \delta)\), the integral reduces to \(\frac{1}{2\pi}\int_{-\delta}^{\delta}e^{-inx}dx\). For \(n = 0\) integrate directly; for \(n \neq 0\) use the anti-derivative of \(e^{-inx}\).
View Solution
Solution to part 1:

For \(n = 0\): \(c_0 = \frac{1}{2\pi}\int_{-\delta}^{\delta}dx = \frac{\delta}{\pi}\).

For \(n \neq 0\):

\[c_n = \frac{1}{2\pi}\int_{-\delta}^{\delta}e^{-inx}dx = \frac{1}{2\pi}\left[\frac{e^{-inx}}{-in}\right]_{-\delta}^{\delta} = \frac{e^{in\delta} – e^{-in\delta}}{2\pi\,in} = \frac{\sin(n\delta)}{n\pi}\]
Solution to part 2:
\[c_n = \frac{\sin(n\delta)}{n\pi} = \frac{\delta}{\pi}\cdot\frac{\sin(n\delta)}{n\delta} = \frac{\delta}{\pi}\,\mathrm{sinc}(n\delta)\]
This expression is also valid at \(n = 0\) since \(\lim_{u\to 0}\mathrm{sinc}(u) = 1\), giving \(c_0 = \delta/\pi\). The coefficients therefore form a sampled sinc envelope, which is the hallmark of a rectangular pulse spectrum in Fourier analysis.

Problem 14: Converting Between Real and Complex Forms

Hard

Consider the \(2\pi\)-periodic function whose real Fourier series is

\[f(x) = \frac{1}{2} + \sum_{n=1}^{\infty}\left(\frac{1}{n}\cos(nx) + \frac{2}{n^2}\sin(nx)\right)\]

  1. Find the complex Fourier coefficients \(c_n\) for all \(n \in \mathbb{Z}\) in terms of the given real coefficients.
  2. Verify that \(c_{-n} = \overline{c_n}\) (complex conjugate symmetry), which holds because \(f\) is real-valued.
Hint
Use the identities \(\cos(nx) = \frac{e^{inx}+e^{-inx}}{2}\) and \(\sin(nx) = \frac{e^{inx}-e^{-inx}}{2i}\). Group the \(e^{inx}\) and \(e^{-inx}\) terms separately to read off \(c_n\) and \(c_{-n}\). For part 2, compute \(\overline{c_n}\) directly.
View Solution
Solution to part 1:

The general conversion formulas are \(c_0 = \frac{a_0}{2}\), and for \(n \geq 1\):

\[c_n = \frac{a_n – ib_n}{2}, \qquad c_{-n} = \frac{a_n + ib_n}{2}\]
Here \(a_0 = 1\), \(a_n = 1/n\), \(b_n = 2/n^2\). Therefore:
\[c_0 = \frac{1}{2}, \qquad c_n = \frac{1}{2n} – \frac{i}{n^2}\quad (n \geq 1), \qquad c_{-n} = \frac{1}{2n} + \frac{i}{n^2}\quad (n \geq 1)\]
Solution to part 2:

Taking the complex conjugate of \(c_n\) for \(n \geq 1\):

\[\overline{c_n} = \overline{\frac{1}{2n} – \frac{i}{n^2}} = \frac{1}{2n} + \frac{i}{n^2} = c_{-n} \quad \checkmark\]
This conjugate symmetry \(c_{-n} = \overline{c_n}\) is a universal property of the complex Fourier coefficients of any real-valued function, since \(\overline{f(x)} = f(x)\) implies \(\overline{c_n} = c_{-n}\) directly from the coefficient formula.

Applications: Heat Equation and Wave Equation

Fourier series are the cornerstone of solving partial differential equations (PDEs) with periodic or bounded-domain initial conditions. These problems demonstrate the separation of variables technique for the one-dimensional heat equation and wave equation — problems that are central to mathematical physics and engineering.

Problem 15: Heat Equation with Zero Boundary Conditions

Medium

Solve the boundary-value problem for heat conduction in a rod of length \(\pi\):

\[u_t = u_{xx}, \quad 0 < x < \pi,\; t > 0\]
\[u(0,t) = 0,\quad u(\pi, t) = 0, \quad t > 0\]
\[u(x, 0) = \sin(2x) – \tfrac{1}{2}\sin(5x), \quad 0 < x < \pi\]

  1. Use separation of variables to derive the general solution as a Fourier sine series.
  2. Apply the initial condition to find the explicit solution.
Hint
Assume \(u(x,t) = X(x)T(t)\). The boundary conditions \(u(0,t) = u(\pi,t) = 0\) force \(X(0) = X(\pi) = 0\), yielding eigenfunctions \(X_n(x) = \sin(nx)\) with eigenvalues \(\lambda_n = n^2\). The time factor then satisfies \(T_n’ = -n^2 T_n\). The initial condition in this problem is already expressed as a finite sine series, so matching coefficients directly is straightforward.
View Solution
Solution to part 1 (general solution):

Substituting \(u = X(x)T(t)\) gives \(X^{\prime\prime} + \lambda X = 0\) with \(X(0)=X(\pi)=0\), yielding:

\[X_n(x) = \sin(nx),\quad \lambda_n = n^2,\quad T_n(t) = e^{-n^2 t}\]
\[u(x,t) = \sum_{n=1}^{\infty} B_n e^{-n^2 t}\sin(nx)\]
Solution to part 2:

At \(t = 0\): \(u(x,0) = \sum_{n=1}^{\infty}B_n\sin(nx) = \sin(2x) – \frac{1}{2}\sin(5x)\).

By orthogonality, \(B_2 = 1\), \(B_5 = -\frac{1}{2}\), and all other \(B_n = 0\). Therefore:

\[u(x,t) = e^{-4t}\sin(2x) – \tfrac{1}{2}e^{-25t}\sin(5x)\]

As \(t \to \infty\), the higher-frequency term decays faster (factor \(e^{-25t}\) vs. \(e^{-4t}\)), leaving the rod temperature exponentially approaching zero, consistent with the zero boundary conditions.

Problem 16: Heat Equation with General Initial Condition

Hard

Solve the heat equation on \([0, L]\) with homogeneous Dirichlet conditions:

\[u_t = k\,u_{xx},\quad u(0,t) = u(L,t) = 0,\quad u(x,0) = f(x)\]
where \(k > 0\) is the thermal diffusivity and \(f(x) = x(\pi – x)\) with \(L = \pi\), \(k = 1\).

  1. Expand \(f(x)\) in a Fourier sine series on \([0, \pi]\).
  2. Write the complete solution \(u(x,t)\).
  3. Show that the maximum temperature, which occurs at the midpoint \(x = \pi/2\), decays exponentially as \(t \to \infty\), and identify the dominant decay rate.
Hint
The Fourier sine coefficients of \(x(\pi-x)\) are \(B_n = \frac{2}{\pi}\int_0^{\pi}x(\pi-x)\sin(nx)\,dx\). Use integration by parts twice. You will find \(B_n = 0\) for even \(n\), and \(B_n = \frac{8}{\pi n^3}\) for odd \(n\). The dominant (slowest-decaying) mode is \(n=1\) with rate \(e^{-t}\).
View Solution
Solution to part 1 (Fourier sine coefficients):
\[B_n = \frac{2}{\pi}\int_0^{\pi}x(\pi – x)\sin(nx)\,dx\]
Integrating by parts twice:
\[B_n = \frac{2}{\pi}\cdot\frac{2\bigl(1-(-1)^n\bigr)}{n^3} \cdot \pi = \frac{4(1-(-1)^n)}{n^3\pi}\cdot\pi\]
More precisely: \(B_n = \dfrac{8}{\pi n^3}\) for odd \(n\), and \(B_n = 0\) for even \(n\).
Solution to part 2:
\[u(x,t) = \frac{8}{\pi}\sum_{k=0}^{\infty}\frac{e^{-(2k+1)^2 t}\sin\!\bigl((2k+1)x\bigr)}{(2k+1)^3}\]
Solution to part 3:

At \(x = \pi/2\), \(\sin\!\bigl((2k+1)\pi/2\bigr) = (-1)^k\). As \(t \to \infty\) the \(k = 0\) term dominates:

\[u\!\left(\frac{\pi}{2}, t\right) \approx \frac{8}{\pi}e^{-t}\sin\!\left(\frac{\pi}{2}\right) = \frac{8}{\pi}e^{-t}\]
The dominant decay rate is \(e^{-t}\) (eigenvalue \(\lambda_1 = 1^2 = 1\)). Higher modes decay at rates \(e^{-9t}, e^{-25t}, \ldots\), becoming negligible quickly.

Problem 17: Vibrating String — Wave Equation

Hard

A string of length \(L = \pi\) is fixed at both ends. It satisfies the wave equation

\[u_{tt} = c^2 u_{xx},\quad u(0,t) = u(\pi, t) = 0\]
with initial conditions \(u(x,0) = \sin x + \frac{1}{3}\sin(3x)\) and \(u_t(x,0) = 0\).

  1. Write the general d’Alembert/eigenfunction solution for this boundary-value problem.
  2. Apply both initial conditions to find the specific solution for \(c = 1\).
  3. Identify the fundamental frequency and the frequency of the second harmonic present in the solution.
Hint
Separation of variables gives \(u(x,t) = \sum_{n=1}^{\infty}\sin(nx)\bigl(A_n\cos(cnt) + B_n\sin(cnt)\bigr)\). The condition \(u_t(x,0) = 0\) forces all \(B_n = 0\). The condition \(u(x,0) = \sin x + \frac{1}{3}\sin(3x)\) is already a finite sine series, so matching gives \(A_1, A_3\) immediately.
View Solution
Solution to part 1:
\[u(x,t) = \sum_{n=1}^{\infty}\sin(nx)\bigl(A_n\cos(cnt) + B_n\sin(cnt)\bigr)\]
Solution to part 2 (\(c = 1\)):

From \(u_t(x,0) = 0\): \(B_n = 0\) for all \(n\). From \(u(x,0)\): \(A_1 = 1\), \(A_3 = \frac{1}{3}\), all other \(A_n = 0\). Thus:

\[u(x,t) = \sin x\cos t + \frac{1}{3}\sin(3x)\cos(3t)\]
Solution to part 3:

The fundamental frequency corresponds to \(n = 1\): angular frequency \(\omega_1 = c\cdot 1 = 1\,\text{rad/s}\), frequency \(f_1 = \frac{1}{2\pi}\,\text{Hz}\). The second harmonic present (note: \(n=2\) has zero coefficient so the next mode is \(n=3\)) has angular frequency \(\omega_3 = 3\,\text{rad/s}\), which is the third harmonic. The amplitude ratio of the two modes is \(3\!:\!1\).

Convergence, Dirichlet Conditions, and the Gibbs Phenomenon

Understanding where and how fast a Fourier series converges is as important as computing it. This section addresses the Dirichlet convergence theorem, the behaviour of partial sums near jump discontinuities (Gibbs phenomenon), and the distinction between pointwise, uniform, and mean-square convergence.

Problem 18: Identifying Convergence Behaviour at Discontinuities

Medium

Define the \(2\pi\)-periodic function

\[f(x) = \begin{cases} 0, & -\pi < x < 0 \\ x, & 0 \leq x < \pi \end{cases}\]

  1. Compute the Fourier series of \(f\).
  2. Determine the value of the series at \(x = 0\) and at \(x = \pi\), justifying each answer via the Dirichlet theorem.
  3. Use the value at \(x = \pi/2\) to derive the Leibniz formula \(\frac{\pi}{4} = 1 – \frac{1}{3} + \frac{1}{5} – \frac{1}{7} + \cdots\)
Hint
Compute \(a_0\), \(a_n\), and \(b_n\) using standard integrals. At \(x = 0\) the function has a jump from \(0^- \to 0\) in the periodic extension; check both one-sided limits carefully. At \(x = \pi/2\) the series converges to \(f(\pi/2) = \pi/2\); substituting and isolating the odd-indexed cosine sum gives the Leibniz formula.
View Solution
Solution to part 1:
\[a_0 = \frac{1}{\pi}\int_0^{\pi}x\,dx = \frac{\pi}{2}\]
\[a_n = \frac{1}{\pi}\int_0^{\pi}x\cos(nx)\,dx = \frac{(-1)^n – 1}{n^2\pi}\]
\[b_n = \frac{1}{\pi}\int_0^{\pi}x\sin(nx)\,dx = \frac{(-1)^{n+1}}{n}\]
\[f(x) \sim \frac{\pi}{4} – \frac{2}{\pi}\sum_{k=0}^{\infty}\frac{\cos\!\bigl((2k+1)x\bigr)}{(2k+1)^2} + \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin(nx)\]
Solution to part 2:

At \(x = 0\): in the periodic extension, \(f(0^-) = 0\) (end of preceding period where \(f \to 0\)) and \(f(0^+) = 0\). Both limits are \(0\), so the series converges to \(\dfrac{0+0}{2} = 0\). (The constant term alone is \(\pi/4 \neq 0\), but the alternating cosine sum cancels it at \(x=0\).)

At \(x = \pi\): \(f(\pi^-) = \pi\) and \(f(\pi^+) = 0\) (next period starts). Series converges to \(\dfrac{\pi + 0}{2} = \dfrac{\pi}{2}\).

Solution to part 3:

At \(x = \pi/2\), the series converges to \(f(\pi/2) = \pi/2\):

\[\frac{\pi}{2} = \frac{\pi}{4} – \frac{2}{\pi}\sum_{k=0}^{\infty}\frac{\cos\!\bigl((2k+1)\pi/2\bigr)}{(2k+1)^2} + \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}\sin\!\left(\frac{n\pi}{2}\right)\]
Since \(\cos\!\bigl((2k+1)\pi/2\bigr) = 0\) for all \(k\), only the sine sum survives. The non-zero terms occur at odd \(n = 2k+1\):
\[\frac{\pi}{2} = \frac{\pi}{4} + \sum_{k=0}^{\infty}\frac{(-1)^k}{2k+1} \implies \frac{\pi}{4} = \sum_{k=0}^{\infty}\frac{(-1)^k}{2k+1} = 1 – \frac{1}{3} + \frac{1}{5} – \cdots \quad\checkmark\]

Problem 19: The Gibbs Phenomenon — Quantifying the Overshoot

Hard

Consider the \(N\)-th partial sum \(S_N(x)\) of the Fourier series of the square wave \(f(x)\) from Problem 1.

  1. Write \(S_N(x)\) explicitly as a finite sum of sine terms.
  2. Show that the maximum of \(S_N(x)\) near \(x = 0^+\) occurs approximately at \(x^* = \pi/(N+1)\) for large \(N\).
  3. Demonstrate that as \(N \to \infty\), the overshoot of the partial sum above the function value \(f(0^+) = 1\) does not vanish but instead approaches the Gibbs constant \(\approx 8.9\%\).
Hint
Differentiate \(S_N(x) = \frac{4}{\pi}\sum_{k=0}^{N}\frac{\sin((2k+1)x)}{2k+1}\) and set the derivative to zero. Use the product-to-sum identity for the sum of cosines. The maximum value involves the integral \(\frac{2}{\pi}\int_0^{\pi}\frac{\sin u}{u}\,du \approx 1.1789\), giving an overshoot of approximately \(17.9\%\) of the jump height.
View Solution
Solution to part 1:
\[S_N(x) = \frac{4}{\pi}\sum_{k=0}^{N}\frac{\sin\!\bigl((2k+1)x\bigr)}{2k+1} = \frac{4}{\pi}\!\left(\sin x + \frac{\sin 3x}{3} + \cdots + \frac{\sin((2N+1)x)}{2N+1}\right)\]
Solution to part 2:

Differentiating and using the closed form \(S_N'(x) = \frac{4}{\pi}\cdot\frac{\sin((2N+2)x)}{2\sin x}\) (derived via telescoping product), setting \(S_N'(x^*) = 0\) gives \(\sin((2N+2)x^*) = 0\), so \(x^* = \frac{\pi}{2N+2} = \frac{\pi}{2(N+1)}\). This is the first positive maximum of \(S_N\).

Solution to part 3:

Substituting \(x^* \approx \frac{\pi}{2N+2}\) into \(S_N\) and taking the Riemann sum limit as \(N \to \infty\):

\[\lim_{N\to\infty} S_N(x^*) = \frac{2}{\pi}\int_0^{\pi}\frac{\sin u}{u}\,du \approx \frac{2}{\pi}\cdot 1.8519 \approx 1.1789\]
The function value at the jump is \(f(0^+) = 1\), so the overshoot is \(1.1789 – 1 \approx 0.179\). As a fraction of the jump size (which is \(2\)), the relative overshoot is \(\approx 8.9\%\). This is the Gibbs constant: the partial sums of any Fourier series always overshoot by approximately \(9\%\) of the total jump at a discontinuity, regardless of how many terms are taken.