Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 39 · Introduction to Differential Equations

Differential Equations and Slope Fields

Meet differential equations: what they are, how to check a solution, initial value problems, and how slope fields show solution curves without solving.

A differential equation is an equation that involves an unknown function and its derivatives. They are the language of change: how a population grows, how a hot cup cools, how a spring swings, how a drug leaves the bloodstream. Almost every field of science and engineering uses them.

Instead of asking "what number solves this equation?", a differential equation asks "what function solves it?"

A first example

Consider dy/dx = 2x. We need a function y(x) whose derivative is 2x. You already know how: integrate. y = x² + C. The answer is a whole family of functions, one for each constant C. This is the general solution.

Now consider dy/dx = y. The derivative of the function equals the function itself. The function eˣ has this property, and so does 3eˣ or -5eˣ. The general solution is y = Ceˣ. Here the unknown function appears on both sides, so we cannot simply integrate the right-hand side; we need new techniques, which the next lesson introduces.

Vocabulary

  • The order of a differential equation is the highest derivative that appears. dy/dx = y is first order; d²y/dx² = -y is second order. In this course we study first-order equations.
  • A solution is a function that makes the equation true when substituted. Always check by substituting.
  • The general solution contains an arbitrary constant. A particular solution has the constant fixed.
  • An initial value problem (IVP) pairs the equation with an initial condition such as y(0) = 3, which selects one particular solution.

Checking a solution

Example. Is y = 4e^(3x) a solution of dy/dx = 3y? Differentiate: dy/dx = 12e^(3x). And 3y = 12e^(3x). They match, so yes.

For the IVP dy/dx = 3y, y(0) = 5, use the general solution y = Ce^(3x). At x = 0: C = 5, so y = 5e^(3x).

Python Verify solutions with sympy

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Slope fields

Most differential equations cannot be solved with a neat formula. But the equation dy/dx = F(x, y) tells us the slope of the solution curve at every point (x, y). We can draw a tiny line segment of that slope at many grid points. The picture is called a slope field (or direction field). A solution curve is a path that follows the little segments, like a boat carried by a current.

For example, with dy/dx = x - y:

  • at (0, 0) the slope is 0,
  • at (2, 0) the slope is 2,
  • at (0, 2) the slope is -2.

Where the slope is zero (here along the line y = x), the segments are flat. If dy/dx depends only on x, segments in the same vertical column are parallel; if it depends only on y, segments in the same horizontal row are parallel.

Python Draw a slope field and a solution curve

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You can check the red curve: y = x - 1 + 3e^(-x) gives y(0) = -1 + 3 = 2, and dy/dx = 1 - 3e^(-x), while x - y = x - (x - 1 + 3e^(-x)) = 1 - 3e^(-x). They match.

Reading a slope field

  • Follow the segments to sketch a solution through any starting point.
  • Look for equilibrium solutions where the slope is 0 along a whole line (for dy/dx = y(1 - y), the lines y = 0 and y = 1).
  • Curves can never cross, because at each point there is only one slope. (This holds when F is nice enough.)
flowchart LR
    A["dy/dx = F(x, y)"] --> B["Slope at each point"]
    B --> C["Slope field"]
    C --> D["Trace solution curves"]

Even when no formula is available, the slope field shows how solutions behave.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the order of the equation d²y/dx² + y = 0?

    The order is the highest derivative: a second derivative appears.
  2. 2. Is y = e^(2x) a solution of dy/dx = 2y?

    dy/dx = 2e^(2x) = 2y, so substitution makes the equation true.
  3. 3. What does an initial condition do?

    It fixes the arbitrary constant by specifying the value of y at a point.
  4. 4. In a slope field for dy/dx = x - y, the slope at the point (3, 1) is

    x - y = 3 - 1 = 2.

Summary

  • A differential equation relates an unknown function to its derivatives; its solution is a function.
  • General solutions contain a constant; initial conditions pick a particular solution.
  • Check solutions by substituting them back.
  • A slope field shows the slope dy/dx = F(x, y) at many points and lets you sketch solutions without solving.

Next: Separable Differential Equations