tiles representing separation of variables
Outlier Articles Home

Calculus

Separation of Variables: What Is It & How to Do It

04.06.2022 • 9 min read

Rachel McLean

Subject Matter Expert

In this article, we discuss the meaning of separation of variables. Then, we learn how to apply it to ordinary differential equations using a step-by-step guide. Finally, we introduce how this method can be used to solve differential equations with two variables.

In This Article

  1. What Is Separation of Variables?

  2. Separation of Variables for Ordinary Differential Equations

  3. Separation of Variables for Partial Differential Equations

What Is Separation of Variables?

A differential equation is an equation that relates an unknown function y=f(x)y = f(x) with its derivatives.

Solving differential equations is an essential prediction tool in:

  • Economics

  • Physics

  • Life sciences

  • Social sciences

Here are some simple examples of differential equations to help you understand what a differential equation might look like:

  • dydx=2xy\frac{dy}{dx} = 2xy

  • y’’2y+y=3x28y’’ - 2y’ + y = 3x^2 - 8

  • 2x23dydx=02x^2 - 3\frac{dy}{dx} = 0

You might be used to solving equations that require a single number as its solution. It’s important to note that a solution to a differential equation is a function instead of a number. You can use this function to forecast future values. For example, the solution to a differential equation could be a function that is used to predict animal populations.

A solution to a differential equation is a function that satisfies the differential equation. So, to check if a function f(x)f(x) is a solution to a differential equation, we can simply substitute f(x)f(x) and its derivatives into the differential equation and verify that both sides of the equation are the same.

For example, consider the differential equation 4x32dydx=04x^3 - 2 \frac{dy}{dx} = 0. Suppose we want to check if the function y=x42+5y = \frac{x^4}{2} + 5 is a solution to the given differential equation.

Well, taking the derivative of yy, we find that dydx=2x3\frac{dy}{dx} = 2x^3. Plugging dydx\frac{dy}{dx} into our differential equation, we get:

4x32(2x3)=04x^3 - 2(2x^3) = 0
4x34x3=04x^3 - 4x^3 = 0
0=00 = 0

Since both sides of the equation agree, yy is a solution to the differential equation.

So, how exactly can we find all the functions that satisfy a given differential equation? Separation of variables is one method for solving differential equations. Differential equations that can be solved using separation of variables are called separable differential equations.

Consider the equation dydx=f(x)g(y)\frac{dy}{dx} = \frac{f(x)}{g(y)}. If we multiply both sides by the denominators of each side, we get the equation g(y)dy=f(x)dxg(y)dy = f(x)dx.

You can write separable differential equations in the form g(y)dy=f(x)dxg(y)dy = f(x)dx given above. This means that all terms involving yy are on one side of the equation, while all terms involving xx are on the other side of the equation. Since xx and yy are separated, this is why we call such an equation a separable differential equation.

After separating the variables, separable differential equations can be solved by integrating both sides of the equation with respect to the variable on that side. Don’t forget to add the constant of integration to your equation.

g(y)dy=f(x)dx\int g(y) \, dy = \int f(x) \, dx
G(y)=F(x)+CG(y) = F(x) + C

In this last equation, FF and GG are the antiderivative functions of ff and gg respectively. This is our general solution to dydx=f(x)g(y)\frac{dy}{dx} = \frac{f(x)}{g(y)}.

To check our work and verify that G(x)=F(x)+CG(x) = F(x) + C is a solution to our original differential equation dydx=f(x)g(y)\frac{dy}{dx} = \frac{f(x)}{g(y)}, we can simply differentiate each side implicitly with respect to xx and hope to get our original equation back.

Remember, to differentiate implicit functions with respect to xx, we must treat yy as a function of xx. This means that we’ll have to use the Chain Rule when we come across terms involving yy and multiply by dydx\frac{dy}{dx}. Then, we can solve for dydx\frac{dy}{dx}.

A differential equation is an equation that relates an unknown function y = f(x) with its derivatives.

Here’s what this process looks like. Since we’re differentiating G(y)G(y) with respect to xx, we have to use the Chain Rule and multiply G(y)G'(y) by dydx\frac{dy}{dx}. By the definition of an antiderivative function, we know that G(y)=g(y)G’(y) = g(y) and F(x)=f(x)F’(x) = f(x).

G(y)dydx=F(x)G’(y) \frac{dy}{dx} = F’(x)
g(y)dydx=f(x)g(y) \frac{dy}{dx} = f(x)
dydx=f(x)g(y)\frac{dy}{dx} = \frac{f(x)}{g(y)}

Since we were able to obtain our original equation dydx=f(x)g(y)\frac{dy}{dx} = \frac{f(x)}{g(y)}, this verifies that G(x)=F(x)+CG(x) = F(x) + C is the general solution to the differential equation.

To recap, here are three simple steps to solve differential equation using separation of variables:

  1. Separate the variables of the equation so that all the yy-terms are on one side of the equation and all the xx-terms are on the other side of the equation.

  2. Integrate each side of the equation with respect to the variable present on that side. Don’t forget to add the constant of integration to one side of the equation.

  3. Simplify where necessary.

Separable differential equations are differential equations that can be solved using separation of variables.

Separation of Variables for Ordinary Differential Equations

The above process details the separation of variables method for ordinary differential equations. An ordinary differential equation involves functions of only one variable and the derivatives of those functions. It contains no partial derivatives.

Let’s go through a few separation of variables examples together.

Example 1

Consider the differential equation 4x32dydx=04x^3 - 2 \frac{dy}{dx} = 0. We previously verified that y=x42+5y = \frac{x^4}{2} + 5 is one solution to the differential equation, but how can we determine the general solution? We’ll follow the three steps given above.

  1. Separating the variables, we get:

4x32dydx=04x^3 - 2\frac{dy}{dx} = 0
4x3=2dydx4x^3 = 2\frac{dy}{dx}
4x3dx=2dy4x^3 \, dx = 2 \, dy

2. Using the power rule to integrate both sides of the equation with respect to each side’s respective variable, we get:

4x3dx=2dy\int 4x^3 \, dx = \int 2 \, dy
4x44=2y+C\frac{4x^4}{4} = 2y + C
x4=2y+Cx^4 = 2y + C

3. Simplifying, we get y=x42+Cy = \frac{x^4}{2} + C. This is our general solution for the differential equation 4x32dydx=04x^3 - 2 \frac{dy}{dx} = 0.

Example 2

One of the most significant ordinary differential equations that can be solved using separation by variables is the exponential differential equation

dPdt=kP\frac{dP}{dt} = kP

where PP represents the size of some population, dPdt\frac{dP}{dt} represents the rate at which the population is changing with respect to time, and kk represents the growth and decay constant. Solving this differential equation allows us to derive the formula for exponential growth and decay.

We’ll follow the three steps given earlier.

Step 1

Separating the variables, we get:

dPdt=kP\frac{dP}{dt} = kP
dP=kPdtdP = kP \, dt
dPP=kdt\frac{dP}{P} = k \, dt

Step 2

Now we can integrate both sides of the equation with respect to each side’s respective variable. Using the power and logarithm rules for integration, we get:

1PdP=kdt\int \frac{1}{P} \, dP = \int k \, dt
lnP=kt+C\ln{P} = kt + C

Step 3

In order to simplify, we need to get PP by itself. To do this, we can raise ee to the lnP\ln{P} power. Also, notice eCe^C is just a constant, so we can say C=eCC = e^C.

elnP=ekt+Ce^{\ln{P}} = e^{kt+C}
P(t)=ekteCP(t) = e^{kt} \cdot e^C
P(t)=CektP(t) = Ce^{kt}

Let’s stop for a minute and examine P(0)P(0), which is the initial population size at t=0t = 0. Notice that P(0)=Ce0=C1=CP(0) = Ce^0 = C \cdot 1 = C. So, we can say that C=P(0)C = P(0), which means that CC is always equal to the population at t=0t = 0. We’ll denote this by P0P_0. Now we have:

P(t)=P0ektP(t) = P_0 e^{kt}

This is the formula for exponential growth and decay, which you can use to determine the population at any time tt. A positive kk value indicates growth, while a negative kk value indicates decay.

Retired NFL lineman and matematician John Urschel discusses exponential decay and how exponential equations fit into the larger story of Calculus:

Separation of Variables for Partial Differential Equations

Separation of variables can also be used to solve some partial differential equations. A partial differential equation is an equation that involves an unknown function and its derivatives, which depend on two or more independent variables.

Explaining how to solve partial differential equations using separation of variables will require a separate tutorial. In this guide, we will walk through one example that solves for the product solution of a partial differential equation. This will help you ‌understand how to solve partial differential equations using separation of variables.

We will find the product solution of Laplace’s Equation, given below.

2ux2+2uy2=0\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0

Step 1

Notice that uu is a function of two variables, xx and yy. The first step to solving a partial differential equation using separation of variables is to assume that it is separable. We must assume that it can be separated into separate functions, each with only one independent variable. If this assumption is false, the procedure to solve the differential equation will fail part way through.

So, we will make the assumption that:

u(x,y)=X(x)Y(y)u(x, y) = X(x)Y(y)

Step 2

Next, we substitute the above product of functions into the differential equation and differentiate accordingly to obtain the terms required in the original partial differential equation. So, substituting u(x,y)=X(x)Y(y)u(x, y) = X(x)Y(y), we have:

2x2X(x)Y(y)+2y2X(x)Y(y)=0\frac{\partial^2}{\partial x^2}X(x)Y(y) + \frac{\partial^2}{\partial y^2}X(x)Y(y) = 0

The term 2x2X(x)Y(y)\frac{\partial^2}{\partial x^2}X(x)Y(y) is taking a second partial derivative with respect to xx, so we can treat yy as a constant. So, we can say 2x2X(x)Y(y)=Y(y)X’’(x)\frac{\partial^2}{\partial x^2}X(x)Y(y) = Y(y)X’’(x).

Similarly, the term 2y2X(x)Y(y)\frac{\partial^2}{\partial y^2}X(x)Y(y) is taking a second partial derivative with respect to yy, so xx is kept fixed. So, we can say 2y2X(x)Y(y)=X(x)Y’’(y)\frac{\partial^2}{\partial y^2}X(x)Y(y) = X(x)Y’’(y).

Now, we’ve gotten rid of the partial derivatives. Our current equation is:

Y(y)X’’(x)+X(x)Y’’(y)=0Y(y)X’’(x) + X(x)Y’’(y) = 0

Step 3

The next step is to move the xx-terms to one side of the equation and yy-terms to the other side of the equation, if possible. Luckily, this is possible for our example. If it is not possible, the partial differential equation is non-separable and separation by variables cannot be used.

All we have to do to separate our function is divide each term by X(x)Y(y)X(x)Y(y). Then, we can cancel similar terms and simplify:

Y(y)X’’(x)+X(x)Y’’(y)=0Y(y)X’’(x) + X(x)Y’’(y) = 0
Y(y)X’’(x)X(x)Y(y)+X(x)Y’’(y)X(x)Y(y)=0X(x)Y(y)\frac{Y(y)X’’(x)}{X(x)Y(y)} + \frac{X(x)Y’’(y)}{X(x)Y(y)} = \frac{0}{X(x)Y(y)}
X’’(x)X(x)+Y’’(y)Y(y)=0\frac{X’’(x)}{X(x)} + \frac{Y’’(y)}{Y(y)} = 0
X’’(x)X(x)=Y’’(y)Y(y)\frac{X’’(x)}{X(x)} = - \frac{Y’’(y)}{Y(y)}

Step 4

Next, since X(x)X(x) does not depend on yy and since Y(y)Y(y) does not depend on xx, both sides must yield the same constant value. We’ll call this constant λ2-\lambda^2. Setting the equation equal to λ2-\lambda^2 seems random, but it will make the resulting ordinary differential equations easier to solve.

Y(y)X’’(x)X(x)Y(y)+X(x)Y’’(y)X(x)Y(y)=0X(x)Y(y)\frac{Y(y)X’’(x)}{X(x)Y(y)} + \frac{X(x)Y’’(y)}{X(x)Y(y)} = \frac{0}{X(x)Y(y)}

Setting our equation equal to a constant allows us to form two ordinary differential equations.

X’’(x)X(x)+λ2=0\frac{X’’(x)}{X(x)} + \lambda^2 = 0
X’’(x)+λ2X(x)=0X’’(x) + \lambda^2 X(x) = 0
Y’’(y)Y(y)λ2=0\frac{Y’’(y)}{Y(y)} - \lambda^2 = 0
Y’’(y)λ2Y(y)=0Y’’(y) - \lambda^2 Y(y) = 0

The general solution for an ordinary differential equation of the form y’’+w2y=0y’’ + w^2y = 0 is y(x)=Acos(wx)+Bsin(wx)y(x) = A \cos{(wx)} + B \sin{(wx)}. So, the general solution of X’’(x)+λ2X(x)=0X’’(x) + \lambda^2 X(x) = 0 is X(x)=Asin(kx)+Bcos(kx)X(x) = A \sin{(kx)} + B \cos{(kx)}.

Note that the auxiliary equation of Y’’(y)λ2Y(y)=0Y’’(y) - \lambda^2 Y(y) = 0 is r2λ2=0=(r+λ)(rλ)r^2 - \lambda^2 = 0 = (r+\lambda)(r-\lambda), so that r1=λr_1 = \lambda and r2=λr_2 = -\lambda. The general solution for a homogeneous differential equation with two real distinct roots is y(x)=c1er1x+c2er2xy(x) = c_1e^{r_1x} + c_2e^{r_2x}. So, the general solution of Y’’(y)λ2Y(y)=0Y’’(y) - \lambda^2 Y(y) = 0 is Y(y)=Ceky+DekyY(y) = Ce^{ky} + De^{-ky}.

Thus the equations X(x)=Asin(kx)+Bcos(kx)X(x) = A \sin{(kx)} + B \cos{(kx)}and Y(y)=Ceky+DekyY(y) = Ce^{ky} + De^{-ky} give us the product solution of the partial differential equation, so that u=(Asin(kx)+Bcos(kx))(Ceky+Deky)u = (A \sin{(kx)} + B \cos{(kx)}) \cdot (Ce^{ky} + De^{-ky}).

Note, the product solution might not be the complete solution. Finding the complete solution requires further mathematical context surrounding boundary conditions, initial conditions, and superposition.

Explore Outlier's Award-Winning For-Credit Courses

Outlier (from the co-founder of MasterClass) has brought together some of the world's best instructors, game designers, and filmmakers to create the future of online college.

Check out these related courses:

Calculus I

Calculus I

The mathematics of change.

Explore course
Intro to Statistics

Intro to Statistics

How data describes our world.

Explore course
Intro to Microeconomics

Intro to Microeconomics

Why small choices have big impact.

Explore course

Share