## If you could change one thing about college, what would it be? Outlier Articles Home

Calculus

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

## 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.

## What Is Separation of 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:

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

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

• $2x^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)$ 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 $4x^3 - 2 \frac{dy}{dx} = 0$. Suppose we want to check if the function $y = \frac{x^4}{2} + 5$ is a solution to the given differential equation.

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

$4x^3 - 2(2x^3) = 0$
$4x^3 - 4x^3 = 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 $\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)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.

$\int g(y) \, dy = \int 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 $\frac{dy}{dx} = \frac{f(x)}{g(y)}$.

To check our work and verify that $G(x) = F(x) + C$ is a solution to our original differential equation $\frac{dy}{dx} = \frac{f(x)}{g(y)}$, 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 $\frac{dy}{dx}$. Then, we can solve for $\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)$ with respect to $x$, we have to use the Chain Rule and multiply $G'(y)$ by $\frac{dy}{dx}$. By the definition of an antiderivative function, we know that $G’(y) = g(y)$ and $F’(x) = f(x)$.

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

Since we were able to obtain our original equation $\frac{dy}{dx} = \frac{f(x)}{g(y)}$, 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:

1. 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.

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 $4x^3 - 2 \frac{dy}{dx} = 0$. We previously verified that $y = \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:

$4x^3 - 2\frac{dy}{dx} = 0$
$4x^3 = 2\frac{dy}{dx}$
$4x^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:

$\int 4x^3 \, dx = \int 2 \, dy$
$\frac{4x^4}{4} = 2y + C$
$x^4 = 2y + C$

3. Simplifying, we get $y = \frac{x^4}{2} + C$. This is our general solution for the differential equation $4x^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

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

where $P$ represents the size of some population, $\frac{dP}{dt}$ 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:

$\frac{dP}{dt} = kP$
$dP = kP \, dt$
$\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:

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

### Step 3

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

$e^{\ln{P}} = e^{kt+C}$
$P(t) = e^{kt} \cdot e^C$
$P(t) = Ce^{kt}$

Let’s stop for a minute and examine $P(0)$, which is the initial population size at $t = 0$. Notice that $P(0) = Ce^0 = C \cdot 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 $P_0$. Now we have:

$P(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 $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.

$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 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:

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

The term $\frac{\partial^2}{\partial x^2}X(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 $\frac{\partial^2}{\partial x^2}X(x)Y(y) = Y(y)X’’(x)$.

Similarly, the term $\frac{\partial^2}{\partial y^2}X(x)Y(y)$ is taking a second partial derivative with respect to $y$, so $x$ is kept fixed. So, we can say $\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) = 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:

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

### Step 4

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 $-\lambda^2$. Setting the equation equal to $-\lambda^2$ seems random, but it will make the resulting ordinary differential equations easier to solve.

$\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.

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

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

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

Thus the equations $X(x) = A \sin{(kx)} + B \cos{(kx)}$and $Y(y) = Ce^{ky} + De^{-ky}$ give us the product solution of the partial differential equation, so that $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

The mathematics of change.

Explore course ## Intro to Statistics

How data describes our world.

Explore course ## Intro to Microeconomics

Why small choices have big impact.

Explore course