Subsections

### 5.6 Inhomogeneous boundary conditions

The method of separation of variables needs homogeneous boundary conditions. More precisely, the eigenfunctions must have homogeneous boundary conditions. (Even if in a set of functions each function satisfies the given inhomogeneous boundary conditions, a combination of them will in general not do so.)

In the previous example, this problem could be circumvented by choosing instead of as the variable of the eigenfunctions. For the example in this section, however, this does not work.

#### 5.6.1 The physical problem

The problem is to find the unsteady temperature distribution in a bar for any arbitrary position and time . The initial temperature distribution at time zero equals a given function . The heat flux out of the left end equals a given function , and the temperature of the right end a given function . Heat is added to the bar from an external source at a rate described by a given function .

#### 5.6.2 The mathematical problem

• Finite domain :
• Unknown temperature
• Constant , so a linear constant coefficient partial differential equation.
• Parabolic
• Inhomogeneous
• One initial condition
• One Neumann boundary condition
• One Dirichlet boundary condition
• All of , , , and are given functions.

#### 5.6.3 Outline of the procedure

We would like to use separation of variables to write the solution in a form that looks roughly like:

Here the would be the eigenfunctions.

The cannot be eigenfunctions since the time axis is semi-infinite. Also, Sturm-Liouville problems require boundary conditions at both ends, not initial conditions.

Unfortunately, eigenfunctions must have homogeneous boundary conditions. So if was simply written as a sum of eigenfunctions, it could not satisfy inhomogeneous boundary conditions.

Fortunately, we can apply a trick to get around this problem. The trick is to write as the sum of a function that satisfies the inhomogeneous boundary conditions plus a remainder :

Since produces the inhomogeneous term in the boundary conditions, the remainder satisfies homogeneous boundary conditions. Therefore can be written as

using separation of variables. Add to get .

#### 5.6.4 Step 0: Fix the boundary conditions

The first thing to do is find a function that satisfies the same boundary conditions as . In particular, must satisfy:

The function does not have to satisfy the either the partial differential equation or the initial condition. That allows you to take something simple for it. The choice is not unique, but you want to select something simple.

A function that is linear in ,

is surely the simplest possible choice. In this example, it works fine too.

Plug this expression for into the boundary conditions for ,

That produces the requirements

The solution is and . So our is

Keep track of what we know, and what we do not know. Since we (supposedly) have been given functions and , function is from now on considered a known quantity, as given above.

You could use something more complicated than a linear function if you like to make things difficult for yourself. Go ahead and use if you really love to integrate error functions and Bessel functions. It will work. I prefer a linear function myself, though. (For some problems, you may need a quadratic instead of a linear function.)

Under certain conditions, there may be a better choice than a low order polynomial in . If the problem has steady boundary conditions and a simple steady solution, go ahead and take to be that steady solution. It will work great. However, in the example here the boundary conditions are not steady; we are assuming that and are arbitrary given functions of time.

Next, having found , define a new unknown as the remainder when is subtracted from :

We now solve the problem by finding . When we have found , we simply add , already known, back in to get .

To do so, first, of course, we need the problem for to solve. We get it from the problem for by everywhere replacing by . Let's take the picture of the problem for in front of us and start converting.

First take the boundary conditions at and :

Replacing by :

But since by construction and ,

Note the big thing: while the boundary conditions for are similar to those for , they are homogeneous. We will get a Sturm-Liouville problem in the -direction for where we did not for . That is what does for us.

We continue finding the rest of the problem for . We replace by into the partial differential equation ,

and take all terms to the right hand side:

where , or, written out

Hence is now a known function, just like .

The final part of the problem for that we have not converted yet is the initial condition. We replace by in ,

and take to the other side:

where is , or written out:

Again, is now a known function.

The problem for is now the same as the one for , except that the boundary conditions are homogeneous and functions and have changed into known functions and .

Using separation of variables, we can find the solution for in the form:

We already know how to do that! (Don't worry, we will go over the steps anyway.) Having found , we will simply add to find the asked temperature .

#### 5.6.5 Step 1: Find the eigenfunctions

To find the eigenfunctions , substitute a trial solution into the homogeneous part of the partial differential equation, . Remember: ignore the inhomogeneous part when finding the eigenfunctions. Putting into produces:

Separate variables:

As always, cannot depend on since the left hand side does not. Also, cannot depend on since the middle does not. So must be a constant.

We then get the following Sturm-Liouville problem for any eigenfunctions :

The last two equations are the boundary conditions on which we made homogeneous.

This is the exact same eigenvalue problem that we had in an earlier example, so I can just take the solution from there. The eigenfunctions are:

#### 5.6.6 Step 2: Solve the problem

We expand in the problem for in a Fourier series:

In particular,

Since and are known functions, we can find their Fourier coefficients from orthogonality:

or with the eigenfunctions written out

The integrals in the bottom equal .

So the Fourier coefficients are now known constants, and the are now known functions of . Though in actual application, numerical integration may be needed to find them. During finals, I usually make the functions , and simple enough that you can do the integrals analytically.

Now write the partial differential equation using the Fourier series:

Looking in the previous section, the Sturm-Liouville equation was , so the partial differential equation simplifies to:

It will always simplify or you made a mistake.

For the sums to be equal for any , the coefficients of every individual eigenfunction must balance. So we get

We have obtained an ordinary differential equation for each . It is again constant coefficient, but inhomogeneous.

Solve the homogeneous equation first. The characteristic polynomial is

so the homogeneous solution is

For the inhomogeneous equation, undetermined constants is not a possibility since we do not know the actual form of the functions . So we use variation of parameter:

Plugging into the ordinary differential equation produces

We integrate this equation to find . I could write the solution using an indefinite integral:

But that has the problem that the integration constant is not explicitly shown. That makes it impossible to apply the initial condition. It is better to write the anti-derivative using an integral with limits plus an explicit integration constant as:

You can check using the Leibniz rule for differentiation of integrals (or really, just the fundamental theorem of calculus,) that the derivative is exactly what it should be. (Also, the lower limit does not really have to be zero; you could start the integration from 1, if it would be simpler. The important thing is that the upper limit is the independent variable .)

Putting the found solution for into

we get, cleaned up:

We still need to find the integration constant . To do so, write the initial condition using Fourier series:

This gives us initial conditions for the :

the latter from above, and hence

or writing out the eigenvalue:

We have in terms of known quantities, so we are done.

#### 5.6.7 Summary of the solution

Collecting all the boxed formulae together, the solution is found by first computing the coefficients from:

where

Also compute the functions from:

where

Then the temperature is: