Separation (3.3 Separable Equations) handles a right side that factors, and the integrating factor (3.4 Linear First-Order Equations & Integrating Factors) handles . This lesson adds two ideas of a different kind. Exactness: some equations say that a function of two variables stays constant, so the solution curves are its level curves. You have met that structure already, in 2.3 Gradient & Directional Derivatives and 2.9 Line Integrals, Circulation & Flux. And the change of variable: an unfamiliar equation becomes a familiar one after you rename the unknown.
It also repays a promise of the course. Streamlines of a 2D flow are solution curves of an ODE, and whether that ODE is exact is the same question as whether the flow is incompressible.
Transcript
- Two ideas finish the toolbox. Exactness: some equations say that a function of two variables stays constant. Substitution: rename the unknown, and a strange equation becomes one you can solve. The first is Module 2, in disguise.
- Write the equation as M dx plus N dy equals zero. Take M equals y and N equals x. That pair is the gradient field of Module 2, for phi equals x y. Solution curves follow the direction field, and are also level curves of phi, crossing the gradient arrows at right angles.
- A real example. Test it: differentiate M in y, and N in x. Both give cosine x plus two x e to the y. They match. Now build phi: integrate M in x. The constant of integration is not a number. It is an unknown function of y.
- Differentiate phi in y and compare with N. A leftover appears: g prime must be minus one, so g is minus y. Through one, zero, phi equals one. N there is 0.8415, not zero, so the curve is a graph, and at x equals 1.5 it sits near minus 0.813.
- Most equations fail the test. Here the two derivatives differ by x plus y. But that gap divided by N is one over x, a function of x alone. So multiply the whole equation by mu equals x, and the gap becomes zero.
- A gradient has zero integral around any closed loop. Around this circle the original gives minus 1.5708, so no potential. Multiplied by x, it gives zero. Now phi is x cubed y plus half x squared y squared, three halves through one, one, and y at two is 0.17945.
- A homogeneous equation has a slope that depends only on y over x. Along any ray from the origin that ratio is fixed, so the slope is fixed: three rays, three constant slopes. Scale a solution about the origin and you get another solution, dashed.
- Set v equals y over x. Then the equation becomes x v prime equals one over v, which is separable. Through one, one, y equals x root one plus two log x. It ends at x equals 0.6065, where the slope goes vertical. At two it is 3.0895.
- Bernoulli: y prime plus y over t equals t y squared. Let v equal one over y. Then v prime is minus y prime over y squared, and the nonlinear term collapses. What remains is linear: v prime minus v over t equals minus t. The solution is v equals t times three minus t.
- One situation, two curves. v is a parabola; y is its reciprocal. Where v reaches zero, at t equals three, y explodes: at 2.9, v is 0.29 and y is 3.4483. Starting at one half, y is back at one half at t equals two.
- Riccati: y prime equals two over t squared minus y squared. Knowing one solution, two over t, put y equals that plus v. That is Bernoulli, and one over v makes it linear. For y of one equal three, y is 1.4933 at 1.5, and going backward it blows up at t equals 0.630.
- Now fluids. A streamline of a flow u, v obeys minus v dx plus u dy equals zero. That is exact exactly when u x plus v y is zero: an incompressible flow. The potential is the stream function. For stagnation flow it is x y, the same hyperbolas as before.
- A point source, x, y over r squared, is incompressible away from the origin, and its stream function is the angle. But once around the origin the angle gains two pi, 6.2832: no single-valued potential. Curl-free flow has a velocity potential. Divergence-free flow has a stream function.
- So choose a method. Separable? Linear? Exact? Exact after a factor? A known shape that a substitution cracks? If none, there is no closed form. Most first-order equations have none, which is why the numerical methods matter.
Differential form, and what “exact” means
Write as
The form treats and symmetrically, so it still makes sense where and the slope is infinite. A solution is a curve whose tangent is up to scale. Call the equation exact if some has and , so that . Then is constant along a solution: the solution curves are the level curves . This is the picture from the gradient lesson. The vector is perpendicular to the level curve, and the solution’s tangent satisfies , so it is perpendicular to the gradient, i.e. tangent to the level curve.
A quick test: if exists, then by equality of mixed partials (2.1 Functions of Several Variables & Partial Derivatives). So is necessary. It is exactly the curl-free test of 2.9 Line Integrals, Circulation & Flux, with and . In Module 2 vocabulary, the equation is exact when is a conservative field, is its potential, and the test is that its 2D curl vanishes. The Module 2 caveat carries over: the test gives a potential on a simply connected region, one without holes.
Finding the potential, slowly
Worked example. Solve with .
Test. . Exact.
Step 1: integrate in , holding fixed.
The “constant” of integration is a function of , not a number: differentiating in kills anything depending on alone, so is invisible to . This is where learners slip: write and step 2 cannot work.
Step 2: differentiate in and match . must equal . Every cancels, leaving . That cancellation is the exactness test happening a second time: if an survived, could not be a function of and the equation would not be exact. So .
Step 3. , and gives the solution . Check: and .
This is an implicit solution, not solvable for in elementary functions. It defines where (implicit function theorem); at the start , so there is a unique branch through , and it can only end where , where the curve turns vertical. Marching with RK4 from to gives , and there equals to within : the level curve and the solution curve are the same curve.
Things to try, each confirmed by the readout:
- Textbook exact equation. Drag the seed. The solution curve lies on the highlighted level curve, reads , and the potential does not change along the curve.
- Non-exact, . At the seed , . The faint curves are only : the highlighted one parts company with the solution, and that function changes along the solution by . The loop integral around the circle at of radius is : no potential.
- Tick multiply by the integrating factor. Now , the curves brighten and the highlighted one agrees with the solution, and the loop integral is . Same tangents, same solutions, but a potential exists.
- Point source flow. is at every seed, yet the loop integral around the origin is . See below.
The fluids connection: exactness is incompressibility
A streamline of a 2D flow is tangent to the velocity: , or . That is with and (the sign is chosen so the potential below is the stream function with its usual sign). The exactness test reads , that is
the divergence of 2.7 Divergence: Sources & Sinks. So the streamline equation is exact exactly when the flow is incompressible, and the potential , with and , is the stream function. The streamlines are its level curves.
Two potentials appear in 2D fluid mechanics, and they answer different questions:
| Property of the flow | Test | Potential | Level curves |
|---|---|---|---|
| curl-free | velocity potential , | equipotentials | |
| divergence-free | stream function , | streamlines |
The first is the conservative-field story of Module 2; the second is this lesson’s exact equation. The field that is conservative here is , the velocity turned a quarter turn, not itself.
Worked example: stagnation-point flow. Let . Then . From : . Then must equal , so and . The streamlines are the hyperbolas , and gives the axes. A particle obeys , , so , ; RK4 from to returns , the starting value. The differential form earns its keep: as an ODE for this is , meaningless on the -axis, yet the streamline there is perfectly ordinary, and has no trouble.
This flow is also curl-free (), with . Then and have dot product : streamlines cross equipotentials at right angles.
The catch: potentials need simply connected regions
Exactness is local; a global potential can fail. Take a point source, with , so and . Then on the whole punctured plane. The only candidate for is the polar angle (check: , ), whose level curves are the rays. But is not single-valued: once around the origin adds . Indeed, on the unit circle
This is the point vortex of 2.9 Line Integrals, Circulation & Flux with the roles swapped: there was the velocity potential of a curl-free field with a hole, here it is the stream function of a divergence-free field with a hole. The fix is the same: on any region that does not surround the origin, a continuous branch of is a fine potential. The is the flux out of the source, which is why jumps by the source strength as you circle it.
Integrating factors for exactness
Most equations fail the test. For , and , a gap of . But multiplying by a nonzero does not change the solution curves, since the tangent points the same way. It does change exactness. We want
a PDE for in general. If we ask for to depend on one variable, it collapses to an ODE.
A factor . With the condition is , so . The left side depends on alone, so such a exists only if the right side does; if appears, no works. When it holds, the equation is separable and .
A factor . With the condition is , so , usable when that depends on alone.
The link to lesson 3.4. Write as : , , , . The ratio depends on alone, so and . That is the factor of the last lesson, and lesson 3.4’s demand "" was this exactness condition in disguise. The potential is (check: , ), and the equation you integrated was .
Worked example. For the equation above, (where ), a function of alone. So , and is exact: both cross-partials equal . Integrate in : ; matches with . The solutions are . With , ; at this is , so . RK4 on gives , and the potential changes by along the way, against for the naive .
Solutions can appear. The curve solves the new equation automatically, so check it against the original. Here has and , so it does satisfy the original form; in general it need not.
Homogeneous equations: self-similar slopes
An equation is called homogeneous (unrelated to “homogeneous linear” in lesson 3.4). The slope depends only on the ratio , so it is the same along every ray from the origin, and scaling maps solutions to solutions. The variable that captures this is . Put , so and the equation becomes , that is
It is separable, and lesson 3.3 Separable Equations finishes it. The fine print: needs , and dividing by loses any constant with , the straight lines .
Worked example. , . Dividing by , , so , , and . Then ; gives , and on the branch , ,
It exists only while , i.e. . There , where the right side of the ODE is infinite: the curve has a vertical tangent and the equation gives out. Nothing is lost, since would need . Check: , and RK4 gives .
Two routes, one answer. The equation is homogeneous too: , so . Since , we get , which simplifies to : twice the potential found with . The lines and lost to the division sit inside the family at .
Bernoulli: dividing away the nonlinearity
A Bernoulli equation is with (those are linear already). Divide by :
Since , the derivative term is a multiple of for , and the other appearance of is itself. So , that is
linear in , so lesson 3.4 Linear First-Order Equations & Integrating Factors applies, and then . The fine print: dividing by assumed , and for the function solves the original equation but is never produced by the formula.
Worked example. , , . Here and :
So . With , , so and . Then gives :
RK4 gives (formula: ) and (). The blow-up has a mechanism: solves a linear equation and is finite everywhere, but explodes where crosses zero, at . A nonlinear equation can run away in finite time while being a linear one in disguise. The lost solution is (it satisfies , and is never ).
A second check: the logistic equation is Bernoulli with . With , , so and : the family quoted in lesson 3.1 What Is a Differential Equation?, with again the member it misses.
Riccati: one known solution is enough
The Riccati equation has no closed form in general. But given one solution , put and subtract the equation for (the terms cancel):
a Bernoulli equation with .
Worked example. . Try : and . (Finding it was a guess from the scaling; no method promises one.) With , : . Set : . With factor , , so and
For , and . RK4 gives and , matching the formula. Going backwards it blows up at . The known solution itself is lost (), while gives , which checks directly: .
A decision procedure, and where it ends
Each technique answers “what is this equation secretly?” Try them in order of cost:
- Separable? : separate and integrate (3.3 Separable Equations).
- Linear? : use (3.4 Linear First-Order Equations & Integrating Factors).
- Exact? Write and test .
- Exact after a factor? If depends on only, or on only, you have .
- A recognizable shape? gets ; gets ; a Riccati with a known solution gets .
Every substitution has one recipe: choose so its derivative eats the troublesome part, solve, translate back, and ask what was lost.
After step 5 the honest answer is: usually nothing, in closed form. The innocent-looking is Riccati and has no elementary solution, and equations from practice (drag laws, reaction rates, lookup tables) rarely have even that much structure. That is why Euler, RK4 and RK45 are the main tool, not the fallback. Closed forms stay useful in two ways. They are answer keys for a solver. And a conserved potential is an error monitor: for the exact equation above, is exactly constant along true solutions, so its drift along a numerical solution measures the error without needing the answer. The cell below shows Euler with 100 steps drifting by while RK4 drifts by .
Exercise: a numerical exactness toolkit
The tests an equation needs, the factor rule, and the conserved quantity are all computable without symbolic algebra. Implement them for any and given as Python functions, and check them against each other.
Problems
Solve , . Find , solve for , and say over what interval of the solution exists and what happens at its end.
Show worked solution
. Integrate : , and gives . So , and . As a quadratic in ,
with the plus sign so that . The radicand is ; for both factors are negative, so it is positive and the branch exists for every . At the radicand is and , where : the tangent is vertical and the curve turns back along the other branch, so the solution ends there. Check: the formula gives and , both matched by RK4 on from .
For : (a) show it is not exact and decide whether or can work; (b) find the implicit solution; (c) the factor vanishes on : is a solution of the original, and where is it in your family?
Show worked solution
(a) . The ratio involves , so no . But depends on alone, so and . Check: .
(b) Integrate in : . Then gives , so (differentiate to check). The solutions are .
(c) On , and the original reads , so yes, it is a solution of the original. It lies in the family at .
Consider . (a) Find , substitute , and solve. (b) Solve and find where settles. (c) For find two solutions, and say why the uniqueness theorem does not apply.
Show worked solution
(a) , . Dividing by : , and , so and . Then , valid only while (because equals only then).
(b) , so , positive throughout. Check: , matching RK4. As , , where .
(c) works, and so does , i.e. . The uniqueness theorem needs the right side to be Lipschitz in , and has infinite slope at , so solutions may leave whenever they like. A solver started exactly at sees slope and never finds the second one.
A flow has , . (a) Show it is incompressible and find . (b) Show it is curl-free and find . (c) Check at that and find the streamline through .
Show worked solution
(a) . With , : , and gives . So . Check: and .
(b) . From : , and gives .
(c) At , and ; the dot product is . The streamline is , i.e. . RK4 on , from keeps to after time units.
Key Takeaways
- An equation is exact when ; solutions are the level curves . The test is the Module 2 curl-free test.
- To find , integrate in and add a function of ; differentiate in , match , and expect every to cancel.
- The streamline equation is exact exactly when (incompressible), with the stream function as potential. Curl-free flow has a different potential, the velocity potential.
- Exactness is local; a global potential needs a simply connected region. The source flow has but loop integral around its hole.
- exists when depends on alone, when depends on alone; lesson 3.4’s factor is the case . A factor can add the solution .
- Homogeneous equations become separable (), Bernoulli equations linear (), and a Riccati with a known solution Bernoulli. Check what each loses: , , the lines .
- Implicit solutions define a function where and end where the curve turns vertical.
- Most first-order equations have no closed form. Closed forms are answer keys, and a conserved monitors a solver’s error.