Separation of variables is a technique which can be used to solve both ODEs and PDEs. The basic idea for an equation in two variables is to rewrite the equation so that each of the two variables is located on different sides of an equality sign, and since both sides of the equation depend on different variables, the two sides must be equal to a constant. We introduce this idea with the simple first order linear ODE

(
As long as for any value of , we can formally separate variables and rewrite eq. 1 as

(
Now we can solve for by integrating both sides

(

(

(

(

(

(
Where and are arbitrary constants of integration.
 We now perform a similar example for a linear partial differential equation. The heat
equation is

(
We suppose that , so that we obtain

(
We can rewrite this as

(
where is a constant independent of and . The two sides can be integrated separately to get and either or Since the heat equation is linear, one can then add different solutions to the heat equation and still obtain a solution of the heat equation. Hence solutions of the heat equation can be found by

(
where the constants and are appropriately chosen. Convergence of such series to an actual solution is studied in mathematics courses on analysis (see for example Evans^{[1]} or Renardy and Rogers^{[2]}), however the main ideas necessary to choose the constants, and and hence construct such solutions are typically encountered towards the end of a calculus course or at the beginning of a differential equations course, see for example Courant and John^{[3]}^{[4]} or Boyce and DiPrima^{[5]}. Here, we consider the case where , and for which we have periodic boundary conditions. In this case must be integers, which we choose to be nonnegative to avoid redundancies. At time , we shall suppose that the initial condition is given by

(
Now,

(

(
and

(
Thus we can consider the trigonometric polynomials as being orthogonal vectors. It can be shown that a sum of these trigonometric polynomials can be used to approximate a wide class of periodic functions on the interval ; for well behaved functions, only the first few terms in such a sum are required to obtain highlyaccurate approximations. Thus, we can expand the initial condition into a sum of trigonometric functions,

(
Multiplying the above equation by either or and using the orthogonality of the functions, we deduce that

(
and

(
Most ODEs and PDEs of practical interest will not be separable. However, the ideas behind separation of variables can be used to allow one to find series solutions to a wide class of PDEs. These series solutions can also be found numerically and are what we will use to find approximate solutions to PDEs, and so the ideas behind this simple examples are quite useful.
ExercisesEdit
1) Solve the ordinary differential equation
using separation of variables.
2)
 a) Use separation of variables to solve the partial differential equation
with
and
 b) Create plots of your solution at several different times and/or create an animation of the solution you have found.
 c) The procedure required to find the coefficients in the Fourier series expansion for the initial condition can become quite tedious/intractable. Consider the initial condition . Explain why it would be difficult to compute the Fourier coefficients for this by hand. Also explain why it would be nice to have an algorithm or computer program that does this for you.
NotesEdit
ReferencesEdit
Boyce, W.E.; DiPrima, R.C. (2010). Elementary Differential Equations and Boundary Value Problems. Wiley.
Courant, R.; John, F. (1998). Introduction to Calculus and Analysis. I. Springer.
Courant, R.; John, F. (1999). Introduction to Calculus and Analysis. II. Springer.
Evans, L.C. (2010). Partial Differential Equations. American Mathematical Society.
Rogers, R.C. (2004). An Introduction to Partial Differential Equations. Springer.