Skip to content
ihateDesmos

Slope field generator

Type a differential equation dy/dx = f(x, y) and see its slope field at once: a short segment at each grid point with the slope the equation prescribes. Click anywhere to draw the solution curve through that point.

−4−224−220
Open in calculator
The slope field of
dydx=x−y
with five solution curves. Every solution approaches the dashed line y = x − 1, itself a solution.

How to use the slope field generator

  1. 1
    Type the equation with dy/dx = on the left, for example dy/dx = x - y. The field appears immediately.
  2. 2
    Click the graph to add a solution curve through that point. Drag a curve’s starting dot to move it.
  3. 3
    Zoom and pan as with any graph: the segments are redrawn for the new window.
  4. 4
    For a system, write both equations on one line, dx/dt = y, dy/dt = -x, to get a phase portrait.
  5. 5
    Use letters such as k in the equation and accept the slider to see how the field changes.

What a slope field shows

A first-order differential equation dy/dx = f(x, y) doesn’t tell you y directly. It tells you the slope of the solution at every point. A slope field draws that information: at each point of a grid, a short segment is drawn with slope f(x, y).

A solution curve is a curve that is tangent to the segments everywhere it goes, so you can sketch one by following the segments like a current. Different starting points give different solutions, and the field shows all of them at once.

  • Equilibria: if f(x, y) = 0 along a horizontal line y = c, that line is a constant solution. For dy/dx = y(1 − y), the lines y = 0 and y = 1 are equilibria.
  • Isoclines: curves where f(x, y) is constant have segments that are all parallel. For dy/dx = x − y, each line y = x − c has slope c.

Matching an equation to its slope field

A common exam question shows a slope field and asks which equation produced it. These checks settle most of them:

  • If the segments are the same along every vertical line, f depends only on x (for example dy/dx = x²).
  • If they are the same along every horizontal line, f depends only on y (for example dy/dx = y − 1).
  • Find where the segments are flat. Those points satisfy f(x, y) = 0.
  • Check the sign in one quadrant. If segments rise in the first quadrant, f(x, y) > 0 there.

For a full walkthrough, including drawing one by hand, read how to draw a slope field.

How the solution curves are computed

Solutions are integrated with the Dormand–Prince Runge–Kutta method, a fifth-order scheme that estimates its own error at every step and shrinks the step where the solution changes quickly. Curves are followed by arc length rather than by x, so a solution that turns vertical, like the circles of dy/dx = −x/y, is traced around instead of stopping. Integration stops cleanly where the solution leaves the window or blows up.

Examples to try

−2246−220
Logistic growth
dy/dx = y(1 - y)
Equilibria at y = 0 (unstable) and y = 1 (stable).
Open this example
−4−224−220
Circles
dy/dx = -x/y
Every solution is a circle x² + y² = r², traced all the way round.
Open this example
−550
Damped pendulum
dx/dt = y, dy/dt = -sin(x) - 0.25y
A phase portrait: trajectories spiral into the resting positions.
Open this example

Frequently asked questions

What is a slope field?
A picture of a first-order differential equation dy/dx = f(x, y): at each point of a grid, a short segment with slope f(x, y). Solution curves are tangent to the segments everywhere.
How do I draw a slope field by hand?
Choose a grid of points, compute f(x, y) at each one, and draw a short segment with that slope. Start with the points where f = 0, which have flat segments.
How do I match a differential equation to its slope field?
Check whether the segments repeat along vertical lines (f depends only on x) or horizontal lines (only on y), find where they are flat (f = 0), and check the sign of the slope in one quadrant.
Can it draw phase portraits for systems of equations?
Yes. Write dx/dt = …, dy/dt = … on one line to get the direction field and trajectories of a 2D system. Three equations give a 3D system.
How accurate are the solution curves?
They use the adaptive Dormand–Prince Runge–Kutta method with error control at every step, typically accurate to well below a pixel.

Related tools and guides

Try the slope field generator

It opens instantly, with no account and nothing to install.

Open the calculator