02 Separation of variables

Solving the heat equation

A theorem from ODEs

Theorem (General solutions to a special ODE).

Let \(f\) be a function with continuous first and second derivatives. Consider the differential equation \[ f'' + af' + bf = 0, \] where \(a\) and \(b\) are constants. If \(r_1\) and \(r_2\) are the roots of the characteristic equation \[ r^2 + ar + b = 0, \]

then the general solution to the ODE is

\[ f( x ) = C_1 e^{r_1 x} + C_2 e^{r_2 x}, \]

where \(C_1\) and \(C_2\) are arbitrary constants determined by the initial and boundary conditions.

  • This ODE is called homogeneous because it has no terms that are functions of \(x\) alone, i.e., the right-hand side is zero.

  • This ODE is called linear because the differential operator on the left, \[ L(f) = f'' + af' + bf, \] preserves linear combinations, i.e., we have \(L(f+g)= L(f) + L(g)\) and \(L(cf) = cL(f)\), for all functions \(f\) and \(g\) and any scalar \(c\).

  • This ODE is called second-order because the highest derivative that appears is the second derivative, \(f''\).

  • This ODE is called constant-coefficient because the coefficients \(a\) and \(b\) are constants, not functions of \(x\).

Complex roots to the characteristic equation

  • The roots \(r_1\) and \(r_2\) might be complex! In this case, they are conjugates of each other: \[ r_1 = \alpha + i\beta, \quad r_2 = \alpha - i\beta \] Thus:

Convenient expression for the general solutions

The general solution can be written as \[ f(x) = e^{\alpha x} \left( C_1 \sin(\beta x) + C_2 \cos(\beta x) \right), \] where \(C_1\) and \(C_2\) are arbitrary constants.

Separation of variables, part 1

  • Recall that the heat equation is \(\displaystyle\frac{\partial u}{\partial t} = k \frac{\partial^2 u}{\partial x^2}\) where \(k\) is a positive (known) constant.

  • We assume the boundary conditions \[ u(0,t) = 0, \quad u(L,t) = 0, \quad t > 0, \] where \(L\) is some positive (known) constant.

  • We ignore initial conditions for the moment.

The “separation of variables” strategy

  • We look for solutions of the form \[ u(x,t) = X(x)T(t), \] where \(X\) is a function of \(x\) alone and \(T\) is a function of \(t\) alone.
  • Substituting \(u(x,t) = X(x)T(t)\) into the heat equation gives \[ X(x) T'(t) = k T(t) X''(x), \] along with \[ X(0) = 0, \quad X(L) = 0. \]

Separation of variables, part 2

  • Dividing both sides of the equation by \(k X(x) T(t)\) gives \[ \frac{T'(t)}{k T(t)} = \frac{X''(x)}{X(x)}. \]

  • Notice that the left-hand side depends only on \(t\) and the right-hand side depends only on \(x\). Therefore, both sides must be equal to a constant, which we denote by \(-\lambda\): \[ \frac{T'(t)}{k T(t)} = \frac{X''(x)}{X(x)} = -\lambda. \]

  • This leads to a system of two ODEs: \[ T'(t) = - k \lambda T(t) \tag{1} \] and \[ X''(x) + \lambda X(x) = 0, \quad X(0) = 0, \quad X(L) = 0, \tag{2} \]

  • The general solution to (1) is \[ T(t) = C_0 \exp\left(-k \lambda t\right), \] where \(C_0\) is an arbitrary constant.

  • Based on our knowledge of ODEs (from the first slide), the general solution to (2) is \[ X(x) = C_1 \sin(\sqrt{\lambda} x) + C_2 \cos(\sqrt{\lambda} x), \] where \(C_1\) and \(C_2\) are arbitrary constants.

Separation of variables, part 3

  • But now the boundary condition \(X(0)=0\) forces \(C_2 = 0\), so \[ X(x) = C_1 \sin(\sqrt{\lambda} x). \]

  • The boundary condition \(X(L)=0\) then gives \[ C_1 \sin(\sqrt{\lambda} L) = 0. \]

  • Since \(C_1 \neq 0\) (otherwise the solution is trivial), we must have \[ \sin(\sqrt{\lambda} L) = 0, \] which implies \[ \sqrt{\lambda} L = n \pi, \quad n = 0, \pm 1, \pm 2, \pm3, \dots \]

  • Thus, \[ \lambda = \left( \frac{n \pi}{L} \right)^2. \]

  • Therefore, for each \(n=1,2,3,\dots\), we have a solution \[ X_n(x) = \sin\left( \frac{n \pi x}{L} \right) \] to (2). (We ignore the negative values of \(n\)—why?)

“Basic solutions” to the heat equation

  • If we remember that \(u(x,t) = X(x)T(t)\), then for each \(n=1,2,3,\dots\), we have a “basic solution” to the heat equation:

Basic solutions to the heat equation (w/zero temperature at the boundaries)

Consider the heat equation \[ \frac{\partial u}{\partial t} = k \frac{\partial^2 u}{\partial x^2} \] with boundary conditions \(u(0,t) = 0\) and \(u(L,t) = 0\) for all \(t>0\). Then for each \(n=1,2,3,\dots\), the function \[ u_n(x,t) = \exp\left(\frac{-n^2 \pi^2 kt}{L^2} \right) \sin\left( \frac{n \pi x}{L} \right), \quad 0 \leq x \leq L, \ t\geq 0 \] is a solution to the boundary-value problem above.

More complex solutions: Superposition principle

  • How might we build up more “complex” solutions using the basic equations to the heat equation?

Theorem (Superposition principle for the heat equation).

If \(u_1(x,t), u_2(x,t), \dots, u_n(x,t)\) are solutions to the heat equation, then any linear combination \[ u(x,t) = a_1 u_1(x,t) + a_2 u_2(x,t) + \dots + a_n u_n(x,t) \] is also a solution, where \(a_1, a_2, \dots, a_n\) are constants.

  • Thought: If linear combinations of finitely many solutions are also solutions, what about infinite sums?

  • If \(u_1(x,t), u_2(x,t), \dots\) are solutions to the heat equation, then perhaps the infinite sum \[ u(x,t) = \sum_{n=1}^{\infty} a_n u_n(x,t) \] is also a solution, where \(a_n\) are constants.

  • In particular, if we take the basic solutions \[ u_n(x,t) = \exp\left(\frac{-n^2 \pi^2 kt}{L^2} \right) \sin\left( \frac{n \pi x}{L} \right), \] to the heat equation, then is the infinite sum \[ u(x,t) = \sum_{n=1}^{\infty} a_n \exp\left(\frac{-n^2 \pi^2 kt}{L^2} \right) \sin\left( \frac{n \pi x}{L} \right) \] also a solution? (Even more pressing—what about convergence of the series?)

Bringing in the initial condition

  • If we now bring in an initial condition specifying that \[ u(x,0) = f(x), \quad 0 \leq x \leq L, \] for some initial temperature distribution \(f(x)\), then our “infinite superposition” solution must satisfy \[ f(x) = \sum_{n=1}^{\infty} a_n \sin\left( \frac{n \pi x}{L} \right), \quad 0 \leq x \leq L. \]

  • But for what functions \(f(x)\) does this series converge? What are the \(a_n\)’s?

Conclusion: Open questions

Quetions raised by separation of variables

  • Assuming it converges, is an infinite linear combination of solutions to the heat equation also a solution?

  • For what types of functions \(f(x)\) can we write \[ f(x) = \sum_{n=1}^{\infty} a_n \sin\left( nx \right), \quad (0 \leq x \leq \pi)? \] (This is just a “rescaled” version of the series on the previous slide.)

    • When does it converge? What type of convergence?
    • How do we determine the coefficients \(a_n\)?