Logo
Lecture 2

Lecture 2

Chara Chara
January 8, 2026
3 min read
index

Lecture 2: First-Order ODEs

Separable ODEs

Definition (Separable ODE)

A first-order ODE dydx=F(x,y)\dfrac{dy}{dx} = F(x, y) is separable if we can rewrite it as

F(x,y)=M(x)N(y)dydx=M(x)N(y).F(x, y) = \frac{M(x)}{N(y)} \qquad\Longleftrightarrow\qquad \frac{dy}{dx} = \frac{M(x)}{N(y)}.

Then all yy-terms live on one side and all xx-terms on the other.

Here F(x,y)F(x, y) depends on both variables, but factoring it as M(x)/N(y)M(x)/N(y) lets us integrate each side independently.

Warm-up: direct integration

For y(x)=3x2y'(x) = 3x^2,

dy=3x2dxy(x)=x3+C.\int dy = \int 3x^2\, dx \quad\Longrightarrow\quad y(x) = x^3 + C.

Exponential example

For y=yy' = y we separate variables:

dyy=dxlny=x+Cy(x)=Cex.\frac{dy}{y} = dx \quad\Longrightarrow\quad \ln|y| = x + C \quad\Longrightarrow\quad y(x) = C e^{x}.

Example with an initial value

Consider y=xyy' = \dfrac{x}{y}.

ydy=xdx12y2=12x2+Cy2=x2+C.y\, dy = x\, dx \quad\Rightarrow\quad \tfrac12 y^2 = \tfrac12 x^2 + C \quad\Rightarrow\quad y^2 = x^2 + C.

With y(5)=4y(5) = -4 we get 4=±25+C-4 = \pm\sqrt{25 + C}, so C=9C = -9 and y(x)=x29y(x) = -\sqrt{x^2 - 9}.

Warning (Picking the right branch)

Because y2=x29y^2 = x^2 - 9, the solution is defined only when x3|x| \ge 3. The initial value x=5x = 5 forces us to stay on the interval x>3x > 3 and to take the negative branch.

Tip (Recipe for separable ODEs)

Rewrite as N(y)dy=M(x)dxN(y)\, dy = M(x)\, dx, integrate both sides, and (if possible) solve for y(x)y(x). Initial conditions pick the constant and the correct sign/interval.

Which equations are separable?

  • y=xy2x+4y8=(x+4)(y2)y' = xy - 2x + 4y - 8 = (x + 4)(y - 2) is separable: dyy2=(x+4)dx\dfrac{dy}{y - 2} = (x + 4)\, dx.
  • y=y2+2xy+x2=(x+y)2y' = y^2 + 2xy + x^2 = (x + y)^2 is not separable directly, but with v=x+yv = x + y we get v=v2+1v' = v^2 + 1, which is separable: arctanv=x+C\arctan v = x + C, so y(x)=tan(x+C)xy(x) = \tan(x + C) - x.
  • y2y=x2e2xy' - 2y = x^2 e^{2x} looks “almost” separated, but it is not separable. It is linear, so we use integrating factors.

First-Order Linear ODEs

A first-order ODE is linear if it has the form

y+p(x)y=q(x).y' + p(x)\, y = q(x).

These need not be separable, but they all yield to the integrating factor method.

Definition (Integrating factor)

Pick μ(x)=ep(x)dx\mu(x) = e^{\int p(x)\, dx}. Then

μ(x)y+μ(x)p(x)y=μ(x)q(x)\mu(x) y' + \mu(x) p(x) y = \mu(x) q(x)

collapses to (μ(x)y(x))=μ(x)q(x)(\mu(x) y(x))' = \mu(x) q(x), so

y(x)=1μ(x)[μ(x)q(x)dx+C].y(x) = \frac{1}{\mu(x)}\left[\int \mu(x) q(x)\, dx + C\right].

Example — y2y=x2e2xy' - 2y = x^2 e^{2x}

p(x)=2p(x) = -2, q(x)=x2e2xq(x) = x^2 e^{2x}, so μ(x)=e2x\mu(x) = e^{-2x}.

(e2xy)=x2e2xy=13x3+Cy(x)=13x3+Ce2x.(e^{-2x} y)' = x^2 \quad\Longrightarrow\quad e^{-2x} y = \tfrac13 x^3 + C \quad\Longrightarrow\quad y(x) = \tfrac13 x^3 + C e^{2x}.

Quick summaries

Definition (Separable ODE takeaway)

If dydx=M(x)N(y)\dfrac{dy}{dx} = \dfrac{M(x)}{N(y)}, rewrite as N(y)dy=M(x)dxN(y)\, dy = M(x)\, dx and integrate: N(y)dy=M(x)dx+C\displaystyle \int N(y)\, dy = \int M(x)\, dx + C.

Definition (Linear ODE takeaway)

For y+p(x)y=q(x)y' + p(x) y = q(x), μ(x)=ep(x)dx\mu(x) = e^{\int p(x)\, dx} and

y(x)=1μ(x)[μ(x)q(x)dx+C].y(x) = \frac{1}{\mu(x)}\left[\int \mu(x) q(x)\, dx + C\right].

Two integrals and one constant finish the job.