# Textbook Example Solving Heat Conduction PDE Using Separation of Variables

My textbook demonstrates solving the heat conduction example

$$\dfrac{\partial{\phi}}{\partial{t}} = \kappa \dfrac{\partial^2{\phi}}{\partial{x^2}}, \ x \in [0, L]$$

$$\phi(x, 0) = f(x) \ \ \ \text{at time} \ \ t = 0$$

$$\phi(0, t) = \phi(L, t) = 0 \ \ \text{for all time.}$$

It proceeds by using separation of variables, as follows (paraphrased in my own words for the sake of conciseness, and with some minor additions for the sake of completeness):

We let

$$\phi(x, t) = T(t)X(x)$$

Therefore, the heat conduction equation becomes

$$T'X = \kappa T X''$$

Dividing by $XT$, we obtain

$$\dfrac{T'}{T} = \kappa \dfrac{X''}{X}$$

The left-hand side is a function of $t$ only, and the right-hand side is a function of $x$ only. As $t$ and $x$ are independent variables, these must be equal to the same constant. As the equation describes heat conduction, we should look for solutions that will decay as time progresses. This means that $T$ is likely to decrease with time, which in turn leads us to designate the separation constant as negative:

$$\dfrac{T'}{T} = - \alpha^2$$

Using separation of variables (the ODE kind), we get

$$T(t) = T_0 e^{-\alpha^2 t}, t \ge 0$$

For the ODE in terms of $x$, we get

$$\dfrac{X''}{X} = -\dfrac{\alpha^2}{\kappa}$$

This has characteristic polynomial

$$\kappa m^2 + \alpha^2 = 0$$

Therefore, we get

$$X(x) = a' \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b' \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right)$$

Therefore, our solution is

$$\phi(x, t) = T(t)X(x) = e^{-\alpha^2 t} \left( a \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) \right)$$

At time $t = 0$, $\phi(x, 0) = f(x)$, which is some prescribed function of $x$ (the initial temperature distribution along a bar $x \in [0, L]$ perhaps), then we would seem to require that

$$f(x) = a \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right)$$

which in general is not possible.

My questions are as follows:

1. Why are the constants changed from $a'$ and $b'$ to $a$ and $b$? What happened there?

2. Why is $f(x) = a \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right)$ not possible?

I would greatly appreciate it if people could please take the time to clarify this.

• @PanchalShamsundar Yes, but surely there is a reason for the author changing the constants in the middle of the example? That's what I'm curious about. – The Pointer Aug 28 '18 at 2:26

1. Let $a = T_0 ', b = T_0 b'$.
2. If the solution of $\phi(x,t)$ holds for $t \geqslant 0$, then $\phi (x,0)=f(x)$ should be such a trigonometric function. But generally the given $f(x)$ [as a condition to determine $\phi(x,t)$] is not this trig function at all [Maybe $f(x) =x$ or something else].
• Thanks for the answer. Reading your explanation for 2, I still don't understand why this means that $f(x) = a \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right)$ is not possible. – The Pointer Aug 28 '18 at 4:04
• @ThePointer $f(x)$ is given in advance, it can be any kind of real functions [e.g. $f(x) = x$]. You cannot force $f(x)$ equals to this trig equation [generally they cannot be identical]. But as Andrei mentioned, you could let an infinite sum of trig functions equals $f(x)$ – xbh Aug 28 '18 at 4:12
The first question was answered by @xbh. For the second question, you did not finish the problem. $\phi(0,t)=0$ means that $a=0$. We don't want $b$ to be identically zero, so $\phi(L,t)=0$ means that $\frac{\alpha L}{\sqrt \kappa}=n\pi$, where $n\in\mathbb Z^*$. What this means is that your solution can be written as a Fourier series. You get $$\phi_n(x,t)=b_ne^{-tn^2\pi^2\kappa/L^2}\sin\frac{n\pi\sqrt\kappa x}{L}$$ By applying superposition, if $\phi_i$ and $\phi_j$ are solutions, then $\phi_i+\phi_j$ is also a solution of your equation. Therefore $$\phi(x,t)=\sum_n\phi_n(x,t)$$
• Thanks for the answer. How does this explain why $f(x) = a \cos\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right) + b \sin\left( \dfrac{\alpha x}{\sqrt{\kappa}} \right)$ is not possible? – The Pointer Aug 28 '18 at 4:05
• I think you misunderstood. If $f(x)$ has that form (with $a=0$), then you have a simple solution (single $\alpha$ value). But if $f(x)$ has a more complicated form, you need to find the solution as a superposition of different solutions, with different $\alpha$ values. Note that $f(x)$ is an initial condition, and can have any form. – Andrei Aug 28 '18 at 4:24