JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Fourier Sine and Cosine Series

Separation handed us a basis of sine or cosine modes; now we ask what they can build. A Fourier sine or cosine series rewrites any reasonable shape on an interval as a sum of those modes — and which one you reach for is decided entirely by the boundary conditions.

Why we even need a series

The previous guide ran separation of variables and ended with a cliffhanger. Substituting the product ansatz u(x,t) = X(x)T(t) split the PDE into a space eigenvalue problem and a time ODE, tied together by the separation constant. The boundary conditions then sieved the allowed shapes down to a discrete family — for ice-bath ends, the sine modes sin(n pi x / L). But a single mode almost never matches the messy initial profile f(x) you are actually handed. So the natural question becomes: can an arbitrary shape on the interval be written as a sum of these modes?

Astonishingly, yes — and that affirmative answer is the whole point of a Fourier series. The claim is that almost any function f(x) on [0, L] can be reproduced by adding up sine waves (or, in a sibling version, cosine waves) with carefully chosen amplitudes. The superposition principle guarantees that once f is written this way, multiplying each mode by its own time factor and re-summing gives a genuine solution of the PDE. This is the bridge from the building blocks to the real answer; building it is the work of this guide and the next two.

The sine series: pinned ends

Start with the case you already met. When both ends are held at zero — homogeneous Dirichlet conditions u(0) = u(L) = 0 — the eigenvalue problem forces the cosine piece to die and leaves only the sines. So we expand f as a Fourier sine series: f(x) = b_1 sin(pi x / L) + b_2 sin(2 pi x / L) + b_3 sin(3 pi x / L) + ... . Every term vanishes at x = 0 and x = L automatically, because every sine in the list is itself zero there. The series can only ever represent functions that vanish at both ends — which is exactly the family the boundary conditions allow.

Picture the modes themselves. The first, sin(pi x / L), is a single smooth hump rising from zero and returning to zero — half a wavelength stretched across the rod. The second, sin(2 pi x / L), goes up, crosses zero in the middle, and dips down — a full wave. The n-th mode has n humps and n - 1 interior zero-crossings. Adding them with amplitudes b_n is like adjusting an array of sliders on a graphic equalizer: the low n set the broad silhouette, the high n carve in the fine, wrinkly detail. With enough sliders you can sculpt nearly any curve that starts and ends at the floor.

The cosine series: insulated ends

Now change the physics at the ends. Insulate them instead of icing them: no heat flows across, so the slope of the temperature vanishes there. These are homogeneous Neumann conditions, u_x(0) = u_x(L) = 0. Re-run separation with these conditions and the eigenvalue problem keeps the cosines and kills the sines — because cosine is the function whose derivative is zero at the endpoints. The shapes become cos(n pi x / L), and the expansion is a Fourier cosine series: f(x) = a_0/2 + a_1 cos(pi x / L) + a_2 cos(2 pi x / L) + ... .

Two features of the cosine series deserve a second look. First, it carries an extra term the sine series lacked: the constant a_0/2, which is the n = 0 mode cos(0) = 1. That lone constant is the average of f over the interval, and it never decays in the heat problem — insulated ends trap the total heat, so the rod settles to its mean temperature rather than to zero. Second, because cosines have nonzero slope only away from the ends, the series naturally represents shapes that arrive flat at both walls, which is precisely what a no-flux boundary demands.

boundary at the two ends      ->  which modes survive  ->  series

  u = 0          (Dirichlet)   ->  sin(n pi x / L)      ->  sine series
  u_x = 0        (Neumann)     ->  cos(n pi x / L)      ->  cosine series
  u, u_x periodic              ->  sin & cos together   ->  full Fourier series
The boundary conditions, not personal taste, decide which family of modes you expand in.

One secret picture: extending the function

Why does the boundary choose sine versus cosine so cleanly? There is a single picture that explains both at once. The sines are all odd functions about x = 0; the cosines are all even. So a sine series secretly treats f as if it were extended to the negative side as an odd reflection, and a cosine series extends it as an even reflection. These are the even and odd extensions, and they are the hidden machinery underneath the two series.

Follow the odd extension to the end of its logic. Reflect f oddly across x = 0 to fill [-L, 0], then tile that whole [-L, L] block repeatedly along the axis — a periodic extension of period 2L. An odd reflection forces the function to pass through zero at x = 0 and (by the tiling) at x = L, which is exactly the Dirichlet condition appearing for free. The even reflection instead arrives flat — zero slope — at those same points, handing you the Neumann condition for free. The boundary you imposed is nothing more than the symmetry of the extension you chose.

Reading off the amplitudes

We have promised a series but not yet said how to find the amplitudes b_n or a_n. The trick — developed in full in the very next guide — is orthogonality: distinct sine modes, integrated against each other over [0, L], cancel to zero, and so do distinct cosine modes. That means you can isolate one amplitude at a time. Multiply the series for f by a chosen mode, integrate over the interval, and every term collapses except the matching one, leaving a clean formula for that single coefficient.

  1. Read the boundary. Zero value at the ends means sines (a sine series); zero slope means cosines (a cosine series).
  2. Write the expansion. Sum the matching modes with unknown amplitudes — b_n sin(n pi x / L), or a_0/2 plus a_n cos(n pi x / L).
  3. Project out each amplitude. Using orthogonality, b_n = (2/L) integral over [0,L] of f(x) sin(n pi x / L) dx, and similarly for a_n with cosine.
  4. Reassemble. Attach each mode's time factor and re-sum to get u(x,t) — the act of matching the initial condition.

Two honest cautions before you trust the series blindly. First, equality of f with its series is not pointwise everywhere for free: at a jump the series converges to the midpoint of the gap, not to either side, and the overshoot near the jump never fully shrinks. Second, sine and cosine are not the end of the story — they are the eigenfunctions of one especially simple geometry. On a disk or a sphere the same logic produces Bessel functions or Sturm-Liouville eigenfunctions instead, and the last guide of this rung shows that wider world. The sine and cosine series are the cleanest instance of a far more general idea.