Paul's Online Math Notes

 Online Notes / Differential Equations (Notes) / Partial Differential Equations (Notes) / Solving the Heat Equation

Internet Explorer 10 & 11 Users : If you are using Internet Explorer 10 or Internet Explorer 11 then, in all likelihood, the equations on the pages are all shifted downward. To fix this you need to put your browser in Compatibility View for my site. Click here for instructions on how to do that. Alternatively, you can also view the pages in Chrome or Firefox as they should display properly in the latest versions of those browsers without any additional steps on your part.
 Differential Equations - Notes

## Solving the Heat Equation

Okay, it is finally time to completely solve a partial differential equation.  In the previous section we applied separation of variables to several partial differential equations and reduced the problem down to needing to solve two ordinary differential equations.  In this section we will now solve those ordinary differential equations and use the results to get a solution to the partial differential equation.  We will be concentrating on the heat equation in this section and will do the wave equation and Laplace’s equation in later sections.

The first problem that we’re going to look at will be the temperature distribution in a bar with zero temperature boundaries.  We are going to do the work in a couple of steps so we can take our time and see how everything works.

The first thing that we need to do is find a solution that will satisfy the partial differential equation and the boundary conditions.  At this point we will not worry about the initial condition.  The solution we’ll get first will not satisfy the vast majority of initial conditions but as we’ll see it can be used to find a solution that will satisfy a sufficiently nice initial condition.

 Example 1  Find a solution to the following partial differential equation that will also satisfy the boundary conditions.                                   Solution Okay the first thing we technically need to do here is apply separation of variables. Even though we did that in the previous section let’s recap here what we did.    First, we assume that the solution will take the form,                                                            and we plug this into the partial differential equation and boundary conditions.  We separate the equation to get a function of only t on one side and a function of only x on the other side and then introduce a separation constant.  This leaves us with two ordinary differential equations.   We did all of this in Example 1 of the previous section and the two ordinary differential equations are,                                  The time dependent equation can really be solved at any time, but since we don’t know what  is yet let’s hold off on that one.  Also note that in many problems only the boundary value problem can be solved at this point so don’t always expect to be able to solve either one at this point.   The spatial equation is a boundary value problem and we know from our work in the previous chapter that it will only have non-trivial solutions (which we want) for certain values of , which we’ll recall are called eigenvalues.  Once we have those we can determine the non-trivial solutions for each , i.e. eigenfunctions.   Now, we actually solved the spatial problem,                                                         in Example 1 of the Eigenvalues and Eigenfunctions section of the previous chapter for .  So, because we’ve solved this once for a specific L and the work is not all that much different for a general L we’re not going to be putting in a lot of explanation here and if you need a reminder on how something works or why we did something go back to Example 1 from the Eigenvalues and Eigenfunctions section for a reminder.   We’ve got three cases to deal with so let’s get going.     In this case we know the solution to the differential equation is,                                                 Applying the first boundary condition gives,                                                                   Now applying the second boundary condition, and using the above result of course, gives,                                                          Now, we are after non-trivial solutions and so this means we must have,                                The positive eigenvalues and their corresponding eigenfunctions of this boundary value problem are then,                          Note that we don’t need the  in the eigenfunction as it will just get absorbed into another constant that we’ll be picking up later on.     The solution to the differential equation in this case is,                                                                 Applying the boundary conditions gives,                        So, in this case the only solution is the trivial solution and so  is not an eigenvalue for this boundary value problem.     Here the solution to the differential equation is,                                             Applying the first boundary condition gives,                                                                 and applying the second gives,                                                        So, we are assuming   and so  and this means .   We therefore we must have  and so we can only get the trivial solution in this case.   Therefore, there will be no negative eigenvalues for this boundary value problem.   The complete list of eigenvalues and eigenfunctions for this problem are then,                          Now let’s solve the time differential equation,                                                                 and note that even though we now know  we’re not going to plug it in quite yet to keep the mess to a minimum.  We will however now use  to remind us that we actually have an infinite number of possible values here.   This is a simple linear (and separable for that matter) 1st order differential equation and so we’ll let you verify that the solution is,                                                         Okay, now that we’ve gotten both of the ordinary differential equations solved we can finally write down a solution.  Note however that we have in fact found infinitely many solutions since there are infinitely many solutions (i.e. eigenfunctions) to the spatial problem.   Our product solution are then,                                      We’ve denoted the product solution  to acknowledge that each value of n will yield a different solution.  Also note that we’ve changed the c in the solution to the time problem to  to denote the fact that it will probably be different for each value of n as well and because had we kept the  with the eigenfunction we’d have absorbed it into the c to get a single constant in our solution.

So, there we have it.  The function above will satisfy the heat equation and the boundary condition of zero temperature on the ends of the bar.

The problem with this solution is that it simply will not satisfy almost every possible initial condition we could possibly want to use.  That does not mean however, that there aren’t at least a few that it will satisfy as the next example illustrates.

 Example 2  Solve the following heat problem for the given initial conditions.                                   (a)   (b)   Solution (a) This is actually easier than it looks like.  All we need to do is choose  and  in the product solution above to get,                                                      and we’ve got the solution we need.  This is a product solution for the first example and so satisfies the partial differential equation and boundary conditions and will satisfy the initial condition since plugging in  will drop out the exponential.   (b) This is almost as simple as the first part.  Recall from the Principle of Superposition that if we have two solutions to a linear homogeneous differential equation (which we’ve got here) then their sum is also a solution.  So, all we need to do is choose n and  as we did in the first part to get a solution that satisfies each part of the initial condition and then add them up.  Doing this gives,                             We’ll leave it to you to verify that this does in fact satisfy the initial condition and the boundary conditions.

So, we’ve seen that our solution from the first example will satisfy at least a small number of highly specific initial conditions.

Now, let’s extend the idea out that we used in the second part of the previous example a little to see how we can get a solution that will satisfy any sufficiently nice initial condition.  The Principle of Superposition is, of course, not restricted to only two solutions.  For instance the following is also a solution to the partial differential equation.

and notice that this solution will not only satisfy the boundary conditions but it will also satisfy the initial condition,

Let’s extend this out even further and take the limit as .  Doing this our solution now becomes,

This solution will satisfy any initial condition that can be written in the form,

This may still seem to be very restrictive, but the series on the right should look awful familiar to you after the previous chapter.  The series on the left is exactly the Fourier sine series we looked at in that chapter.  Also recall that when we can write down the Fourier sine series for any piecewise smooth function on .

So, provided our initial condition is piecewise smooth after applying the initial condition to our solution we can determine the  as if we were finding the Fourier sine series of initial condition.  So we can either proceed as we did in that section and use the orthogonality of the sines to derive them or we can acknowledge that we’ve already done that work and know that coefficients  are given by,

So, we finally can completely solve a partial differential equation.

 Example 3  Solve the following BVP.                                   Solution There isn’t really all that much to do here as we’ve done most of it in the examples and discussion above.   First, the solution is,                                                   The coefficients are given by,                       If we plug these in we get the solution,

That almost seems anti-climactic.  This was a very short problem.  Of course some of that came about because we had a really simple constant initial condition and so the integral was very simple.  However, don’t forget all the work that we had to put into discussing Fourier sine series, solving boundary value problems, applying separation of variables and then putting all of that together to reach this point.

While the example itself was very simple, it was only simple because of all the work that we had to put into developing the ideas that even allowed us to do this.  Because of how “simple” it will often be to actually get these solutions we’re not actually going to do anymore with specific initial conditions.  We will instead concentrate on simply developing the formulas that we’d be required to evaluate in order to get an actual solution.

So, having said that let’s move onto the next example.  In this case we’re going to again look at the temperature distribution in a bar with perfectly insulated boundaries.  We are also no longer going to go in steps.  We will do the full solution as a single example and end up with a solution that will satisfy any piecewise smooth initial condition.

 Example 4  Find a solution to the following partial differential equation.                                  Solution We applied separation of variables to this problem in Example 2 of the previous section.  So, after assuming that our solution is in the form,                                                            and applying separation of variables we get the following two ordinary differential equations that we need to solve.                                We solved the boundary value problem in Example 2 of the Eigenvalues and Eigenfunctions section of the previous chapter for  so as with the first example in this section we’re not going to put a lot of explanation into the work here.  If you need a reminder on how this works go back to the previous chapter and review the example we worked there.  Let’s get going on the three cases we’ve got to work for this problem.     The solution to the differential equation is,                                                 Applying the first boundary condition gives,                                    The second boundary condition gives,                                                     Recall that   and so we will only get non-trivial solutions if we require that,                          The positive eigenvalues and their corresponding eigenfunctions of this boundary value problem are then,                                  The general solution is,                                                                 Applying the first boundary condition gives,                                                                 Using this the general solution is then,                                                                    and note that this will trivially satisfy the second boundary condition.  Therefore  is an eigenvalue for this BVP and the eigenfunctions corresponding to this eigenvalue is,                                                                        The general solution here is,                                             Applying the first boundary condition gives,                                                The second boundary condition gives,                                                  We know that  and so .  Therefore we must have  and so, this boundary value problem will have no negative eigenvalues.   So, the complete list of eigenvalues and eigenfunctions for this problem is then,                              and notice that we get the  eigenvalue and its eigenfunction if we allow  in the first set and so we’ll use the following as our set of eigenvalues and eigenfunctions.                              The time problem here is identical to the first problem we looked at so,                                                                Our product solutions will then be,                            and the solution to this partial differential equation is,                                                  If we apply the initial condition to this we get,                                                and we can see that this is nothing more than the Fourier cosine series for  on  and so again we could use the orthogonality of the cosines to derive the coefficients or we could recall that we’ve already done that in the previous chapter and know that the coefficients are given by,

The last example that we’re going to work in this section is a little different from the first two.  We are going to consider the temperature distribution in a thin circular ring.  We will consider the lateral surfaces to be perfectly insulated and we are also going to assume that the ring is thin enough so that the temperature does not vary with distance from the center of the ring.

So, what does that leave us with?  Let’s set  as shown below and then let x be the arc length of the ring as measured from this point.

We will measure x as positive if we move to the right and negative if we move to the left of .  This means that at the top of the ring we’ll meet where  (if we move to the right) and  (if we move to the left).  By doing this we can consider this ring to be a bar of length 2L and the heat equation that we developed earlier in this chapter will still hold.

At the point of the ring we consider the two “ends” to be in perfect thermal contact.  This means that at the two ends both the temperature and the heat flux must be equal.  In other words we must have,

If you recall from the section in which we derived the heat equation we called these periodic boundary conditions.  So, the problem we need to solve to get the temperature distribution in this case is,

 Example 5  Find a solution to the following partial differential equation.                      Solution We applied separation of variables to this problem in Example 3 of the previous section.  So, if we assume the solution is in the form,                                                            we get the following two ordinary differential equations that we need to solve.                    As we’ve seen with the previous two problems we’ve already solved a boundary value problem like this one back in the Eigenvalues and Eigenfunctions section of the previous chapter, Example 3 to be exact with .  So, if you need a little more explanation of what’s going on here go back to this example and you can see a little more explanation.   We again have three cases to deal with here.     The general solution to the differential equation is,                                                 Applying the first boundary condition and recalling that cosine is an even function and sine is an odd function gives us,                             At this stage we can’t really say anything as either  or sine could be zero.  So, let’s apply the second boundary condition and see what we get.               We get something similar.  However notice that if  then we would be forced to have  and this would give us the trivial solution which we don’t want.   This means therefore that we must have  which in turn means (from work in our previous examples) that the positive eigenvalues for this problem are,                                                  Now, there is no reason to believe that  or .  All we know is that they both can’t be zero and so that means that we in fact have two sets of eigenfunctions for this problem corresponding to positive eigenvalues.  They are,                            The general solution in this case is,                                                                 Applying the first boundary condition gives,                                     The general solution is then,                                                                    and this will trivially satisfy the second boundary condition.  Therefore  is an eigenvalue for this BVP and the eigenfunctions corresponding to this eigenvalue is,                                                                        For this final case the general solution here is,                                             Applying the first boundary condition and using the fact that hyperbolic cosine is even and hyperbolic sine is odd gives,                    Now, in this case we are assuming that  and so .  This turn tells us that .  We therefore must have .   Let’s now apply the second boundary condition to get,                              By our assumption on  we again have no choice here but to have  and so for this boundary value problem there are no negative eigenvalues.   Summarizing up then we have the following sets of eigenvalues and eigenfunctions and note that we’ve merged the  case into the cosine case since it can be here to simplify things up a little.                                The time problem is again identical to the two we’ve already worked here and so we have,                                                                Now, this example is a little different from the previous two heat problems that we’ve looked at.  In this case we actually have two different possible product solutions that will satisfy the partial differential equation and the boundary conditions.  They are,                              The Principle of Superposition is still valid however and so a sum of any of these will also be a solution and so the solution to this partial differential equation is,                             If we apply the initial condition to this we get,                                  and just as we saw in the previous two examples we get a Fourier series.  The difference this time is that we get the full Fourier series for a piecewise smooth initial condition on .  As noted for the previous two examples we could either rederive formulas for the coefficients using the orthogonality of the sines and cosines or we can recall the work we’ve already done.  There’s really no reason at this point to redo work already done so the coefficients are given by,                                        Note that this is the reason for setting up x as we did at the start of this problem.  A full Fourier series needs an interval of  whereas the Fourier sine and cosines series we saw in the first two problems need .

Okay, we’ve now seen three heat equation problems solved and so we’ll leave this section.  You might want to go through and do the two cases where we have a zero temperature on one boundary and a perfectly insulated boundary on the other to see if you’ve got this process down.

 Differential Equations - Notes