For a function defined on [0, L], reflect across the y-axis for an even extension (yielding a cosine series) or through the origin for an odd extension (yielding a sine series). Choosing the appropriate extension simplifies calculations by exploiting symmetry and selecting series representations suited to boundary conditions. This is essential for solving PDEs with specific boundary constraints.
You know from your study of even and odd functions that an even function satisfies f(−x) = f(x) — it is symmetric about the y-axis — while an odd function satisfies f(−x) = −f(x) — it is symmetric through the origin. You also know from convergence of Fourier series that a periodic function on [−L, L] has a full Fourier series with both sine and cosine terms. The key insight for extensions is that these two types of symmetry correspond exactly to two special types of Fourier series: a purely cosine series (no sine terms) for even functions, and a purely sine series (no cosine terms) for odd functions.
The problem setup you will encounter in PDEs is: you have a function f defined only on the half-interval [0, L]. You need a Fourier series, but Fourier series require a function on a full symmetric interval [−L, L]. So you extend f to [−L, L] by choice. The even extension reflects f across the y-axis: define f_e(x) = f(x) for x ∈ [0, L] and f_e(x) = f(−x) for x ∈ [−L, 0). The result is an even function, and its Fourier series contains only cosine terms: f_e(x) = a₀/2 + Σ aₙcos(nπx/L). The odd extension instead reflects through the origin: f_o(x) = f(x) for x ∈ [0, L] and f_o(x) = −f(−x) for x ∈ [−L, 0). Its Fourier series contains only sine terms: f_o(x) = Σ bₙsin(nπx/L).
Why choose one over the other? The answer comes from the boundary conditions of the PDE you are trying to solve. When solving the heat equation on a rod from 0 to L, the condition u(0,t) = 0 and u(L,t) = 0 (zero temperature at both ends) requires solutions that vanish at the boundaries — sine functions. Sine is zero at 0 and at integer multiples of π, so you want the sine series, which means using the odd extension. Conversely, if the boundary conditions involve the derivative being zero at the endpoints (insulated ends), you want the cosine series and the even extension. The extension is not arbitrary — it must match the physics.
The computational payoff is significant. Instead of computing all 2n+1 Fourier coefficients (a₀, a₁, ..., aₙ, b₁, ..., bₙ), you only compute n+1 cosine coefficients (for the even extension) or n sine coefficients (for the odd extension). The symmetry halves the work. More importantly, the resulting series only contains functions that satisfy the boundary conditions by construction, so when you substitute back into the PDE, the boundary condition terms vanish automatically. This is the technique that makes separation of variables tractable for physical boundary value problems.