12.2: The Method of Separation of Variables


Most PDEs you will encounter in physical chemistry can be solved using a method called “separation of variables”. We will exemplify the method by solving the easiest PDE: The Laplace equation in two dimensions:

$\label{eq:pde5} \dfrac{\partial f(x,y)}{\partial x}+\dfrac{\partial f(x,y)}{\partial y}=0$

The solutions of Laplace’s equation are important in many fields of science, including electromagnetism, astronomy, and fluid dynamics.

separation of variable Steps

The following steps summarize everything we have done to find the solution:

1. Assume that the solution of the differential equation can be expressed as the product of functions of each of the variables.
2. Group terms that depend on each of the independent variables (in this case $$x$$ and $$y$$).
3. Identify the terms that need to equal constants.
4. Solve the ODEs (do not forget the integration constants!)
5. Put everything together. Your answer will have one or more constants that will eventually be determined from boundary conditions

Step 1

The first step in the method of separation of variables is to assume that the solution of the differential equation, in this case $$f(x,y)$$, can be expressed as the product of a function of $$x$$ times a function of $$y$$.

$f(x,y)=X(x)Y(y) \label{eq1}$

Don’t get confused with the nomenclature. We use lower case to denote the variable, and upper case to denote the function. We could have written Eqution \ref{eq1} as

$f(x,y)=h(x)g(y)$

Step 2

In the second step, we substitute $$f(x,y)$$ in Equation \ref{eq:pde5} by Equation \ref{eq1}:

$\dfrac{\partial X(x)Y(y)}{\partial x}+\dfrac{\partial X(x)Y(y)}{\partial y}=0$

$\label{eq:pde7} Y(y)\dfrac{\partial X(x)}{\partial x}+X(x)\dfrac{\partial Y(y)}{\partial y}=0$

Step 3

The third step involves reorganizing the terms of Equation \ref{eq:pde7} so all terms in $$x$$ and $$y$$ are grouped together. There is no universal method for this step. In this example, we’ll separate variables by dividing all terms by $$X(x)Y(y)$$, but in general you will need to figure out how to separate variables for the particular equation you are solving:

$\label{eq:pde8} \dfrac{1}{X(x)}\dfrac{\partial X(x)}{\partial x}+\dfrac{1}{Y(y)}\dfrac{\partial Y(y)}{\partial y}=0$

Step 4

In the fourth step, we recognize that Equation \ref{eq:pde8} is the sum of two terms (it would be three if we were solving a problem in 3 dimensions), and each term depends on one variable only. In this case, the first term is a function of $$x$$ only, and the second term is a function of $$y$$ only. How can we add something that depends on $$x$$ only to something that depends on $$y$$ only and get zero? This sounds impossible, as terms in $$x$$ will never cancel out terms in $$y$$ 1.

The only way to make Equation \ref{eq:pde8} hold for any value of $$x$$ and $$y$$ is to force each summand to be a constant. The term $$\dfrac{1}{X(x)}\dfrac{\partial X(x)}{\partial x}$$ cannot be a function of $$x$$, and the term $$\dfrac{1}{Y(y)}\dfrac{\partial Y(y)}{\partial y}$$ cannot be a function of $$y$$:

$\label{eq:pde9a} \dfrac{1}{X(x)}\dfrac{\partial X(x)}{\partial x}=K_1$

$\label{eq:pde9b} \dfrac{1}{Y(y)}\dfrac{\partial Y(y)}{\partial y}=K_2$

This step transforms a PDE into two ODEs. In general, we will have one ODE for each independent variable. In this particular case, because the two terms need to add up to zero, we have $$K_1=-K_2$$.

Step 5

In the fifth step, we solve the 2 ODEs using the methods we learned in previous chapters. We will get $$X(x)$$ from Equation \ref{eq:pde9a} and $$Y(y)$$ from Equation \ref{eq:pde9b}. Both solutions will contain arbitrary constants that we will evaluate using initial or boundary conditions if given. In this case, the two equations are mathematically identical, and are separable 1st order ordinary differential equations. The solutions (which you should be able to get on your own) are:

$X(x)=Ae^{K_1x}$

$Y(y)=Be^{-K_1y}$

Step 6

In step 6, we combine the one-variable solutions to obtain the many-variable solution we are looking for (Equation \ref{eq1}):

$f(x,y)=X(x)Y(y)=Ae^{K_1x}Be^{-K_1y}=Ce^{K_1(x-y)}$

where $$C$$ is a constant.

We should always finish by checking that our answer indeed satisfies the PDE we were trying to solve:

$\dfrac{\partial f(x,y)}{\partial x}+\dfrac{\partial f(x,y)}{\partial y}=0$

\begin{align*} f(x,y) &=Ce^{K_1(x-y)}\rightarrow \dfrac{\partial f(x,y)}{\partial x}=CK_1e^{K_1(x-y)} \\[4pt] \dfrac{\partial f(x,y)}{\partial y} &=-CK_1e^{K_1(x-y)}\rightarrow \dfrac{\partial f(x,y)}{\partial x}+\dfrac{\partial f(x,y)}{\partial y}=0 \end{align*}

This page titled 12.2: The Method of Separation of Variables is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Marcia Levitus via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.