# Solution of the heat equation: separation of variables

To illustrate the method we consider the heat equation
 (2.48)

with the boundary conditions
 (2.49)

for all time and the initial condition, at , is
 (2.50)

where is a given function of . The temperature, , is assumed seperable in and and we write
 (2.51)

so that (2.48) becomes
 (2.52)

or, on dividing by ,
 (2.53)

where is the separation constant. In fact, we expect to be negative as can be seen from the time equation. Here we have

with solution

Thus, will increase in time if is positive and decrease in time only if is negative. It is obviously unphysical for the temperature to increase in time without any additional heating mechanism and so we must assume that is negative. To force this we set
 (2.54)

The spatial equation is then
 (2.55)

which is the simple harmonic motion equation with trigonometric solutions. Thus, the solution to (2.55) is
 (2.56)

Now, applying the boundary conditions (2.49), we find that

so that, in (2.56), and
 (2.57)

As for the wave equation, we take the most general solution by adding together all the possible solutions, satisfying the boundary conditions, to obtain
 (2.58)

The final step is to apply the initial conditions, namely
 (2.59)

Again we must invert the Fourier series and we do this by multiplying the equation by and integrating between and . Thus, we obtain,
 (2.60)

for all positive integers, .

Note that because every term in the solution for has a negative exponential in it, the temperature must decrease in time and the final solution will tend to

This is different from the wave equation where the oscillations simply continued for all time. This trivial solution, , is a consequence of the particular boundary conditions chosen here.

Example 2. .28Solve

subject to the boudary conditions

and the initial condition

The solution is given by (2.58) with, from (2.60),
 (2.61)

Integration by parts yields, for even ,

and

for odd .

For problems involving heat flow there is no reason why the temperature should have the same value at each end of the rod. The next few examples will show the effect of different boundary conditions.

Example 2. .29Solve

subject to the boudary conditions

and the initial condition

In this example and are not equal. To proceed we consider the final steady state after a long period of time. Eventually we expect all temperature variations to be smoothed out in time to leave a solution that is independent of time. This solution satisfies the equation

and has solution

where the constants and are chosen to satisfy the boundary conditions in . Thus,

However, this does not satisfy the initial condition. Thus, we add on a solution, , that satisfies the heat equation and the boundary conditions

Thus, the solution

satisfies the heat equation and the boundary conditions for the full problem. From (2.58) we have

The initial condition on can be written as

Thus, we have

Hence, from (2.60) we have

Thus,

Example 2. .30Solve

subject to

Thus,

and

Integration by parts gives

Hence,

Hence, the solution is

Instead of specifying the value of the temperature at the ends of the rod we could fix instead. This corresponds to fixing the heat flux that enters or leaves the system. For example, if , then no heat enters the system and the ends are said to be insulated. The following example illustrates the case when one end is insulated and the other has a fixed temperature.

Example 2. .31Solve the heat equation subject to the boundary conditions

and the initial condition

In this case the steady state solution must satisfy the boundary conditions and is simply

Again we look for a seperable solution of the form

and the solution reduces to

Applying the boundary condition at gives

and the condition at gives

so that, in this case must be an odd integer times . Thus,

Hence, the solution is

Finally, the initial condition is given by inverting the Fourier series at . Thus,

Again multiply by and integrate between and to get