Differential Equations

Sections 4.1–4.2: basics of differential equations and direction fields

Published

December 1, 2026

A differential equation (DE) is an equation that involves an unknown function and its derivatives, such as

\[ y' = -2y, \qquad x\,y' = 8, \qquad y'' + 3y' = x^2 . \]

A solution is a function \(y(x)\) that makes the equation true for every \(x\) in an interval. Solving a DE means finding functions, not numbers.

This topic takes two class days:

Homework Problems Topic Section below
HW 4.1 1–3 order of a DE §1
HW 4.1 4–7 verify a solution (compute \(y'\)) §2
HW 4.1 8–11 particular solution through a point §3
HW 4.1 12–14 general solution by integrating §4
HW 4.1 15–17 initial-value problems and their graphs §5
HW 4.2 1–2 direction fields, sketching solutions, equilibria §6–§9
HW 4.2 3 matching direction fields to equations §8, §10

Day 1: Basics of differential equations (4.1)

Time Activity
0–5 Warm-up (below). Lets students see that “is it a solution?” means “plug it in.”
5–12 §1 Order. Do (a)–(d) together; (b) is the power-vs-order trap.
12–22 §2 Verifying solutions. Do Example 1 on the board; students do Examples 2–3 in pairs. Example 3 sets up HW #7.
22–32 §3 General vs. particular solutions. Find \(C\) from a point; stress where \(C\) sits (Example 6).
32–42 §4 Solving \(y' = f(x)\) by integrating: one example each of \(u\)-substitution, parts, and algebraic substitution (Calc II review).
42–50 §5 Initial-value problems, the picture of vertical shifts, and the “which value is reached?” question. Exit ticket.

Exit ticket: Solve \(y' = 4x^3\), \(y(1) = 3\). (Answer: \(y = x^4 + 2\).)

Warm-up. Is \(y = x^2\) a solution of (a) \(y' = 2x\)? (b) \(y'' = 2\)? (c) \(y' = y\)?

  1. Yes: \(y' = 2x\). (b) Yes: \(y'' = 2\). (c) No: \(y' = 2x\), but \(y = x^2\), and \(2x \ne x^2\) for most \(x\). One function can solve several different DEs, and a function that solves one DE need not solve another.

1. Order

The order of a differential equation is the order of the highest derivative that appears.

Examples. Find the order.

  1. \(y'' + 3y' = x^2\) (b) \((y')^3 + y = \sin x\) (c) \(\dfrac{d^4y}{dx^4} - 5\dfrac{dy}{dx} = e^x\) (d) \(y''' + 2y''y' = x^4\)
  1. 2 (b) 1 (c) 4 (d) 3

In (b), the cube is a power, not a derivative. Only \(y'\) appears, so the order is 1. In (d), the product \(y''y'\) doesn’t matter either; the highest derivative is \(y'''\).

WarningOrder is not degree

The order counts derivatives: \(y'''\) has order 3. It does not count powers: \((y')^3\) still has order 1.

2. Verifying a solution

To check that a function solves a DE:

  1. compute the derivatives the equation needs,
  2. substitute into both sides,
  3. simplify and check that the two sides agree for all \(x\).

Example 1. Verify that \(y = 3\ln x + 2\) solves \(x\,y' = 3\).

\(y' = \dfrac{3}{x}\), so \(x\,y' = x\cdot\dfrac3x = 3\). ✓

Example 2. Verify that \(y = e^{-3x} + 2x - 1\) solves \(y' = -3y + 6x - 1\).

Left side: \(y' = -3e^{-3x} + 2\).

Right side: \(-3\left(e^{-3x} + 2x - 1\right) + 6x - 1 = -3e^{-3x} - 6x + 3 + 6x - 1 = -3e^{-3x} + 2\).

The two sides agree. ✓

Example 3. Verify that \(y = 4e^{\sin(2x)}\) solves \(y' = 2\cos(2x)\,y\).

By the chain rule, \(y' = 4e^{\sin(2x)}\cdot 2\cos(2x) = 8\cos(2x)\,e^{\sin(2x)}\).

Right side: \(2\cos(2x)\cdot 4e^{\sin(2x)} = 8\cos(2x)\,e^{\sin(2x)}\). ✓

Notice the DE has \(2\cos(2x)\), not \(8\cos(2x)\): the 4 is already inside \(y\).

Example 4. Verify that \(y = \dfrac{1}{5-3x}\) solves \(y' = 3y^2\).

\(y = (5-3x)^{-1}\), so \(y' = -(5-3x)^{-2}\cdot(-3) = \dfrac{3}{(5-3x)^2}\).

Right side: \(3y^2 = 3\cdot\dfrac{1}{(5-3x)^2}\). ✓

TipIn WeBWorK

HW 4.1 #4–7 ask you to enter \(y'\). Compute it carefully with the chain rule, then do the substitution as a check. A useful fact for #5: \[ \frac{d}{dx}\ln(-x) = \frac{1}{-x}\cdot(-1) = \frac1x . \]

3. General and particular solutions

Integrating introduces an arbitrary constant, so a first-order DE usually has a whole family of solutions:

  • the general solution contains the constant \(C\) (one curve for each value of \(C\));
  • a particular solution is one member of the family, picked out by a condition such as “passes through the point \((x_0, y_0)\),” i.e. \(y(x_0) = y_0\).

To find a particular solution: plug the point into the general solution and solve for \(C\).

Example 5. Find the particular solution of \(y' = 6x\) through \((1, -2)\).

Integrate: \(y = 3x^2 + C\). At \(x = 1\): \(-2 = 3 + C\), so \(C = -5\).

\[ y = 3x^2 - 5 . \]

Example 6. The general solution of \(y' = -4xy\) is \(y = Ce^{-2x^2}\). Find the particular solution through \((1, 5)\).

\(5 = Ce^{-2}\), so \(C = 5e^{2}\) (multiply both sides by \(e^2\)). Then \[ y = 5e^{2}e^{-2x^2} = 5e^{\,2-2x^2} . \] Check: \(y(1) = 5e^0 = 5\). ✓

Example 7. The general solution of \(x^2 y' = -3y\) is \(y = Ce^{3/x}\). Find the particular solution through \((1, 2)\).

\(2 = Ce^{3}\), so \(C = 2e^{-3}\) and \[ y = 2e^{-3}e^{3/x} = 2e^{\,3/x - 3} . \]

Example 8. The general solution of \(\dfrac{dy}{dt} = \tan y\) is \(y = \sin^{-1}\!\left(e^{t+C}\right)\). Find the particular solution through \(\left(3, \frac{\pi}{6}\right)\).

\(\dfrac\pi6 = \sin^{-1}\!\left(e^{3+C}\right)\) means \(e^{3+C} = \sin\dfrac\pi6 = \dfrac12\). So \(3 + C = \ln\frac12 = -\ln 2\), and \(C = -3 - \ln 2\): \[ y = \sin^{-1}\!\left(e^{\,t - 3 - \ln 2}\right) = \sin^{-1}\!\left(\tfrac12 e^{\,t-3}\right). \] Where does that general solution come from? Separate the variables: \(\cot y\,dy = dt\), so \(\ln|\sin y| = t + C\) and \(\sin y = e^{t+C}\).

WarningWatch where \(C\) lives

\(C\) can be added, multiplied, or in an exponent. Solve for it from the formula you are given, using inverse operations: divide by \(e^{-2}\) (i.e. multiply by \(e^2\)), take \(\ln\), or apply \(\sin\).

4. Solving \(y' = f(x)\) by integrating

When the right side involves only \(x\), the DE is solved by one integration: \[ y' = f(x) \quad\Longrightarrow\quad y = \int f(x)\,dx = F(x) + C . \] This is where the Calc II integration techniques come back.

Example 9 (\(u\)-substitution). \(y' = e^{2\sin x}\cos x\)

Let \(u = 2\sin x\), so \(du = 2\cos x\,dx\): \[ y = \int e^{2\sin x}\cos x\,dx = \frac12\int e^u\,du = \frac12 e^{2\sin x} + C . \]

Example 10 (integration by parts). \(y' = \tan^{-1}(3x)\)

Take \(u = \tan^{-1}(3x)\) and \(dv = dx\), so \(du = \dfrac{3}{1+9x^2}\,dx\) and \(v = x\): \[ y = x\tan^{-1}(3x) - \int \frac{3x}{1+9x^2}\,dx = x\tan^{-1}(3x) - \frac16\ln\!\left(1+9x^2\right) + C . \] (For the last integral, let \(w = 1 + 9x^2\), so \(dw = 18x\,dx\).)

Example 11 (algebraic substitution). \(x' = t\sqrt{3t+1}\)

Let \(u = 3t + 1\). Then \(t = \dfrac{u-1}{3}\) and \(dt = \dfrac{du}{3}\): \[ x = \int \frac{u-1}{3}\sqrt u\,\frac{du}{3} = \frac19\int\left(u^{3/2} - u^{1/2}\right)du = \frac{2}{45}(3t+1)^{5/2} - \frac{2}{27}(3t+1)^{3/2} + C . \] WeBWorK accepts any equivalent form.

TipIn WeBWorK

Use a capital C for the constant (HW 4.1 #13 says so explicitly).

5. Initial-value problems

An initial-value problem (IVP) is a DE together with an initial condition, such as \[ \frac{dy}{dt} = f(t), \qquad y(0) = y_0 . \] Solve the DE, then use the condition to find \(C\), exactly as in §3.

Example 12. Solve (a) \(\dfrac{dy}{dt} = 2t,\ y(0) = -1\) and (b) \(\dfrac{dy}{dt} = 2t,\ y(0) = 2\). Graph both.

\(y = t^2 + C\). (a) \(C = -1\): \(y = t^2 - 1\). (b) \(C = 2\): \(y = t^2 + 2\).

Direction field of dy/dt = 2t with the parabolas y = t^2 - 1 and y = t^2 + 2 drawn on it

Two solutions of \(dy/dt = 2t\): the same parabola shifted vertically.

When the right side depends only on \(t\), every solution is a vertical shift of every other one. To pick the right graph (HW 4.1 #15–16), check the \(y\)-intercept and the shape. A constant right side, e.g. \(dy/dt = -3\), gives parallel lines.

Example 13. (a) Solve \(\dfrac{dy}{dt} = e^{-2t}\), \(y(0) = 5\). (b) The solution equals either \(6\) or \(3\) at some time, but not both. Which one, and when?

  1. \(y = -\frac12 e^{-2t} + C\), and \(5 = -\frac12 + C\) gives \(C = 5.5\): \[ y = 5.5 - \tfrac12 e^{-2t} . \]
  2. Since \(e^{-2t} > 0\), we always have \(y < 5.5\). So \(y = 6\) never happens.

Setting \(y = 3\): \(\frac12 e^{-2t} = 2.5\), so \(e^{-2t} = 5\) and \[ t = -\frac{\ln 5}{2} \approx -0.8047 . \] The time is negative, and that’s fine: “at some point” includes \(t < 0\). The key step is checking the range of the solution before solving.

Day 2: Direction fields (4.2)

Time Activity
0–5 Warm-up: for \(y' = y - t\), what is the slope of the solution through \((1, 3)\)? (Answer: 2.) The DE gives slopes without solving it.
5–15 §6 Build the direction field of \(y' = y - t\) by hand: each student computes a few slopes, and the class assembles the field on the board. Then show the computer version.
15–23 §7 Sketch solutions through given points. Find the straight-line solution \(y = t + 1\).
23–33 §8 Reading a field: column/row patterns, the slope-zero curve, signs. Tie back to Day 1: \(y' = f(t)\) gives vertical shifts.
33–43 §9 Equilibria and stability with the phase line: \(y' = 2 - y\), \(y' = y^2 - 4\), \(y' = (y-1)^2\).
43–50 §10 Matching practice in pairs. Exit ticket.

Exit ticket: Find the equilibria of \(y' = y(3 - y)\) and classify each. (Answer: \(y = 0\) unstable, \(y = 3\) stable.)

6. What a direction field is

A first-order DE \(y' = f(t, y)\) tells you the slope of the solution through each point \((t, y)\), without solving anything.

A direction field (or slope field) draws a short segment with slope \(f(t,y)\) at each point of a grid. A solution curve has to follow the segments everywhere it goes.

Example 14. Build the direction field of \(y' = y - t\).

point \((t, y)\) \((0,0)\) \((0,1)\) \((1,0)\) \((1,1)\) \((0,-1)\) \((-1,0)\) \((1,2)\) \((2,1)\)
slope \(y - t\) \(0\) \(1\) \(-1\) \(0\) \(-1\) \(1\) \(1\) \(-1\)

Every point on the line \(y = t\) gets slope \(0\), every point on \(y = t + 1\) slope \(1\), and so on. Curves along which the slope is constant are a quick way to fill in a field by hand.

Direction field of y' = y - t, with the straight-line solution y = t + 1, the dashed slope-zero line y = t, and solution curves bending away from y = t + 1

Direction field of \(y' = y - t\) with several solutions.

7. Sketching solutions

Start at the given point and move left and right, staying tangent to the segments.

In the field above, the segments along \(y = t + 1\) have slope \(1\), the same as the line itself, so \(y = t + 1\) is a solution (check: \(y' = 1\) and \(y - t = 1\) ✓).

  • Solutions that start above this line curve upward ever more steeply.
  • Solutions that start below it rise for a while, flatten as they cross the slope-zero line \(y = t\), then turn down.

8. Reading a direction field

These clues let you match a field to its equation quickly:

If the equation is… …then in the field
\(y' = f(t)\) (no \(y\)) slopes are the same down each vertical column; solutions are vertical shifts of each other (Day 1, Example 12)
\(y' = f(y)\) (no \(t\); autonomous) slopes are the same along each horizontal row; solutions are horizontal shifts of each other
\(f(t,y) = 0\) on some curve the segments are horizontal along that curve
\(f(t,y) > 0\) in a region the segments rise there; where \(f < 0\) they fall

Strategy for matching: test a few easy points. Look along the axes (\(t = 0\) or \(y = 0\)), find where the slopes are zero, and check the sign in each quadrant.

Example 15. Without a picture, describe the direction field of \(y' = e^t\).

No \(y\), so the slopes are constant in each column. Since \(e^t > 0\), every segment rises: nearly flat on the left, steep on the right. The solutions are \(y = e^t + C\), vertical shifts of the exponential curve.

9. Equilibrium solutions and stability

For an autonomous equation \(y' = f(y)\), a constant function \(y = c\) is a solution exactly when \(f(c) = 0\), since the derivative of a constant is \(0\). These are the equilibrium solutions: horizontal lines in the direction field.

Classify an equilibrium by the sign of \(f(y)\) just above and just below it. Draw these signs on a phase line, a vertical \(y\)-axis with arrows: up where \(f > 0\) and down where \(f < 0\).

Arrows near \(y = c\) Classification Nearby solutions…
both point toward \(c\) asymptotically stable approach \(c\)
both point away from \(c\) asymptotically unstable move away from \(c\)
one toward, one away semi-stable approach on one side, leave on the other

Example 16. \(y' = 2 - y\).

\(f(y) = 2 - y = 0\) at \(y = 2\). Above \(2\), \(f < 0\) (down); below \(2\), \(f > 0\) (up). Both arrows point toward \(2\), so \(y = 2\) is stable.

Direction field of y' = 2 - y with solution curves from above and below all approaching the horizontal line y = 2

Every solution of \(y' = 2 - y\) approaches the equilibrium \(y = 2\).

Example 17. \(y' = y^2 - 4\).

\(y^2 - 4 = (y-2)(y+2) = 0\) at \(y = \pm 2\).

  • \(y > 2\): \(f > 0\) (up). \(\ -2 < y < 2\): \(f < 0\) (down). \(\ y < -2\): \(f > 0\) (up).
  • At \(y = -2\), both arrows point in: stable. At \(y = 2\), both point out: unstable.

Direction field of y' = y^2 - 4 with equilibria y = -2 (stable) and y = 2 (unstable), and a phase line with arrows pointing toward -2 and away from 2

Direction field and phase line for \(y' = y^2 - 4\).

Example 18. \(y' = (y - 1)^2\).

The only equilibrium is \(y = 1\). Since \(f(y) = (y-1)^2 \ge 0\), the arrows point up on both sides. Below \(1\) that is toward the equilibrium; above \(1\) it is away. So \(y = 1\) is semi-stable.

Example 19. \(y' = 3y\) and \(y' = -3y\).

Both have the single equilibrium \(y = 0\).

  • For \(y' = 3y\), the sign of \(y'\) matches the sign of \(y\), so solutions move away from \(0\): unstable. (The solutions are \(y = Ce^{3t}\).)
  • For \(y' = -3y\), solutions move toward \(0\): stable. (The solutions are \(y = Ce^{-3t}\).)

10. Matching practice

Match each equation with its direction field.

  1. \(y' = 2 - y\) (2) \(y' = \dfrac t2\) (3) \(y' = ty\) (4) \(y' = y - t\)

Four direction fields labeled A, B, C and D for the matching exercise

Four direction fields, A–D.
  • (1) → B. Slopes are constant along rows, and horizontal along \(y = 2\).
  • (2) → D. Slopes are constant down columns: negative for \(t < 0\), positive for \(t > 0\), zero on the \(y\)-axis.
  • (3) → A. Horizontal along both axes; rising in quadrants I and III, falling in II and IV.
  • (4) → C. Horizontal along the diagonal \(y = t\); a straight-line solution along \(y = t + 1\).

Common mistakes

  • Order vs. power. \((y')^3\) has order 1.
  • Checking only one side. To verify a solution, substitute into both sides of the DE.
  • Losing the chain rule. \(\frac{d}{dx}e^{\sin 2x} = 2\cos(2x)\,e^{\sin 2x}\), and \(\frac{d}{dx}\ln(-x) = \frac1x\).
  • Solving for \(C\) wrong. From \(5 = Ce^{-2}\), \(C = 5e^{2}\), not \(5e^{-2}\).
  • Forgetting \(+C\), or typing a lowercase \(c\) in WeBWorK.
  • Answering “which value is reached” without checking the range. Also, negative times are allowed.
  • Stability language. WeBWorK uses “asymptotically stable,” “asymptotically unstable” and “asymptotically semi-stable.”