Skip to content

First-Order ODEs

2.1 Separable Equations

A first-order ODE dydx=f(x,y)\frac{dy}{dx} = f(x, y) is separable if f(x,y)=g(x)h(y)f(x, y) = g(x)h(y).

dydx=g(x)h(y)    dyh(y)=g(x)dx\frac{dy}{dx} = g(x)h(y) \implies \frac{dy}{h(y)} = g(x)\, dx

Integrating both sides: dyh(y)=g(x)dx+C\int \frac{dy}{h(y)} = \int g(x)\, dx + C.

Example. Solve dydx=xy\frac{dy}{dx} = xy.

Separating: dyy=xdx\frac{dy}{y} = x\, dx. Integrating: lny=x22+C\ln|y| = \frac{x^2}{2} + C. Thus y=Cex2/2y = Ce^{x^2/2} where C0C \neq 0Plus the trivial solution y=0y = 0.

2.2 Linear First-Order Equations

A linear first-order ODE has the form

dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x)

Theorem 2.1 (Integrating Factor). The solution is

y(x)=eP(x)dx(Q(x)eP(x)dxdx+C)y(x) = e^{-\int P(x)\, dx}\left(\int Q(x) e^{\int P(x)\, dx}\, dx + C\right)

Proof. Multiply both sides by μ(x)=eP(x)dx\mu(x) = e^{\int P(x)\, dx}:

ddx(μy)=μdydx+μPy=μdydx+μ"y=μ(dydx+Py)=μQ\frac{d}{dx}(\mu y) = \mu \frac{dy}{dx} + \mu P y = \mu \frac{dy}{dx} + \mu" y = \mu\left(\frac{dy}{dx} + Py\right) = \mu Q

Integrating: μy=μQdx+C\mu y = \int \mu Q\, dx + C. Solving for yy gives the result. \blacksquare

2.3 Worked Example: Linear Equation

Problem. Solve y+2xy=x2y' + \frac{2}{x}y = x^2 for x>0x > 0.

Solution. P(x)=2/xP(x) = 2/x, Q(x)=x2Q(x) = x^2.

μ(x)=e2/xdx=e2lnx=x2\mu(x) = e^{\int 2/x\, dx} = e^{2\ln x} = x^2.

y=x2(x2x2dx+C)=x2(x55+C)=x35+Cx2y = x^{-2}\left(\int x^2 \cdot x^2\, dx + C\right) = x^{-2}\left(\frac{x^5}{5} + C\right) = \frac{x^3}{5} + \frac{C}{x^2}. \blacksquare

2.4 Exact Equations

The ODE M(x,y)dx+N(x,y)dy=0M(x, y)\, dx + N(x, y)\, dy = 0 is exact if My=Nx\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}.

When exact, there exists Ψ(x,y)\Psi(x, y) such that Ψx=M\frac{\partial \Psi}{\partial x} = M and Ψy=N\frac{\partial \Psi}{\partial y} = NAnd the solution is Ψ(x,y)=C\Psi(x, y) = C.

Theorem 2.2. If MM and NN have continuous partial derivatives on a connected domain DDThen Mdx+Ndy=0M\, dx + N\, dy = 0 is exact if and only if My=NxM_y = N_x.

Proof. If exact, M=ΨxM = \Psi_x and N=ΨyN = \Psi_ySo My=Ψxy=Ψyx=NxM_y = \Psi_{xy} = \Psi_{yx} = N_x by Clairaut. Conversely, if My=NxM_y = N_xDefine Ψ(x,y)=x0xM(t,y)dt+y0yN(x0,s)ds\Psi(x, y) = \int_{x_0}^x M(t, y)\, dt + \int_{y_0}^y N(x_0, s)\, ds. Then Ψx=M(x,y)\Psi_x = M(x, y) and Ψy=x0xMy(t,y)dt+N(x0,y)=x0xNx(t,y)dt+N(x0,y)=N(x,y)N(x0,y)+N(x0,y)=N(x,y)\Psi_y = \int_{x_0}^x M_y(t, y)\, dt + N(x_0, y) = \int_{x_0}^x N_x(t, y)\, dt + N(x_0, y) = N(x, y) - N(x_0, y) + N(x_0, y) = N(x, y). \blacksquare

2.5 Worked Example: Exact Equation

Problem. Solve (2xy+3)dx+(x21)dy=0(2xy + 3)\, dx + (x^2 - 1)\, dy = 0.

Solution. M=2xy+3M = 2xy + 3, N=x21N = x^2 - 1. Check: My=2x=NxM_y = 2x = N_x. Exact.

Ψx=2xy+3    Ψ=x2y+3x+h(y)\Psi_x = 2xy + 3 \implies \Psi = x^2 y + 3x + h(y).

Ψy=x2+h(y)=x21    h(y)=1    h(y)=y\Psi_y = x^2 + h'(y) = x^2 - 1 \implies h'(y) = -1 \implies h(y) = -y.

Solution: x2y+3xy=Cx^2 y + 3x - y = C. \blacksquare

2.6 Integrating Factors for Non-Exact Equations

If MyNxM_y \neq N_xOne can sometimes find an integrating factor μ(x,y)\mu(x, y) such that (μM)y=(μN)x(\mu M)_y = (\mu N)_x.

Case 1: If MyNxN\frac{M_y - N_x}{N} depends only on xxThen μ(x)=eMyNxNdx\mu(x) = e^{\int \frac{M_y - N_x}{N}\, dx}.

Case 2: If NxMyM\frac{N_x - M_y}{M} depends only on yyThen μ(y)=eNxMyMdy\mu(y) = e^{\int \frac{N_x - M_y}{M}\, dy}.

2.7 Bernoulli Equations

A Bernoulli equation has the form

dydx+P(x)y=Q(x)yn\frac{dy}{dx} + P(x)y = Q(x)y^n

Where n0,1n \neq 0, 1. The substitution v=y1nv = y^{1-n} transforms it into a linear equation:

dvdx+(1n)P(x)v=(1n)Q(x)\frac{dv}{dx} + (1 - n)P(x)v = (1 - n)Q(x)

Example. Solve y+y=y2exy' + y = y^2 e^x.

Here n=2n = 2So set v=y1v = y^{-1}. Then v=y2yv' = -y^{-2}y'And the equation becomes vv=exv' - v = -e^x. Integrating factor: exe^{-x}. So (vex)=1(v e^{-x})' = -1Giving vex=x+Cve^{-x} = -x + C, v=xex+Cexv = -xe^x + Ce^x And y=1/(Cx)exy = 1/(C - x)e^x.

2.8 Existence and Uniqueness

Theorem 2.3 (Picard-Lindelöf). If ff and f/y\partial f/\partial y are continuous on a rectangle Containing (x0,y0)(x_0, y_0)Then the IVP y=f(x,y)y' = f(x, y), y(x0)=y0y(x_0) = y_0 has a unique solution in some Neighbourhood of x0x_0.

2.9 Substitution Methods

Several substitutions reduce specific equations to separable or linear form:

  1. Homogeneous equations: y=f(y/x)y' = f(y/x). Set v=y/xv = y/x.
  2. Equations of the form y=f(ax+by+c)y' = f(ax + by + c): set v=ax+by+cv = ax + by + c.

2.10 Homogeneous Equations

An ODE of the form dydx=F(yx)\frac{dy}{dx} = F\left(\frac{y}{x}\right) is called homogeneous (not to be Confused with the linearity sense). The substitution v=y/xv = y/xI.e., y=vxy = vxGives y=v+xvy' = v + xv' So the equation becomes:

v+xdvdx=F(v)    xdvdx=F(v)vv + x\frac{dv}{dx} = F(v) \implies x\frac{dv}{dx} = F(v) - v

This is separable: dvF(v)v=dxx\frac{dv}{F(v) - v} = \frac{dx}{x}.

2.11 Worked Example: Homogeneous Equation

Problem. Solve y=x2+y2xyy' = \frac{x^2 + y^2}{xy}.

Solution

Solution. Rewrite as y=1+(y/x)2y/xy' = \frac{1 + (y/x)^2}{y/x}. This is homogeneous with F(v)=1+v2vF(v) = \frac{1 + v^2}{v}.

Set y=vxy = vx: v+xv=1+v2v=v+1vv + xv' = \frac{1 + v^2}{v} = v + \frac{1}{v}.

So xv=1vxv' = \frac{1}{v}Giving vdv=dxxv\, dv = \frac{dx}{x}.

Integrating: v22=lnx+C\frac{v^2}{2} = \ln|x| + C. Since v=y/xv = y/x:

y22x2=lnx+C    y2=2x2(lnx+C)\frac{y^2}{2x^2} = \ln|x| + C \implies y^2 = 2x^2(\ln|x| + C). \blacksquare

2.12 Riccati Equations

A Riccati equation has the form

dydx=q0(x)+q1(x)y+q2(x)y2\frac{dy}{dx} = q_0(x) + q_1(x)y + q_2(x)y^2

If a particular solution y1(x)y_1(x) is known, the substitution y=y1+1vy = y_1 + \frac{1}{v} reduces the Riccati equation to a linear first-order equation in vv:

dvdx=(q1+2q2y1)vq2\frac{dv}{dx} = -(q_1 + 2q_2 y_1)v - q_2

Example. Solve y=1+x22xy+y2y' = 1 + x^2 - 2xy + y^2 given that y1=xy_1 = x is a particular solution.

Substituting y=x+1/vy = x + 1/v: y=1v/v2y' = 1 - v'/v^2. The equation becomes

1v/v2=1+x22x(x+1/v)+(x+1/v)21 - v'/v^2 = 1 + x^2 - 2x(x + 1/v) + (x + 1/v)^2

1v/v2=1+x22x22x/v+x2+2x/v+1/v21 - v'/v^2 = 1 + x^2 - 2x^2 - 2x/v + x^2 + 2x/v + 1/v^2

1v/v2=1+1/v21 - v'/v^2 = 1 + 1/v^2

v/v2=1/v2    v=1-v'/v^2 = 1/v^2 \implies v' = -1

So v=x+Cv = -x + CAnd y=x+1Cxy = x + \frac{1}{C - x}.

2.13 Worked Example: Newton’s Law of Cooling

Problem. A body at 90°C90\degree\mathrm{C} is placed in a room at 20°C20\degree\mathrm{C}. After 10 Minutes, its temperature is 60°C60\degree\mathrm{C}. When will it reach 30°C30\degree\mathrm{C}?

Solution

Solution. Newton’s law of cooling: dTdt=k(T20)\frac{dT}{dt} = -k(T - 20), T(0)=90T(0) = 90.

This is separable: dTT20=kdt\frac{dT}{T - 20} = -k\, dt.

ln(T20)=kt+C    T=20+Cekt\ln(T - 20) = -kt + C \implies T = 20 + Ce^{-kt}.

T(0)=90    C=70T(0) = 90 \implies C = 70So T=20+70ektT = 20 + 70e^{-kt}.

T(10)=60    60=20+70e10k    e10k=4/7T(10) = 60 \implies 60 = 20 + 70e^{-10k} \implies e^{-10k} = 4/7.

k=110ln(4/7)=ln(7/4)10k = -\frac{1}{10}\ln(4/7) = \frac{\ln(7/4)}{10}.

For T=30T = 30: 30=20+70ekt    ekt=1/7    t=ln7k=10ln7ln(7/4)30 = 20 + 70e^{-kt} \implies e^{-kt} = 1/7 \implies t = \frac{\ln 7}{k} = \frac{10 \ln 7}{\ln(7/4)}.

Numerically: t101.9460.559634.8t \approx \frac{10 \cdot 1.946}{0.5596} \approx 34.8 minutes. \blacksquare

2.14 Worked Example: Mixing Problem

Problem. A tank contains 100 L of brine with 20 kg of salt. Fresh water enters at 3 L/min and The mixture leaves at 3 L/min. Find the amount of salt after 30 minutes.

Solution

Solution. Let Q(t)Q(t) be the amount of salt (kg) at time tt (min).

Rate of change: dQdt=rate  inrate  out=03Q100\frac{dQ}{dt} = \mathrm{rate}\; in - \mathrm{rate}\; out = 0 - 3 \cdot \frac{Q}{100}.

dQdt=3Q100\frac{dQ}{dt} = -\frac{3Q}{100}, Q(0)=20Q(0) = 20.

This is separable: dQQ=3100dt\frac{dQ}{Q} = -\frac{3}{100}\, dt.

lnQ=3t100+C    Q=Ce3t/100\ln Q = -\frac{3t}{100} + C \implies Q = Ce^{-3t/100}.

Q(0)=20    Q=20e3t/100Q(0) = 20 \implies Q = 20e^{-3t/100}.

At t=30t = 30: Q(30)=20e0.9200.40668.13Q(30) = 20e^{-0.9} \approx 20 \cdot 0.4066 \approx 8.13 kg. \blacksquare

2.15 Worked Example: Integrating Factor

Problem. Solve (3xy+2y2)dx+(x2+2xy)dy=0(3xy + 2y^2)\, dx + (x^2 + 2xy)\, dy = 0.

Solution

Solution. M=3xy+2y2M = 3xy + 2y^2, N=x2+2xyN = x^2 + 2xy.

My=3x+4yM_y = 3x + 4y, Nx=2x+2yN_x = 2x + 2y. Since MyNxM_y \neq N_xNot exact.

Check Case 1: MyNxN=x+2yx2+2xy=x+2yx(x+2y)=1x\frac{M_y - N_x}{N} = \frac{x + 2y}{x^2 + 2xy} = \frac{x + 2y}{x(x + 2y)} = \frac{1}{x}.

This depends only on xxSo μ(x)=e1/xdx=x\mu(x) = e^{\int 1/x\, dx} = x.

Multiply: (3x2y+2xy2)dx+(x3+2x2y)dy=0(3x^2y + 2xy^2)\, dx + (x^3 + 2x^2y)\, dy = 0.

M~=3x2y+2xy2\tilde{M} = 3x^2y + 2xy^2, N~=x3+2x2y\tilde{N} = x^3 + 2x^2y.

M~y=3x2+4xy=N~x\tilde{M}_y = 3x^2 + 4xy = \tilde{N}_x. Now exact.

Ψx=3x2y+2xy2    Ψ=x3y+x2y2+h(y)\Psi_x = 3x^2y + 2xy^2 \implies \Psi = x^3y + x^2y^2 + h(y).

Ψy=x3+2x2y+h(y)=x3+2x2y    h(y)=0    h(y)=0\Psi_y = x^3 + 2x^2y + h'(y) = x^3 + 2x^2y \implies h'(y) = 0 \implies h(y) = 0.

Solution: x3y+x2y2=Cx^3y + x^2y^2 = C. \blacksquare

2.16 Orthogonal Trajectories

Given a one-parameter family of curves F(x,y,C)=0F(x, y, C) = 0The orthogonal trajectories are curves That intersect every member of the family at right angles. To find them:

  1. Find the differential equation dydx=f(x,y)\frac{dy}{dx} = f(x, y) of the given family.
  2. Replace dydx\frac{dy}{dx} with dxdy-\frac{dx}{dy} (equivalently, negate the slope).
  3. Solve the new ODE.

Example. Find the orthogonal trajectories of y=Cx2y = Cx^2.

dydx=2Cx=2yx\frac{dy}{dx} = 2Cx = \frac{2y}{x}.

Orthogonal trajectories satisfy dydx=x2y\frac{dy}{dx} = -\frac{x}{2y}.

Separating: 2ydy=xdx2y\, dy = -x\, dx. Integrating: y2=x22+Cy^2 = -\frac{x^2}{2} + COr x22+y2=C\frac{x^2}{2} + y^2 = C. These are ellipses.

2.17 Common Pitfalls for First-Order ODEs

:::caution Common Pitfall When separating variables, dividing by h(y)h(y) can lose solutions where h(y)=0h(y) = 0. Always check whether h(y)=0h(y) = 0 yields valid solutions before dividing.

::: :::caution Common Pitfall Not every first-order ODE falls into a standard category. Equations like y=ex2+sin(y2)y' = e^{x^2} + \sin(y^2) cannot be solved by elementary methods and require numerical Techniques.

:::