# Differential Equations and Linear Algebra, 8.3: Heat Equation

From the series: Differential Equations and Linear Algebra

*
Gilbert Strang, Massachusetts Institute of Technology (MIT)
*

The heat equation ∂*u*/∂*t* = ∂* ^{2}u*/∂

*x*starts from a temperature distribution

^{2}*u*at

*t*= 0 and follows it for

*t*> 0 as it quickly becomes smooth.

This is heat equation video. So this is the second of the three basic partial differential equations. We had Laplace's equation, that was-- time was not there. Now time comes into the heat equation.

We have a time derivative, and two-- matching with two space derivatives. So I have my function. My solution depends on t and on x, and I hope I can separate those two parts. This is exactly like the way we solved the ordinary systems of differential equations. We pulled out an e to the lambda t, where lambda was the eigenvalue, and then we had the eigenvector. Here, it's an eigenfunction because it depends on x. We didn't have x before, but now we have partial differential equations. X is also a coordinate here. So I look for solutions like that. And just as always, I substitute that into the differential equation to discover what-- what determines S, S of x.

The time derivative brings down a lambda. The space derivative brings down-- has two space derivatives. So that's what I get when I substitute e to the lambda t S eigenvalue, times eigenfunction, into the equation. And always, I cancel e to the lambda t, that's the beauty of it, and I have an eigenvalue equation, or I'm looking again for a function. So the second derivative of my function is lambda, some number, times my function. OK. What I'm looking for for functions S, they'll be sine functions. S will be, S of x, will be the sine of K pi x, the sine of x, the sign of something times x.

What's the eigenvalue? Take two derivatives of this, I get back sine k pi x, which is, that's great, it's an eigenfunction. And out comes the eigenvalue, lambda is, well when I take two derivatives, k pi comes out twice with a minus sign. So it's minus k squared, pi squared. So I have found a bunch of eigenvectors, eigenfunctions, and the eigenvalues.

So this was a simple pair, but now the general solution, the general solution, u of t x, will be? If I know several solutions, and I have a linear equation, I just take combinations. That's always our way. Take combinations of those basic solutions, so I'll have a sum, k going from 1 to infinity. In differential equation, partial differential equations, I need a big sum here, of some coefficients, let me call them B k, times this solution, e to the lambda-- what was lambda-- minus k squared, pi squared t, times S, S number k. I should have given this eigenfunction it's number, k.

So there is the, this is my family of eigenfunctions and eigenvalues. And then, this is the combination of these solutions. There is the general solution. And for S k, I should have written in sine k pi x. So that's the dependence on t.

Let's have a look at this. So the dependence on t is fast decay. And if K, as K gets larger, later terms in this sum, the decay is really fast. So the term that decays most slowly, k equal 1, there'll be a B1, an e to the minus, pi squared t. That's decaying already pretty fast.

When I'm talking about decay, what's happening here? I have a bar, a material bar. The ends of the bar are kept at temperature zero, they're frozen, and heat is in the bar. Heat is flowing around in the bar. And where is it going? It's flowing out the ends. The bar is approaching freezing. The ends are kept at freezing, and the inside of the bar, whatever heat is there at the beginning, is going to flow out the ends.

So, you see, that I have these sine functions. When x is 0 the sine is 0 so that's frozen at one end. When x is 1, I have the sine of k pi, which is, again, 0, so it's frozen at the other end. So I'm freezing it at both ends. The temperature is escaping out of the center, so let me graph the solution.

So maybe I start with-- here is my bar from 0 to 1, and I'm keeping it frozen. F for frozen, f for frozen at that end. Maybe I, maybe I start off with a warm bar. So u at 0 and x, I'll say it'd be 1. This way is x. So I have an ordinary heated bar, and I put it in the freezer. So I insulate the sides so the heat is escaping out the two ends, out the end x equals 0 and out the end x equal 1. And the solution will be, let me remember what the general solution looked like, and I have to find these numbers.

OK. And those numbers, of course, the numbers are always found by matching the initial conditions. This is the initial, this is an initial picture. OK. So I have to match that by-- so this is t equals 0, I have to match the sum of B k. This is k going from 1 to infinity. When t is, when t is zero, this is 1, and I just have the Sk. The sine of k pi x, that has to match the 1. And from that, I find the Bk's, and then the final solution. T greater than 0 uses those Bks. And we're again faced with a Fourier series problem.

Anytime I have to find these coefficients, this is a Fourier sine series, I have only sines, not cosines here. And I'm finding the coefficients, so that this will match 1, the initial condition. And then, for t greater than 0, solution u will be, as we said, the sum of these Bk's, which come from the initial conditions, come from this-- Fourier coefficients, we still have to do that video on Fourier series to know what these numbers will come out to be-- times the e, to the minus k squared, pi squared t times the sine of k pi x.

You may think, well it's a pretty messy solution, because it's an infinite sum. But it's not bad for a partial differential equation. We have numbers, we have something depending on time and decaying rapidly, and something depending on x. So at time 1, if I drew a picture, suppose the heat is, the temperature starts out through the whole bar at 1. But with this kind of time decay, a little later in time, the temperature's going to be something like that. It'll be way down at the ends, pretty low in the middle. And so at some time t, the temperature will look like that, and then soon after that, the temperature will go down here, and the steady state, of course, is the whole thing is at temperature 0.

So that's what solutions to the heat equation look like. And this is the step of finding the-- which I didn't take, it's the Fourier series step-- of finding the coefficients in our infinite series of solutions. Once again, we have infinitely many solutions. We're talking about a partial differential equation. We have a whole function to match, so we need all of those. And Fourier series tells us how to do that matching, how to find these Bk's. So that's a separate and important question, Fourier series. Thank you.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

### Asia Pacific

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)