Separation of Variables

The first solving technique

In the previous chapter, we saw how slope fields reveal the shape of solutions without actually solving the equation. The direction field shows us where solutions flow, and we traced them by following the arrows. But tracing is not the same as solving. Now we want formulas.

This chapter introduces your first real technique for solving differential equations. It is called separation of variables, and while it only works for certain types of equations, it works beautifully when it applies. By the end, you will be able to take a differential equation like dydx=xy\frac{dy}{dx} = xy and produce an explicit solution y=Cex2/2y = Ce^{x^2/2}.

Recognizing Separable Equations

A differential equation is separable if you can write it in the form

dydx=g(x)h(y)\frac{dy}{dx} = g(x) \cdot h(y)

The right-hand side must be a product of a function of xx alone and a function of yy alone. When this structure exists, we can separate the variables onto opposite sides of the equation.

Consider dydx=xy\frac{dy}{dx} = xy. The right side factors as xx (a function of xx only) times yy (a function of yy only). This equation is separable.

Now consider dydx=x+y\frac{dy}{dx} = x + y. The right side is a sum, not a product. There is no way to write x+yx + y as g(x)h(y)g(x) \cdot h(y). This equation is not separable.

Interactive: Test whether equations are separable

Select a differential equation to analyze:

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

Is this equation separable?

The separable form is more common than you might expect. Many equations that do not look separable at first can be factored into the right form. For instance, dydx=xy+x\frac{dy}{dx} = xy + x factors as x(y+1)x(y + 1), which is separable with g(x)=xg(x) = x and h(y)=y+1h(y) = y + 1.

The Separation Technique

The idea is deceptively simple: rearrange the equation so that all the yy terms are on one side with dydy, and all the xx terms are on the other side with dxdx. Then integrate both sides.

Let us walk through the process with dydx=xy\frac{dy}{dx} = xy.

Step-by-step: Separating dy/dx = xy

Step 1 of 7Start with the differential equation
dydx=xy\frac{dy}{dx} = xy

We want to solve this equation. Notice the right side is a product of x and y.

The key move happens when we divide both sides by yy and rewrite the equation in differential form. At that point, each side involves only one variable:

1ydy=xdx\frac{1}{y}\, dy = x\, dx

Now integration makes sense. The left side is integrated with respect to yy, the right side with respect to xx. Each integral produces an antiderivative, and we end up with a relationship between xx and yy.

Treating dy/dx as a Fraction

You may have noticed something that seems suspicious: we treated dydx\frac{dy}{dx} as if it were an actual fraction, multiplying both sides by dxdx. Leibniz notation is designed to make this manipulation feel natural, and it gives the correct answer.

Rigorously, what we are doing is applying the chain rule in reverse. If yy is implicitly a function of xx, then

1ydy=1ydydxdx\int \frac{1}{y}\, dy = \int \frac{1}{y} \frac{dy}{dx}\, dx

The substitution u=yu = y, du=dydxdxdu = \frac{dy}{dx}\, dx transforms the right side into the integral on the left. The differential notation captures this substitution elegantly.

For practical purposes, you can think of it this way: the notation is designed so that algebraic manipulation gives the right answer. Just make sure the equation truly is separable before you separate.

Computing the Integrals

Once separated, each side is a standard integral. Let us see how the two integrals combine to form the solution.

Interactive: Watch both integrals evaluate

Starting from the separated form

1ydy=xdx\int \frac{1}{y}\, dy = \int x\, dx

Left side (in y)

1ydy\int \frac{1}{y}\, dy

Right side (in x)

xdx\int x\, dx

A few things to notice:

The constant of integration appears only once. Technically, each integral produces a constant, say lny+C1\ln|y| + C_1 on the left and x22+C2\frac{x^2}{2} + C_2 on the right. But we can combine them into a single constant C=C2C1C = C_2 - C_1 on the right side. By convention, we write one CC after integrating.

The solution may be implicit. Sometimes you cannot solve explicitly for yy in terms of xx. The relation lny=x22+C\ln|y| = \frac{x^2}{2} + C is itself a valid solution, even if we prefer to write y=Aex2/2y = Ae^{x^2/2}.

Handling the absolute value: The y|y| in lny\ln|y| deserves care. When we exponentiate lny=f(x)+C\ln|y| = f(x) + C, we get y=ef(x)+C=Aef(x)|y| = e^{f(x)+C} = Ae^{f(x)} where A=eC>0A = e^C > 0. Since yy could be positive or negative, we write y=±Aef(x)y = \pm Ae^{f(x)}. We can absorb the ±\pm into a new constant BB that can be positive or negative, giving y=Bef(x)y = Be^{f(x)}. The equilibrium solution y=0y = 0 often corresponds to the limiting case as B0B \to 0.

Finding Particular Solutions

The general solution contains an arbitrary constant. To find a particular solution, we need an initial condition: a specific point (x0,y0)(x_0, y_0) that the solution must pass through.

Given that y(x0)=y0y(x_0) = y_0, we substitute into the general solution and solve for the constant.

Interactive: Pick an initial condition

Equation: dydx=xy\frac{dy}{dx} = xy · General solution: y=Cex2/2y = Ce^{x^2/2}

With y(0.0)=1.0y(0.0) = 1.0, we get C=1.000C = 1.000

Drag the point or click anywhere to set an initial condition. The blue curve shows the particular solution passing through that point.

The slope field in the background shows how each particular solution follows the direction field. Every solution curve is tangent to the slope segments at every point. The initial condition selects one curve from the family of all solutions.

Example: The Exponential Equation

The simplest separable equation is

dydx=y\frac{dy}{dx} = y

This says the rate of change of yy equals yy itself. Separating:

1ydy=dx\frac{1}{y}\, dy = dx

Integrating both sides:

lny=x+C\ln|y| = x + C

Solving for yy:

y=Aexy = Ae^x

where A=±eCA = \pm e^C is an arbitrary constant. This is the exponential function, the solution to the fundamental equation of growth and decay. We will explore its applications in the next chapter.

Example: The Gaussian-Like Solution

Consider the equation we have been working with:

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

This factors as g(x)=xg(x) = x and h(y)=yh(y) = y. Separating:

1ydy=xdx\frac{1}{y}\, dy = x\, dx

Integrating:

lny=x22+C\ln|y| = \frac{x^2}{2} + C

Exponentiating both sides:

y=Aex2/2y = Ae^{x^2/2}

The shape of this solution is related to the Gaussian bell curve. When A>0A > 0, the function grows rapidly as x|x| increases. When A<0A < 0, it decreases. The rate of growth is proportional to both the current value and the distance from the origin.

Example: Power Law Solutions

Consider

dydx=yx\frac{dy}{dx} = \frac{y}{x}

Separating:

1ydy=1xdx\frac{1}{y}\, dy = \frac{1}{x}\, dx

Integrating:

lny=lnx+C\ln|y| = \ln|x| + C

This can be rewritten as

y=Axy = Ax

where AA is a constant. The solutions are straight lines through the origin. Notice how a differential equation can have solutions of a completely different character depending on its form. The exponential growth of y=yy' = y and the linear solutions of y=y/xy' = y/x come from the same separation technique.

Slope Fields Revisited

Now that we can solve separable equations, let us see how the formulas connect back to the slope fields from the previous chapter.

Slope field with solution curves

Solution form: y=Cex2/2y = Ce^{x^2/2}

Each solution curve threads through the slope field, always tangent to the direction at each point.

Each solution curve threads through the slope field, always tangent to the direction at each point. The slope field visualizes the differential equation; the solution curves are the actual solutions. Separation of variables gives us formulas for those curves.

Toggle between the three equations to see how different differential equations produce different solution families. The exponential equation y=yy' = y produces curves that separate from or approach y=0y = 0. The Gaussian-like equation y=xyy' = xy produces curves that bulge outward from the origin. The power law y=y/xy' = y/x produces straight lines.

When Separation Fails

Not every differential equation is separable. Consider

dydx=x+y\frac{dy}{dx} = x + y

No amount of algebraic manipulation will factor x+yx + y into g(x)h(y)g(x) \cdot h(y). For equations like this, we need other techniques: integrating factors, variation of parameters, series methods. These appear in later chapters.

Another example is dydx=sin(x+y)\frac{dy}{dx} = \sin(x + y). The argument x+yx + y inside the sine mixes the two variables in a way that cannot be separated. The presence of x+yx + y rather than xyx \cdot y is the telltale sign.

The good news is that separable equations are common in applications. Population growth, radioactive decay, cooling processes, and many other phenomena naturally produce separable equations. Recognizing when an equation is separable is the first step to solving it.

The Complete Algorithm

Here is the method in summary:

  1. Check separability: Can you write dydx=g(x)h(y)\frac{dy}{dx} = g(x) \cdot h(y)?

  2. Separate: Rearrange to 1h(y)dy=g(x)dx\frac{1}{h(y)}\, dy = g(x)\, dx

  3. Integrate: Compute 1h(y)dy=g(x)dx+C\int \frac{1}{h(y)}\, dy = \int g(x)\, dx + C

  4. Solve for y: If possible, express yy explicitly as a function of xx

  5. Apply initial conditions: If given y(x0)=y0y(x_0) = y_0, substitute to find CC

The technique is mechanical once you recognize it. The art lies in recognizing separable structure and handling the integrals that arise.

A Note on Lost Solutions

When we divided by h(y)h(y) during separation, we assumed h(y)0h(y) \neq 0. But what if h(y0)=0h(y_0) = 0 for some value y0y_0? Then y=y0y = y_0 might be a solution that we lose in the division process.

For example, in dydx=xy\frac{dy}{dx} = xy, we divided by yy. But y=0y = 0 is actually a solution: if y=0y = 0 everywhere, then dydx=0=x0\frac{dy}{dx} = 0 = x \cdot 0. This constant solution corresponds to C=0C = 0 in our general solution y=Cex2/2y = Ce^{x^2/2}, so we did not lose it. But in other cases, you should check whether h(y)=0h(y) = 0 gives additional solutions.

Key Takeaways

  • A differential equation is separable if it has the form dydx=g(x)h(y)\frac{dy}{dx} = g(x) \cdot h(y)
  • Separation rewrites the equation with all yy terms on one side and all xx terms on the other
  • Treating dydx\frac{dy}{dx} as a fraction is justified by the chain rule
  • Integrating both sides produces a general solution with one arbitrary constant
  • Initial conditions determine the specific value of the constant
  • Not all equations are separable, which motivates learning additional techniques
  • Watch for solutions lost when dividing by h(y)h(y): check if h(y)=0h(y) = 0 gives constant solutions