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.
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
.
We would like to use separation of variables to write the solution
in a form that looks roughly like:
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
:
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 ,
Plug this expression for into the boundary conditions for
,
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
:
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
:
We continue finding the rest of the problem for . We replace
by
into the partial differential equation
,
The final part of the problem for that we have not converted yet
is the initial condition. We replace
by
in
,
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:
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:
We then get the following Sturm-Liouville problem for any
eigenfunctions :
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:
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:
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:
For the sums to be equal for any , the coefficients of every
individual eigenfunction must balance. So we get
Solve the homogeneous equation first. The characteristic polynomial
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:
Putting the found solution for into
We still need to find the integration constant . To do so,
write the initial condition
using Fourier series:
Collecting all the boxed formulae together, the solution is found by
first computing the coefficients from:
Also compute the functions from:
Then the temperature is: