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.
A differential equation is an equation that relates an unknown function 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:
dxdy=2xy
y’’−2y’+y=3x2−8
2x2−3dxdy=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) is a solution to a differential equation, we can simply substitute 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 4x3−2dxdy=0. Suppose we want to check if the function y=2x4+5 is a solution to the given differential equation.
Well, taking the derivative of y, we find that dxdy=2x3. Plugging dxdy into our differential equation, we get:
4x3−2(2x3)=0
4x3−4x3=0
0=0
Since both sides of the equation agree, y 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 dxdy=g(y)f(x). If we multiply both sides by the denominators of each side, we get the equation g(y)dy=f(x)dx.
You can write separable differential equations in the form g(y)dy=f(x)dx given above. This means that all terms involving y are on one side of the equation, while all terms involving x are on the other side of the equation. Since x and y 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
G(y)=F(x)+C
In this last equation, F and G are the antiderivative functions of f and g respectively. This is our general solution to dxdy=g(y)f(x).
To check our work and verify that G(x)=F(x)+C is a solution to our original differential equation dxdy=g(y)f(x), we can simply differentiate each side implicitly with respect to x and hope to get our original equation back.
Remember, to differentiate implicit functions with respect to x, we must treat y as a function of x. This means that we’ll have to use the Chain Rule when we come across terms involving y and multiply by dxdy. Then, we can solve for dxdy.
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) with respect to x, we have to use the Chain Rule and multiply G′(y) by dxdy. By the definition of an antiderivative function, we know that G’(y)=g(y) and F’(x)=f(x).
G’(y)dxdy=F’(x)
g(y)dxdy=f(x)
dxdy=g(y)f(x)
Since we were able to obtain our original equation dxdy=g(y)f(x), this verifies that G(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:
Separate the variables of the equation so that all the y-terms are on one side of the equation and all the x-terms are on the other side of the equation.
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.
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 4x3−2dxdy=0. We previously verified that y=2x4+5 is one solution to the differential equation, but how can we determine the general solution? We’ll follow the three steps given above.
Separating the variables, we get:
4x3−2dxdy=0
4x3=2dxdy
4x3dx=2dy
2. Using the power rule to integrate both sides of the equation with respect to each side’s respective variable, we get:
∫4x3dx=∫2dy
44x4=2y+C
x4=2y+C
3. Simplifying, we get y=2x4+C. This is our general solution for the differential equation 4x3−2dxdy=0.
Example 2
One of the most significant ordinary differential equations that can be solved using separation by variables is the exponential differential equation
dtdP=kP
where P represents the size of some population, dtdP represents the rate at which the population is changing with respect to time, and k 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:
dtdP=kP
dP=kPdt
PdP=kdt
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:
∫P1dP=∫kdt
lnP=kt+C
Step 3
In order to simplify, we need to get P by itself. To do this, we can raise e to the lnP power. Also, notice eC is just a constant, so we can say C=eC.
elnP=ekt+C
P(t)=ekt⋅eC
P(t)=Cekt
Let’s stop for a minute and examine P(0), which is the initial population size at t=0. Notice that P(0)=Ce0=C⋅1=C. So, we can say that C=P(0), which means that C is always equal to the population at t=0. We’ll denote this by P0. Now we have:
P(t)=P0ekt
This is the formula for exponential growth and decay, which you can use to determine the population at any time t. A positive k value indicates growth, while a negative k 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.
∂x2∂2u+∂y2∂2u=0
Step 1
Notice that u is a function of two variables, x and y. 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)
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), we have:
∂x2∂2X(x)Y(y)+∂y2∂2X(x)Y(y)=0
The term ∂x2∂2X(x)Y(y) is taking a second partial derivative with respect to x, so we can treat y as a constant. So, we can say ∂x2∂2X(x)Y(y)=Y(y)X’’(x).
Similarly, the term ∂y2∂2X(x)Y(y) is taking a second partial derivative with respect to y, so x is kept fixed. So, we can say ∂y2∂2X(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)=0
Step 3
The next step is to move the x-terms to one side of the equation and y-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). Then, we can cancel similar terms and simplify:
Next, since X(x) does not depend on y and since Y(y) does not depend on x, both sides must yield the same constant value. We’ll call this constant −λ2. Setting the equation equal to −λ2 seems random, but it will make the resulting ordinary differential equations easier to solve.
Setting our equation equal to a constant allows us to form two ordinary differential equations.
X(x)X’’(x)+λ2=0
X’’(x)+λ2X(x)=0
Y(y)Y’’(y)−λ2=0
Y’’(y)−λ2Y(y)=0
The general solution for an ordinary differential equation of the form y’’+w2y=0 is y(x)=Acos(wx)+Bsin(wx). So, the general solution of X’’(x)+λ2X(x)=0 is X(x)=Asin(kx)+Bcos(kx).
Note that the auxiliary equation of Y’’(y)−λ2Y(y)=0 is r2−λ2=0=(r+λ)(r−λ), so that r1=λ and r2=−λ. The general solution for a homogeneous differential equation with two real distinct roots is y(x)=c1er1x+c2er2x. So, the general solution of Y’’(y)−λ2Y(y)=0 is Y(y)=Ceky+De−ky.
Thus the equations X(x)=Asin(kx)+Bcos(kx)and Y(y)=Ceky+De−ky give us the product solution of the partial differential equation, so that u=(Asin(kx)+Bcos(kx))⋅(Ceky+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.
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.