direction field slope field ODE
The very phrase "differential equation" is enough to cause a headache. Look at an equation like y'=x−y: you do not know what y is, yet it contains the derivative of y, so where do you even start? The starting point is surprisingly simple. y' is the slope of the curve at that point. So an equation y'=f(x,y) is a map that tells every point of the plane, "pass through here with this slope." Draw a short line at each point and the plane fills up with slope marks: a direction field. Finding a solution means starting from some point and faithfully following those marks to trace a curve. See this map of flow before memorizing any formulas, and the rest becomes much easier. In this lesson you follow that map yourself.
First, look at the map a differential equation draws. Take y'=x−y: at each point (x, y) of the plane, this equation sets the slope the curve must have to x−y. At the point (2, 0) the slope is 2; at the point (0, 2) it is −2. Draw a short line in that direction at every point and the screen fills with little dashes; that is the direction field. Drag the gold probe around and the dash at that spot thickens in gold while the slope at that point appears below as a number. No solution has been found yet. At this stage you only see that, at every point, which way to go is already decided. A differential equation does not hand you the answer directly; it gives you directions like this.
Now follow that map. Mark a starting point, take one step in the direction the dash points, read the new slope there and take another step, and if you keep following faithfully a single curve is drawn. That curve is a solution of the differential equation. Drag the gold starting point and the curve, extending both ways from it, always runs alongside the dashes, following the field the way a river follows the terrain. Whatever point it passes through, the curve's slope there is exactly x−y. You can see that a solution is not some mysterious formula but the trail left by flowing in the prescribed direction at every moment. This is also how computers solve differential equations: by following the dashes in small steps.
One direction field has not one solution curve but infinitely many. The faint curves on the screen fill the whole field as if it had been combed. It is the same differential equation, but a different starting point follows a different curve. So which of all these curves is your answer? The initial condition decides. Drag the handle on the vertical axis to change y(0), and a single condition, the value at x=0, picks exactly one curve out of the dense family and lights it up in gold. A differential equation gives the whole family of curves, and the initial condition chooses one of them. That is why, in real problems, the equation and the initial condition come as a set. Only when you know the starting point is it settled where the flow will go.
Look separately at the single most important direction field: y'=ky, where the slope is proportional to the value of y itself. The key is "the more there is, the faster it changes." When the value is large the slope is large, and when it is small the slope is small. Drag k along the track below: when k is positive you get a curve that steepens as it rises and grows explosively, which is exponential growth. When k is negative the curve flattens out and dies away toward 0, exponential decay. The solution is y=ekx. The e we met in the complex numbers thread pops out naturally here, because the answer to "grows in proportion to itself" is exactly the exponential function. Population growth, radioactive decay, the charging and discharging of an RC circuit, and compound interest are all the single line y'=ky. This simple direction field is why exponentials show up so often in nature.
Finally, look at one way to solve exactly by hand: separation of variables. In the direction field of y'=−xy, the dashes circle around the origin, and the solutions are the gold concentric circles. To confirm this with formulas, write y' as dy/dx and move the x's to one side and the y's to the other. y dy = −x dx. Once the variables are separated, both sides can simply be integrated. y²2 = −x²2 + C, which rearranges to x²+y²=C: a circle. Press the "Show the separation" button and the steps unfold one by one. Separation of variables confirms, with the exact formula x²+y²=C, the circling flow the direction field drew. The picture, the direction field, and the calculation, separation of variables, point to the same answer. A differential equation whose variables split cleanly is solved like this with a single integration.