← Back to modules

Differential Equations

Solve basic differential equations and interpret models.

A differential equation (DE) is any equation that involves a function and its derivatives. Solving a DE means finding the function itself. This is the reverse of what you've been doing: instead of 'given ff, find ff'', now it's 'given a relationship involving ff' (and maybe ff''), find ff'.

Differential equations model nearly everything that changes: population growth, radioactive decay, temperature cooling, spring motion, electrical circuits, and fluid flow. If something evolves over time, there's a DE behind it.

We'll start with the simplest types (separable, linear first-order) and build up to second-order equations. The key is recognizing which type you're dealing with, then applying the appropriate solution technique.

What is a differential equation?

A differential equation (DE) is any equation that relates a function y(x)y(x) to one or more of its derivatives. The unknown is the function itself — you're solving for yy, not a number.

The order of a DE is the highest derivative that appears. First-order: y=2xyy' = 2xy (involves yy' but not yy''). Second-order: y+4y=0y'' + 4y = 0 (involves yy''). Higher-order DEs exist but are less common in a first course.

A solution is a function y(x)y(x) that, when substituted into the equation, makes it true for all xx in some interval. To verify a solution, plug it in and check: does both sides of the equation agree?

The general solution contains arbitrary constants: one constant for a first-order DE, two for second-order, etc. These constants represent the 'degrees of freedom' — infinitely many functions satisfy the DE, differing only in these constants. An initial value problem (IVP) pins down these constants by specifying conditions like y(0)=3y(0) = 3.

Linear vs. nonlinear: a DE is linear if yy and its derivatives appear to the first power with no products like yyy \cdot y'. Linear DEs have well-developed solution theory; nonlinear DEs are harder and may not have closed-form solutions.

Helpful?

Direction fields (slope fields)

A direction field visualizes a first-order DE y=f(x,y)y' = f(x,y) by drawing short line segments with slope f(x,y)f(x,y) at many points (x,y)(x,y).

The solution curves must be tangent to these segments at every point. So by drawing segments, you can see the shape of solutions without solving the equation.

Direction fields build intuition: you can spot equilibrium solutions (horizontal segments), identify whether solutions grow or decay, and see the qualitative behavior before doing any algebra.

Example: for y=yy' = -y, the slopes are negative when y>0y > 0 and positive when y<0y < 0. Solutions decay toward y=0y = 0, which matches y=Cexy = Ce^{-x}.

Helpful?

Separable equations

A first-order DE is separable if it can be written as dydx=g(x)h(y)\frac{dy}{dx} = g(x) \cdot h(y), where one factor depends only on xx and the other only on yy.

To solve: separate the variables: 1h(y)dy=g(x)dx\frac{1}{h(y)}\,dy = g(x)\,dx. Then integrate both sides.

Don't forget the constant of integration! Usually written as +C+C on one side.

Example: dydx=xy\frac{dy}{dx} = xy. Separate: 1ydy=xdx\frac{1}{y}\,dy = x\,dx. Integrate: lny=x22+C\ln|y| = \frac{x^2}{2} + C. Solve: y=Aex2/2y = Ae^{x^2/2} where A=±eCA = \pm e^C.

Watch for lost solutions: when dividing by h(y)h(y), any value where h(y)=0h(y) = 0 might be a constant solution (equilibrium) that you lose in the algebra.

Helpful?

Exponential growth and decay

The DE dydt=ky\frac{dy}{dt} = ky says: the rate of change of yy is proportional to yy itself. It's separable: dyy=kdt\frac{dy}{y} = k\,dt, integrating gives lny=kt+C\ln|y| = kt + C, so y(t)=y0ekty(t) = y_0 e^{kt} where y0=y(0)y_0 = y(0).

If k>0k > 0: exponential growth. The larger yy gets, the faster it grows. Applications: population growth (early phase), compound interest, viral spread, chain reactions.

If k<0k < 0: exponential decay. The quantity shrinks at a rate proportional to its current size. Applications: radioactive decay, drug elimination from the body, cooling (simplified), depreciation.

Half-life: the time for the quantity to halve. Set y0ekt1/2=y0/2y_0 e^{kt_{1/2}} = y_0/2, giving t1/2=ln2kt_{1/2} = \frac{\ln 2}{|k|}. This is constant — it doesn't depend on the current amount. Carbon-14 has a half-life of ~5730 years regardless of how much you start with.

Doubling time: for growth (k>0k > 0), the time for the quantity to double is td=ln2kt_d = \frac{\ln 2}{k}. The 'Rule of 70': at r%r\% growth per year, the doubling time is approximately 70/r70/r years.

Helpful?

Newton's Law of Cooling

Newton's Law of Cooling states that an object's temperature changes at a rate proportional to the difference between its temperature and the surrounding (ambient) temperature: dTdt=k(TTenv)\frac{dT}{dt} = -k(T - T_{\text{env}}), where k>0k > 0.

This is separable. Let u=TTenvu = T - T_{\text{env}}, then du/dt=kudu/dt = -ku, giving u=u0ektu = u_0 e^{-kt}. Substituting back: T(t)=Tenv+(T0Tenv)ektT(t) = T_{\text{env}} + (T_0 - T_{\text{env}})e^{-kt}.

Behavior: as tt \to \infty, T(t)TenvT(t) \to T_{\text{env}}. The object approaches room temperature exponentially — quickly at first (when the temperature gap is large), then slower as it gets closer.

The constant kk depends on the object's material, surface area, and the surrounding medium (air vs. water, for instance). A larger kk means faster cooling. Determining kk usually requires two temperature readings at known times.

Applications: forensic science (estimating time of death from body temperature), cooking (how long until food cools to eating temperature), engineering (heat dissipation in electronics).

Helpful?

Linear first-order equations

Standard form: dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x). The key: this is always solvable using an integrating factor.

Integrating factor: μ(x)=eP(x)dx\mu(x) = e^{\int P(x)\,dx}.

Multiply the entire equation by μ\mu: the left side becomes ddx[μ(x)y]\frac{d}{dx}[\mu(x) \cdot y].

Integrate both sides: μ(x)y=μ(x)Q(x)dx+C\mu(x) \cdot y = \int \mu(x) Q(x)\,dx + C.

Solve for yy: y=1μ(x)[μ(x)Q(x)dx+C]y = \frac{1}{\mu(x)}\left[\int \mu(x) Q(x)\,dx + C\right].

Why it works: multiplying by μ\mu turns the left side into a perfect derivative, which can be integrated directly.

Helpful?

Logistic growth

The logistic equation models growth with a carrying capacity KK: dPdt=rP(1PK)\frac{dP}{dt} = rP\left(1 - \frac{P}{K}\right).

When PP is small compared to KK, growth is approximately exponential (rP\approx rP). As PP approaches KK, growth slows and stops.

Solution: P(t)=K1+AertP(t) = \frac{K}{1 + Ae^{-rt}} where A=KP0P0A = \frac{K - P_0}{P_0}.

The graph is an S-shaped (sigmoidal) curve. The population grows fastest at P=K/2P = K/2 (the inflection point).

Applications: population biology, spread of diseases, adoption of technology, logistic regression in machine learning.

Helpful?

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. When n=0n = 0 or n=1n = 1, the equation is already linear. For other values of nn, the yny^n term makes it nonlinear.

The clever trick: substitute v=y1nv = y^{1-n}. Then dvdx=(1n)yndydx\frac{dv}{dx} = (1-n)y^{-n}\frac{dy}{dx}. Divide the original Bernoulli equation by yny^n, and the substitution transforms it into a linear first-order equation in vv: dvdx+(1n)P(x)v=(1n)Q(x)\frac{dv}{dx} + (1-n)P(x)v = (1-n)Q(x).

Solve this linear equation using the integrating factor method from the earlier section. Once you have v(x)v(x), convert back: y=v1/(1n)y = v^{1/(1-n)}.

Example: y+y=y2y' + y = y^2 is Bernoulli with n=2n = 2. Let v=y12=y1=1/yv = y^{1-2} = y^{-1} = 1/y. Then v=y2yv' = -y^{-2}y'. Dividing by y2y^2: y2y+y1=1y^{-2}y' + y^{-1} = 1, which becomes v+v=1-v' + v = 1, or vv=1v' - v = -1. This is linear and solvable with an integrating factor.

Bernoulli equations appear in population models with harvesting, certain fluid dynamics problems, and logistics applications.

Helpful?

Second-order linear homogeneous equations

Standard form: ay+by+cy=0ay'' + by' + cy = 0 with constant coefficients.

Guess y=erxy = e^{rx}, substitute, and get the characteristic equation: ar2+br+c=0ar^2 + br + c = 0.

Case 1 - Two distinct real roots r1,r2r_1, r_2: general solution is y=C1er1x+C2er2xy = C_1 e^{r_1 x} + C_2 e^{r_2 x}.

Case 2 - Repeated root rr: general solution is y=(C1+C2x)erxy = (C_1 + C_2 x)e^{rx}. The extra xx factor accounts for the repeated root.

Case 3 - Complex roots r=α±βir = \alpha \pm \beta i: general solution is y=eαx(C1cos(βx)+C2sin(βx))y = e^{\alpha x}(C_1 \cos(\beta x) + C_2 \sin(\beta x)). This produces oscillatory behavior (springs, circuits).

Helpful?

Non-homogeneous equations and particular solutions

Form: ay+by+cy=g(x)ay'' + by' + cy = g(x) where g(x)0g(x) \neq 0. The right-hand side g(x)g(x) represents an external 'forcing' — a driving input that pushes the system.

The general solution has two parts: y=yh+ypy = y_h + y_p. Here yhy_h is the general solution to the homogeneous equation (g=0g = 0) — it captures the system's natural behavior. ypy_p is any particular solution that accounts for the forcing. The combination gives every possible solution.

Method of undetermined coefficients: guess the form of ypy_p based on g(x)g(x) and solve for the unknown coefficients. The guesses follow a pattern:

If g(x)=Cekxg(x) = Ce^{kx}: try yp=Aekxy_p = Ae^{kx}. If g(x)=Cnxn++C0g(x) = C_n x^n + \cdots + C_0 (polynomial): try yp=Anxn++A0y_p = A_n x^n + \cdots + A_0 (same degree). If g(x)g(x) involves sin(kx)\sin(kx) or cos(kx)\cos(kx): try yp=Acos(kx)+Bsin(kx)y_p = A\cos(kx) + B\sin(kx) (always include both sin and cos). If gg is a combination, use superposition — try the sum of individual guesses.

Duplication rule: if your guess for ypy_p duplicates a term in yhy_h, multiply by xx (or x2x^2 if it duplicates a repeated-root term). This ensures ypy_p is genuinely new and not absorbed into yhy_h.

Variation of parameters: a more general method that works for any g(x)g(x), not just the special forms above. It uses yp=u1y1+u2y2y_p = u_1 y_1 + u_2 y_2 where y1,y2y_1, y_2 are the homogeneous solutions and u1,u2u_1, u_2 are functions found via integrals. More work, but universally applicable.

Helpful?

Applications: springs and oscillations

A mass-spring system obeys my+cy+ky=F(t)my'' + cy' + ky = F(t) where mm is mass, cc is damping, kk is spring constant, and F(t)F(t) is external force.

Undamped free oscillation (c=0c=0, F=0F=0): y+ω2y=0y'' + \omega^2 y = 0 with ω=k/m\omega = \sqrt{k/m}. Solution: y=Acos(ωt)+Bsin(ωt)y = A\cos(\omega t) + B\sin(\omega t). Pure sinusoidal motion.

Damped oscillation (c>0c > 0, F=0F=0): the solution includes eαte^{\alpha t} with α<0\alpha < 0, causing the amplitude to decay over time.

Overdamped (c2>4mkc^2 > 4mk): no oscillation, just slow return to equilibrium.

Critically damped (c2=4mkc^2 = 4mk): fastest return to equilibrium without oscillating.

Underdamped (c2<4mkc^2 < 4mk): oscillation with decaying amplitude.

Helpful?

Initial value problems (IVPs)

An IVP provides the DE plus enough initial conditions to pin down a unique solution from the infinite family of general solutions.

First-order DE: one initial condition, typically y(x0)=y0y(x_0) = y_0. This determines the one arbitrary constant CC in the general solution.

Second-order DE: two initial conditions, typically y(x0)=y0y(x_0) = y_0 (starting position) and y(x0)=v0y'(x_0) = v_0 (starting velocity). These determine the two constants C1C_1 and C2C_2.

Procedure: (1) find the general solution (with arbitrary constants), (2) apply the initial conditions to get a system of equations for the constants, (3) solve the system, (4) write the particular solution with specific constants.

The Existence and Uniqueness Theorem (Picard-Lindelöf): if f(x,y)f(x,y) is continuous and satisfies a Lipschitz condition in yy near (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 exactly one solution in some interval around x0x_0. This guarantees that solutions don't 'branch' or 'disappear' — there's always exactly one curve through each initial point.

Physical interpretation: knowing the DE gives you the rules of the system (how things change). The initial conditions specify the starting state. Together, they completely determine the future (and past) behavior. This is why differential equations are the language of deterministic physics.

Helpful?

Worked Practice Problems (5 examples)

Study these solved examples to understand the techniques. Then head to Practice to try problems on your own.

Practice on your own →
1

Problem 1

Solve dydx=3\frac{dy}{dx} = 3

Step-by-Step Solution

1

Integrate both sides: y=3dx=3x+Cy = \int 3\,dx = 3x + C.

Final Answer: y=3x+Cy = 3x + C

2

Problem 2

Solve dydx=2x\frac{dy}{dx} = 2x

Step-by-Step Solution

1

y=2xdx=x2+Cy = \int 2x\,dx = x^2 + C.

Final Answer: y=x2+Cy = x^2 + C

3

Problem 3

Solve dydx=ex\frac{dy}{dx} = e^x

Step-by-Step Solution

1

y=exdx=ex+Cy = \int e^x\,dx = e^x + C.

Final Answer: y=ex+Cy = e^x + C

4

Problem 4

Solve dydx=2y\frac{dy}{dx} = 2y (general solution)

Step-by-Step Solution

1

Separate: dyy=2dx\frac{dy}{y} = 2\,dx.

2

lny=2x+C1\ln|y| = 2x + C_1.

3

y=Ce2xy = Ce^{2x}.

Final Answer: y=Ce2xy = Ce^{2x}

5

Problem 5

Solve dydx=y\frac{dy}{dx} = -y (general solution)

Step-by-Step Solution

1

Separate: dyy=dx\frac{dy}{y} = -dx.

2

lny=x+C1\ln|y| = -x + C_1.

3

y=Cexy = Ce^{-x}.

Final Answer: y=Cexy = Ce^{-x}

Frequently asked questions about differential equations

What is a differential equation?
A differential equation is an equation that relates a function to one or more of its derivatives. Solving it means finding the function that satisfies the equation.
What is a separable differential equation?
A separable differential equation can be rewritten so all terms involving y are on one side and all terms involving x are on the other. Both sides are then integrated independently.
What is exponential growth and decay?
Exponential growth and decay are modeled by dy/dt = ky. The solution is y = y₀·e^(kt), where k > 0 means growth and k < 0 means decay.