First Order Equations: Separation of Variables

Edmund Chiang
MATH2351 / 2352 — Boyce & DiPrima §2.2
February 6, 2026

1   Separable Linear First Order ODEs

We considered examples of linear first order differential equations of the form

$$\frac{dy}{dx} = ay + b$$

in the Introduction. These can be solved by the method of separation of variables. We now consider more general first order equations

$$\frac{dy}{dx} = f(x, y)$$

for some $f$ such that they can be rearranged into a "separated form."

1.1   The Separation Theorem

Theorem — Separation of Variables

Suppose

$$M(x) + N(y)\frac{dy}{dx} = 0$$

such that

$$H_1'(x) = M(x), \qquad H_2'(y) = N(y).$$

Then

$$H_1(x) + H_2(y) = c,$$

for some constant $c$.

Proof. If we have such a first order DE, then \begin{align} 0 &= M(x) + N(y)\frac{dy}{dx} = H_1'(x) + H_2'(y)\frac{dy}{dx} \\[6pt] &= \frac{d}{dx}H_1(x) + \frac{d}{dx}H_2(y) \\[6pt] &= \frac{d}{dx}\big(H_1(x) + H_2(y)\big) \end{align}

where we have applied the Chain rule in the last computation:

$$\frac{d}{dx}H_2(y) = H_2'(y)\frac{dy}{dx}.$$

Hence

$$H_1(x) + H_2(y) = c.$$

The above is a solution to the separable DE in the implicit form. It is generally rare that one can solve $y$ as a function of $x$ only.

Remark — Differential Notation

We also write the separated DE in the form

$$\boxed{M(x)\,dx + N(y)\,dy = 0,}$$

and hence here is where the origin of the method of separation of variables. The next step corresponds to

$$\int M(x)\,dx = -\int N(y)\,dy,$$

or

$$H_1(x) + H_2(y) = c.$$

1.2   Example: $\dfrac{dy}{dx} = \dfrac{x^2}{1 - y^2}$

Solve $\;\displaystyle\frac{dy}{dx} = \frac{x^2}{1 - y^2}.$

We rearrange the DE into the form

$$-x^2 + (1 - y^2)\frac{dy}{dx} = 0.$$

So according to our earlier derivation there are $H_1(x)$ and $H_2(y)$ such that $H_1'(x) = -x^2$ and $H_2'(y) = (1 - y^2)$. Thus

\begin{align} 0 &= -x^2 + (1 - y^2)\frac{dy}{dx} \\[6pt] &= \frac{d}{dx}\Big(-\frac{x^3}{3} + y - \frac{y^3}{3}\Big) = 0. \end{align}

Hence

$$-x^3 + 3y - y^3 = c,$$

for some constant $c$.

Remark

We note that it would be too complicated to express $y$ in terms of $x$ only in the above solution. The solution remains in implicit form.


1.3   Example IVP: $\dfrac{dy}{dx} = \dfrac{3x^2 + 4x + 2}{2(y-1)}$, $\;y(0) = -1$

Solve the IVP $\;\displaystyle\frac{dy}{dx} = \frac{3x^2 + 4x + 2}{2(y-1)}, \quad y(0) = -1.$

We could write

$$-(3x^2 + 4x + 2) + 2(y - 1)\frac{dy}{dx} = 0 \tag{1}$$

and proceed as in the above example:

$$\frac{d}{dx}\Big(-(x^3 + 2x^2 + 2x) + \frac{(y-1)^2}{2}\Big) = 0.$$

Or we simply "separate" the variables of (1) into the form

$$\int 3x^2 + 4x + 2\,dx = \int 2(y - 1)\,dy.$$

This yields

$$x^3 + 2x^2 + 2x = (y - 1)^2 + c$$

for some constant $c$. Substitute the initial condition $y(0) = -1$ yields

$$0 = (-1 - 1)^2 + c,$$

so that $c = -4$. That is,

$$(y - 1)^2 = x^3 + 2x^2 + 2x + 4,$$

or, in this exceptional case,

$$y(x) = 1 \pm \sqrt{x^3 + 2x^2 + 2x + 4}.$$

But only the

$$y(x) = 1 - \sqrt{x^3 + 2x^2 + 2x + 4}$$

would fulfill the initial condition $y(0) = -1$ and in which case the curve passes through the point $(-2, 1)$ (but $y'(-2, 1)$ is undefined).

Direction Field

The direction field for this IVP shows the solution curve passing through $(0, -1)$ with a cusp at $(-2, 1)$ where the derivative becomes undefined. The solution exists for $x > -2$.


1.4   Example IVP: $\dfrac{dy}{dx} = \dfrac{4x - x^3}{4 + y^3}$, $\;y(0) = 1$

Solve $\;\displaystyle\frac{dy}{dx} = \frac{4x - x^3}{4 + y^3}, \quad y(0) = 1.$

We compute directly,

$$\int (4x - x^3)\,dx = \int (4 + y^3)\,dy.$$

Then

$$2x^2 - \frac{x^4}{4} = 4y + \frac{y^4}{4} + c,$$

or

$$y^4 + 16y + x^4 - 8x^2 + c = 0.$$

Substituting $y(0) = 1$ yields

$$y^4 + 16y + x^4 - 8x^2 - 17 = 0.$$

Can you draw the curve that passes through $y(0) = 1$? We further note that $\dfrac{dy}{dx}$ is undefined when $y^3 + 4 = 0$, that is $y = (-4)^{1/3} \approx -1.5874$. So the corresponding $y$ coordinates can be computed numerically from

$$y^4 + 16y + x^4 - 8x^2 - 17 = 0$$

and are

$$(-3.348, -1.5874), \quad (3.348, -1.5874).$$

2   Homogeneous Equations

2.1   Definition

Definition — Homogeneous Function

A function $f(x, y)$ is said to be homogeneous of degree $n$ if

$$f(\lambda x, \lambda y) = \lambda^n f(x, y), \qquad \lambda \in \mathbb{C}.$$

2.2   Examples of Homogeneity

Example 1. Consider $f(x, y) = x^3 - x^2 y$. Then

$$f(\lambda x, \lambda y) = \lambda^3 x^3 - (\lambda^2 x^2)\lambda y = \lambda^3(x^3 - x^2 y) = \lambda^3 f(x, y).$$

So $f$ is a homogeneous function of degree 3.


Example 2. Consider $f(x, y) = e^{2x/y} + \sin \dfrac{y}{x}$. Then

$$f(\lambda x, \lambda y) = e^{2\lambda x/(\lambda y)} + \sin \frac{\lambda y}{\lambda x} = e^{2x/y} + \sin \frac{y}{x} = \lambda^0 f(x, y).$$

So $f$ is a homogeneous function of degree 0.


Example 3. Consider $f(x, y) = y^2 + \sin y \sin x$. Then

$$f(\lambda x, \lambda y) = \lambda^2 y^2 + \sin \lambda y \sin \lambda x \neq \lambda^n f(x, y)$$

for any integer $n$. So $f$ is not homogeneous.


2.3   Solving Homogeneous DEs via $y = vx$

Example. Solve $\;x^3 + y^3 = 3xy^2\dfrac{dy}{dx}.$

Note that $M(x, y) = x^3 + y^3$ and $N(x, y) = 3xy^2$ are both homogeneous functions of degree 3. Substitute $y = vx$ and $dy = v\,dx + x\,dv$ into the DE yields

$$(1 - 2v^3)\,dx - 3v^2 x\,dv = 0,$$

or

$$\frac{3v^2}{1 - 2v^3}\,dv = \frac{dx}{x}.$$

Integrating both sides yields

$$-\frac{1}{2}\ln|1 - 2v^3| = \ln|x| + c_1$$ $$\ln|1 - 2v^3| = -2\ln|x| + c_2$$ $$|1 - 2v^3| = \frac{C}{x^2}$$

Thus

$$C = x^2(1 - 2v^3) = x^2\Big(1 - 2\frac{y^3}{x^3}\Big) = x^2 - \frac{2y^3}{x}.$$

2.4   General Theorem for Homogeneous DEs

Theorem — Reduction to Separable Form

Suppose $M(x, y)$ and $N(x, y)$ are both homogeneous of degree $n$. Then the differential equation

$$M(x, y)\,dx + N(x, y)\,dy = 0$$

can be transformed into a first order separable differential equation.

Proof. Let $y = vx$. Then $$0 = M(x, y)\,dx + N(x, y)\,dy = x^n\big(M_1(x/y)\,dx + N_1(x/y)\,dy\big)$$

where

$$M_1(x/y) = M(1, y/x), \qquad N_1(x/y) = N(1, y/x).$$

Since $y = vx$ so that $dy = v\,dx + x\,dv$. Thus the above DE can be re-written as

$$M_1(v)\,dx + N_1(v)(v\,dx + x\,dv) = 0,$$

which can be written into a separable form

$$\frac{dx}{x} + \frac{N_1(v)\,dv}{M_1(v) + vN_1(v)} = 0.$$

3   Exercises

Exercises — Separation of Variables
  1. $y' = x^2/y$ (Ans. $3y^2 - 2x^3 = c,\; y \neq 0$)
  2. $y' = x^2/y(1 + x^3)$ (Ans. $3y^2 - 2\ln|1 + x^3| = c,\; x \neq -1,\; y \neq 0$)
  3. $x' = \sqrt{1 - y^2}$ (Ans. $\sin(\ln x + c)$ if $x \neq 0^-$ and $|y| < 1$; $y = \pm 1$)
  4. $y' = (x - e^{-x})/(y + e^y)$ (Ans. $y^2 - x^2 + 2(e^y - e^{-x}) = c,\; y + e^y \neq 0$)
  5. $x\,dy - y\,dx - \sqrt{x^2 - y^2}\,dx = 0$ (Ans. $Cx = e^{\sin^{-1} y/x}$)
  6. $(2x + 3y)\,dx + (y - x)\,dy = 0$ (Ans. $\ln(y^2 + 2xy + 2x^2) - 4\tan^{-1}\frac{x+y}{x} = C$)
  7. $(1 + 2e^{x/y})\,dx + 2e^{x/y}(1 - x/y)\,dy = 0$ (Ans. $x + 2ye^{x/y} = C$)
Exercises — Initial Value Problems

In each of the following problems, solve the initial value problem, plot a graph and determine the interval in which the solution is defined.

  1. $y' = (1 - 2x)y^2,\; y(0) = -1/6$ (Ans. $y = (x^2 - x - 6)^{-1},\; -2 < x < 3$)
  2. $x\,dx + ye^{-y}\,dy = 0,\; y(0) = 1$ (Ans. $y = \sqrt{2(1-x)e^x - 1},\; -1.68 < x < 0.77$ approx.)
  3. $y' = 2x/(1 + 2y),\; y(2) = 0$ (Ans. $y = -\frac{1}{2} + \frac{1}{2}\sqrt{4x^2 - 15},\; x > \frac{1}{2}\sqrt{15}$)

4   Practice MCQ

Practice 1: Solve a Separable DE (Three-Phase Approach)

Given the differential equation:

$$\frac{dy}{dx} = \frac{x^2}{1 - y^2}$$
PHASE 0 Classify the DE

What method should we use to solve this DE?

Method identified! Now let's plan the strategy...
PHASE A Build the Strategy

What's the first step?

Good. Now what's the next step?

What do we do with the integration results?

Strategy complete! Now let's execute each step...
PHASE B Execute the Computation
Step B1

Rearranging $\dfrac{dy}{dx} = \dfrac{x^2}{1-y^2}$ into separated form, what is $M(x)$?

Step B2

What is $N(y)$?

Step B3

$\displaystyle\int M(x)\,dx = \int -x^2\,dx = H_1(x) = \;?$

Step B4

$\displaystyle\int N(y)\,dy = \int (1 - y^2)\,dy = H_2(y) = \;?$

Step B5

Final implicit solution $H_1(x) + H_2(y) = c$:

All phases complete — excellent work! You've successfully solved the separable DE.
Practice 2: Identify Homogeneous Functions

For each function, determine if it is homogeneous and find its degree.

Function A

$f(x, y) = x^3 - x^2 y$. Is this homogeneous? If so, what degree?

Function B

$f(x, y) = e^{2x/y} + \sin \dfrac{y}{x}$. Is this homogeneous? If so, what degree?

Function C

$f(x, y) = y^2 + \sin y \sin x$. Is this homogeneous?

All functions classified correctly!
Practice 3: Solve a Homogeneous DE (Three-Phase Approach)

Given the differential equation:

$$x^3 + y^3 = 3xy^2\frac{dy}{dx}$$
PHASE 0 Classify the DE

What method should we use to solve this DE?

Correct! Both terms are homogeneous of degree 3. Now let's plan...
PHASE A Build the Strategy

What's the first step?

After confirming homogeneity, what's next?

After substituting, what should happen?

After solving for $v$, what's the final step?

Strategy complete! Now let's compute...
PHASE B Execute the Computation
Step B1

Rewrite in the form $M\,dx + N\,dy = 0$. With $M = x^3 + y^3$ and $N = -3xy^2$, substitute $y = vx$:

$(x^3 + v^3 x^3)\,dx + (-3x \cdot v^2 x^2)(v\,dx + x\,dv) = 0$

Simplify to get:

Step B2

Separate variables from $(1 - 2v^3)\,dx = 3v^2 x\,dv$:

Step B3

Integrate $\displaystyle\int \dfrac{3v^2}{1 - 2v^3}\,dv$. (Hint: use substitution $u = 1 - 2v^3$)

Step B4

From $\ln|x| = -\frac{1}{2}\ln|1 - 2v^3| + c_1$, solve for the relationship and substitute $v = y/x$:

Excellent! You've successfully solved the homogeneous DE using the $y = vx$ substitution.
Practice 4: Solve an Initial Value Problem

Solve the IVP:

$$\frac{dy}{dx} = \frac{3x^2 + 4x + 2}{2(y-1)}, \quad y(0) = -1$$
PHASE 0 Classify the DE

What type of DE is this? What method should we use?

Correct! Now let's solve it step by step...
PHASE A IVP Strategy

First step for a separable IVP?

After finding the general solution with constant $c$, what's next?

If the solution involves $y = 1 \pm \sqrt{\cdots}$, how do we choose the sign?

Strategy set! Let's compute...
PHASE B Execute
Step B1

Separate and integrate: $\displaystyle\int 2(y-1)\,dy = \int (3x^2 + 4x + 2)\,dx$. Result:

Step B2

Apply $y(0) = -1$: $((-1)-1)^2 = 0 + 0 + 0 + c$. What is $c$?

Step B3

So $(y-1)^2 = x^3 + 2x^2 + 2x + 4$, giving $y = 1 \pm \sqrt{x^3 + 2x^2 + 2x + 4}$. Which sign?

Well done! The solution is $y = 1 - \sqrt{x^3 + 2x^2 + 2x + 4}$ with $y(0) = -1$.

— End of Separation of Variables Notes —