Calculus / Differential Equations

Introduction to Differential Equations

First-order ODEs, separable equations, the integrating factor method, direction fields, equilibrium solutions, and classic application models — everything you need for intro DE.

What Is a Differential Equation?

A differential equation (DE) is an equation involving an unknown function and one or more of its derivatives. The solution is a function, not a number.

Order

Highest derivative present

A first-order ODE involves only y′. A second-order ODE involves y″. The order tells you how many initial conditions you need to find a unique solution.

Degree

Power of the highest-order derivative

After clearing radicals, the degree is the exponent on the highest derivative. Most intro problems are degree 1 (linear in the highest derivative).

Ordinary vs. Partial

ODE vs. PDE

An ODE has one independent variable (e.g., t). A PDE has two or more (e.g., x and t). Intro calculus courses focus entirely on ODEs.

General Solution vs. Particular Solution

General Solution

Contains an arbitrary constant C and represents the entire family of solutions. Every value of C produces a different solution curve.

dy/dx = 2x  →  y = x² + C

Particular Solution

A specific solution obtained by applying an initial condition y(x₀) = y₀ to determine the value of C.

y(0) = 3  →  3 = 0 + C  →  y = x² + 3

Separable Differential Equations

A separable ODE can be written as dy/dx = g(x) · h(y). Separate variables so all y terms are on one side and all x terms are on the other, then integrate.

Method: Three Steps

1

Separate the variables

Rearrange so that all y terms (including dy) are on the left and all x terms (including dx) are on the right. Divide both sides by h(y) to isolate dy: dy/h(y) = g(x) dx.

2

Integrate both sides

Integrate the left side with respect to y and the right side with respect to x. Include a single arbitrary constant C on one side: ∫(1/h(y)) dy = ∫g(x) dx + C.

3

Solve for y (if possible)

Isolate y to express the solution explicitly. If you cannot solve for y algebraically, leave the answer in implicit form. Apply initial conditions to find C.

Example 1 — Solve dy/dx = xy, y(0) = 2

dy/dx = xy

Step 1: Separate: dy/y = x dx

Step 2: Integrate: ln|y| = x²/2 + C

Step 3: Solve: |y| = e^(x²/2 + C) = e^C · e^(x²/2)

General solution: y = Ae^(x²/2) where A = ±e^C

Apply y(0) = 2: 2 = Ae^0 = A

Particular solution: y = 2e^(x²/2)

Example 2 — Solve dy/dx = (1 + y²) / y

dy/dx = (1 + y²) / y

Step 1: Separate: y dy / (1 + y²) = dx

Step 2: Integrate left side using u = 1 + y², du = 2y dy:

  (1/2) ln(1 + y²) = x + C

Step 3: Multiply by 2: ln(1 + y²) = 2x + C₁

Solve: 1 + y² = e^(2x + C₁) = Ae^(2x)

General solution: y² = Ae^(2x) − 1

Example 3 — Solve dy/dx = −2xy², y(0) = 1

dy/dx = −2xy²

Step 1: Separate: y⁻² dy = −2x dx

Step 2: Integrate: −y⁻¹ = −x² + C

Step 3: Solve: 1/y = x² − C, so y = 1/(x² + K) where K = −C

Apply y(0) = 1: 1 = 1/(0 + K) → K = 1

Particular solution: y = 1/(x² + 1)

Verify: dy/dx = −2x/(x² + 1)² = −2x · y² ✓

Linear First-Order ODEs: Integrating Factor

A linear first-order ODE has the standard form dy/dx + P(x)y = Q(x). It is linear because y and y′ appear only to the first power with no products.

Integrating Factor Method

1

Identify P(x) and Q(x)

Rewrite the equation in standard form dy/dx + P(x)y = Q(x). Move all y terms to the left side and everything else to the right.

2

Compute the integrating factor

Calculate μ(x) = e^(∫P(x)dx). You do not need the +C here — one antiderivative is enough.

3

Multiply both sides by μ(x)

The left side μ(x)·dy/dx + μ(x)·P(x)·y equals d/dx[μ(x)·y] by the product rule. This is why the integrating factor works.

4

Integrate both sides

Integrate d/dx[μ(x)y] = μ(x)Q(x) to get μ(x)y = ∫μ(x)Q(x)dx + C.

5

Solve for y

Divide both sides by μ(x): y = [∫μ(x)Q(x)dx + C] / μ(x). Apply initial conditions to find C.

Example — Solve dy/dx + (2/x)y = x², y(1) = 1

P(x) = 2/x,  Q(x) = x²

μ(x) = e^(∫2/x dx) = e^(2 ln|x|) = x²

Multiply: d/dx[x²y] = x² · x² = x⁴

Integrate: x²y = x⁵/5 + C

Solve: y = x³/5 + C/x²

Apply y(1) = 1: 1 = 1/5 + C → C = 4/5

Particular solution: y = x³/5 + 4/(5x²)

Example — Solve dy/dx − 3y = e^(5x)

Standard form: dy/dx + (−3)y = e^(5x),  P(x) = −3

μ(x) = e^(∫−3 dx) = e^(−3x)

Multiply: d/dx[e^(−3x)y] = e^(−3x) · e^(5x) = e^(2x)

Integrate: e^(−3x)y = e^(2x)/2 + C

General solution: y = e^(3x) · (e^(2x)/2 + C) = e^(5x)/2 + Ce^(3x)

Direction Fields (Slope Fields)

A direction field is a visual representation of the ODE dy/dx = f(x, y). At every point (x, y), a short line segment is drawn with slope f(x, y). Solution curves flow along these segments.

How to Sketch a Direction Field

1

Evaluate f(x, y) at a grid of points

Pick a regular grid of (x, y) values. Compute the slope f(x, y) at each. Look for patterns — where is the slope zero? Positive? Negative?

2

Draw line segments with the computed slopes

At each grid point, draw a short segment with the corresponding slope. The length is uniform — only the angle varies.

3

Identify isoclines

An isocline is the curve along which f(x, y) = c for a constant c. All line segments on an isocline have the same slope. The isocline f(x, y) = 0 is called the nullcline.

4

Sketch solution curves

Draw smooth curves that are tangent to the direction segments everywhere. Each curve through a different initial point is a different particular solution.

dy/dx = y (Autonomous)

Slope depends only on y. Segments at the same height y = c all have the same slope c. Isoclines are horizontal lines. The solutions are exponentials y = Ce^x. Near y = 0, slopes are nearly flat; far from 0, slopes are steep.

dy/dx = x − y

The nullcline is x − y = 0, i.e., y = x. Below the line y = x, slopes are positive (solutions rise). Above it, slopes are negative (solutions fall). Solutions are attracted toward and then track along y = x − 1.

Equilibrium Solutions & Stability

For an autonomous equation dy/dx = f(y), equilibrium (critical) solutions are the constants y = c where f(c) = 0. Stability describes what nearby solutions do.

Stable Equilibrium

Nearby solutions converge toward y = c as x → ∞. On the phase line, arrows point toward c from both sides. Occurs when f′(c) < 0.

dy/dx = −y: equilibrium y = 0 is stable.

Unstable Equilibrium

Nearby solutions diverge away from y = c. Arrows on the phase line point away from c on both sides. Occurs when f′(c) > 0.

dy/dx = y: equilibrium y = 0 is unstable.

Semi-Stable

Solutions converge from one side and diverge from the other. One arrow points toward c, one away. Occurs when f′(c) = 0 and sign changes on only one side.

dy/dx = y²: equilibrium y = 0 is semi-stable (unstable from below).

Phase Line Analysis: dy/dx = y(y − 2)(y + 1)

Equilibria: y = −1, y = 0, y = 2  (set each factor = 0)

Test intervals on the phase line:

IntervalSign of f(y)Arrow
y < −1negative↓ decreasing
−1 < y < 0positive↑ increasing
0 < y < 2negative↓ decreasing
y > 2positive↑ increasing

y = −1: unstable  |  y = 0: stable  |  y = 2: unstable

Exponential Growth and Decay

The simplest and most important application of first-order ODEs. If a quantity grows or decays at a rate proportional to its current size:

dN/dt = kN   ⟹   N(t) = N₀e^(kt)

Exponential Growth (k > 0)

Population grows without bound. Doubling time T_d = ln(2)/k. The population doubles every T_d time units regardless of starting size.

N₀ = 500, k = 0.03: N(t) = 500e^(0.03t)
T_d = ln(2)/0.03 ≈ 23.1 years

Exponential Decay (k < 0)

Radioactive decay, drug clearance, charge on a capacitor. Half-life T_{1/2} = −ln(2)/k (since k is negative, this is positive).

A₀ = 100 mg, k = −0.1: A(t) = 100e^(−0.1t)
T₁/₂ = ln(2)/0.1 ≈ 6.93 hours

Worked Example — Radioactive Decay

A 200 g sample decays to 150 g in 10 years. Find k and when 50 g remains.

Model: A(t) = 200e^(kt)

At t = 10: 150 = 200e^(10k)

e^(10k) = 3/4  →  10k = ln(3/4)  →  k = ln(3/4)/10 ≈ −0.02877

When A = 50: 50 = 200e^(kt)

e^(kt) = 1/4  →  kt = ln(1/4)  →  t = ln(1/4)/k ≈ 48.1 years

50 g remains after approximately 48.1 years.

Newton's Law of Cooling

The temperature of an object changes at a rate proportional to the difference between the object's temperature and the ambient temperature.

dT/dt = k(T − T_a)   ⟹   T(t) = T_a + (T₀ − T_a)e^(kt), k < 0

Derivation via Separation of Variables

dT/dt = k(T − T_a)   [separate]

dT/(T − T_a) = k dt   [integrate]

ln|T − T_a| = kt + C

T − T_a = Ae^(kt) where A = ±e^C

Apply T(0) = T₀: T₀ − T_a = A

T(t) = T_a + (T₀ − T_a)e^(kt)

Worked Example — Cup of Coffee

Coffee: T₀ = 90°C, room T_a = 20°C. After 5 min, T = 70°C. Find T(20).

Model: T(t) = 20 + 70e^(kt)

At t = 5: 70 = 20 + 70e^(5k)

50 = 70e^(5k)  →  e^(5k) = 5/7  →  k = ln(5/7)/5 ≈ −0.0673

T(20) = 20 + 70e^(20 × (−0.0673))

T(20) = 20 + 70e^(−1.346) ≈ 20 + 70(0.2598) ≈ 20 + 18.2 ≈ 38.2°C

After 20 minutes the coffee is approximately 38.2°C.

Logistic Growth Model

Exponential growth is unrealistic for populations with limited resources. The logistic model adds a carrying capacity K — the maximum sustainable population.

dP/dt = kP(1 − P/K)   ⟹   P(t) = K / (1 + Ae^(−kt))

Where A Comes From

A = (K − P₀) / P₀, where P₀ = P(0) is the initial population.

K = 1000, P₀ = 100:
A = (1000 − 100)/100 = 9
P(t) = 1000 / (1 + 9e^(−kt))

Key Properties

  • Inflection point (maximum growth rate) at P = K/2
  • For P < K: dP/dt > 0 (population increases)
  • For P = K: dP/dt = 0 (stable equilibrium)
  • For P > K: dP/dt < 0 (population decreases back to K)
  • P = 0 is an unstable equilibrium

Worked Example — Fish Population

K = 5000 fish, P₀ = 500, k = 0.04. Find P(50) and the inflection point time.

A = (5000 − 500)/500 = 9

P(t) = 5000 / (1 + 9e^(−0.04t))

P(50) = 5000 / (1 + 9e^(−2)) = 5000 / (1 + 9 × 0.1353)

P(50) = 5000 / (1 + 1.218) = 5000 / 2.218 ≈ 2255 fish

Inflection at P = K/2 = 2500:

2500 = 5000/(1 + 9e^(−0.04t)) → 1 + 9e^(−0.04t) = 2

9e^(−0.04t) = 1 → t = −ln(1/9)/0.04 = ln(9)/0.04 ≈ 54.9 years

P(50) ≈ 2255. Maximum growth rate occurs at t ≈ 54.9 years.

Euler's Method (Numerical Approximation)

When an exact solution is unavailable, Euler's method numerically approximates the solution by stepping along successive tangent lines.

Iteration Formula

x_{n+1} = x_n + h      y_{n+1} = y_n + h · f(x_n, y_n)

where h is the step size and f(x, y) = dy/dx. Starting from (x₀, y₀), each step uses the current slope to estimate the next y value. Smaller h gives better accuracy but more steps.

Worked Example — Euler's Method on dy/dx = x + y, y(0) = 1, h = 0.2

Approximate y(0.6). Exact solution: y = 2e^x − x − 1.

nxₙyₙf(xₙ, yₙ) = xₙ + yₙyₙ₊₁ = yₙ + 0.2f
00.01.00001.00001.2000
10.21.20001.40001.4800
20.41.48001.88001.8560
30.61.8560

Euler approximation: y(0.6) ≈ 1.8560

Exact value: y(0.6) = 2e^(0.6) − 0.6 − 1 ≈ 2(1.8221) − 1.6 ≈ 2.0442

Error ≈ 0.188 (about 9.2%) — reduce h for better accuracy.

Error in Euler's Method

  • Local truncation error per step: O(h²)
  • Global error after n steps: O(h)
  • Halving h roughly halves the total error
  • Error accumulates — later steps are less accurate

Improving Accuracy

  • Decrease step size h (more steps, more work)
  • Improved Euler (Heun's method): O(h²) global error
  • Runge-Kutta (RK4): O(h⁴) global error, standard choice
  • For stiff equations, use implicit methods

Quick Reference: Key Formulas

Model / MethodODESolution
Exponential growth/decaydN/dt = kNN(t) = N₀e^(kt)
Newton's Law of CoolingdT/dt = k(T − T_a)T(t) = T_a + (T₀−T_a)e^(kt)
Logistic growthdP/dt = kP(1 − P/K)P(t) = K/(1 + Ae^(−kt))
Separable ODEdy/dx = g(x)h(y)∫dy/h(y) = ∫g(x)dx + C
Linear first-ordery′ + P(x)y = Q(x)y = [∫μQdx + C]/μ, μ = e^(∫Pdx)
Euler's methoddy/dx = f(x,y)y_{n+1} = y_n + h·f(x_n, y_n)

Frequently Asked Questions

What is a differential equation?

A differential equation is an equation that relates a function to one or more of its derivatives. For example, dy/dx = 2x is a differential equation stating that the derivative of y with respect to x equals 2x. Solving it means finding all functions y(x) that satisfy the equation — in this case y = x² + C for any constant C. Differential equations model real-world processes where the rate of change of a quantity depends on the quantity itself or other variables.

What is the difference between a general solution and a particular solution?

A general solution includes an arbitrary constant C and represents the entire family of solutions to a differential equation. For example, y = Ce^(2x) is the general solution to dy/dx = 2y. A particular solution is obtained by choosing a specific value of C to satisfy an initial condition. If y(0) = 3, then 3 = Ce^0 = C, giving the particular solution y = 3e^(2x). The initial condition pins down one solution from the infinite family.

How do you solve a separable differential equation?

To solve a separable ODE, rewrite it so that all y terms are on one side and all x terms are on the other, then integrate both sides. For dy/dx = xy: Step 1 — separate: dy/y = x dx. Step 2 — integrate both sides: ln|y| = x²/2 + C. Step 3 — solve for y: |y| = e^(x²/2 + C) = e^C · e^(x²/2), so y = Ae^(x²/2) where A = ±e^C. An equation is separable when it can be written as dy/dx = g(x)·h(y).

What is the integrating factor method for linear first-order ODEs?

A linear first-order ODE has the form dy/dx + P(x)y = Q(x). The integrating factor is μ(x) = e^(∫P(x)dx). Multiply both sides by μ(x) to get d/dx[μ(x)y] = μ(x)Q(x). Then integrate both sides: μ(x)y = ∫μ(x)Q(x)dx + C, giving y = [∫μ(x)Q(x)dx + C] / μ(x). This works because the left side becomes a perfect derivative after multiplying by μ(x).

What is a direction field (slope field)?

A direction field (or slope field) is a graphical tool for visualizing solutions to dy/dx = f(x, y). At each point (x, y) in the plane, you draw a short line segment with slope f(x, y). The resulting grid of segments shows the direction a solution curve must follow at every point. You can sketch approximate solution curves by following the direction of the segments — solution curves are always tangent to the line segments at every point they pass through.

What are equilibrium solutions and how do you classify their stability?

An equilibrium solution (or critical point) is a constant solution y = c where dy/dx = 0 for all x. For the autonomous equation dy/dx = f(y): find equilibria by solving f(c) = 0. Stability: if f′(c) < 0, the equilibrium is stable (nearby solutions converge to c). If f′(c) > 0, it is unstable (nearby solutions diverge from c). If f changes sign at c only on one side, it is semi-stable. On a phase line, stable equilibria are labeled with arrows pointing toward c; unstable equilibria have arrows pointing away.

What is Newton's Law of Cooling as a differential equation?

Newton's Law of Cooling states that the rate of change of an object's temperature is proportional to the difference between the object's temperature T and the ambient (surrounding) temperature T_a: dT/dt = k(T − T_a), where k < 0 for cooling. The solution is T(t) = T_a + (T₀ − T_a)e^(kt), where T₀ is the initial temperature. Example: a cup of coffee at 90°C in a 20°C room with k = −0.05 gives T(t) = 20 + 70e^(−0.05t). As t → ∞, T → 20°C (room temperature).

How does the logistic growth model differ from exponential growth?

Exponential growth models dP/dt = kP with no upper bound — the population grows forever. Logistic growth adds a carrying capacity K: dP/dt = kP(1 − P/K). When P is small relative to K, growth is nearly exponential. As P approaches K, growth slows. The solution is P(t) = K / (1 + Ae^(−kt)) where A = (K − P₀)/P₀. At P = K/2, the growth rate is maximum. The carrying capacity K is the stable equilibrium — the population stabilizes at K as t → ∞.

What is Euler's method and when do you use it?

Euler's method numerically approximates the solution to an initial-value problem dy/dx = f(x, y), y(x₀) = y₀ when an exact solution is difficult or impossible to find. Using step size h, the iteration formula is: x_{n+1} = x_n + h and y_{n+1} = y_n + h·f(x_n, y_n). At each step you move along the tangent line at the current point. Smaller step sizes give more accurate approximations but require more computation. Euler's method introduces error at each step (local truncation error O(h²) per step, global error O(h)).

Related Topics

Practice Differential Equations

Interactive problems with step-by-step solutions and private tutoring — free to try.

Start Practicing Free