How to sketch a direction field and a solution curve

A differential equation can tell us the slope of a solution even before we know the solution itself. If we draw a short segment for that slope at many points, we can see how a solution curve would bend. Let’s sketch the field and follow a curve through (1, 1).

What does each segment in a direction field show?

For a first-order equation y′=f(x,y), evaluate f at a point (x, y) to get the slope a solution would have there. Draw a short segment centered at the point with that slope. Positive slopes rise as we move right, negative slopes fall, and a slope of zero gives a horizontal segment.

Example: Sketch the field for y′ = y − x

Use the integers −2 through 2 for both coordinates. Pairing the five x-values with the five y-values gives 25 grid points. At (−2, −2), the slope is −2 − (−2) = 0. At (0, 1) it is 1, and at (1, 0) it is −1.

Four slopes from the grid
Point (x, y)Slope y − x
(−2, −2)0
(0, 1)1
(1, 0)−1
(1, 1)0

The slope is zero all along y = x. Above that diagonal, y is greater than x, so the slopes are positive. Below it, the slopes are negative. We can use that pattern to check the segments as we draw them.

Direction field for y prime equals y minus xShort slope segments are horizontal along y equals x, tilt upward to the right above it, and tilt downward to the right below it. The highlighted solution passes through one, one with a horizontal tangent.
The highlighted curve follows the field through (1, 1).

Follow a solution curve through (1, 1)

Start at (1, 1), where the slope is zero. Sketch a smooth curve that is horizontal there and follows the nearby slopes as you go left and right. The line y = x shows where the slopes are zero, but it has slope 1 itself, so it isn’t a solution curve.

The field gives us a sketch. We can check it against the exact solution.

y=x+1−ex−1

At x = 1, we get y = 1. Differentiating the solution gives

y′=1−ex−1=y−x