Differential Equations


Glossary: http://www.tomzap.com/notes/DifferentialEquationsM427K/DiffEqDefinitions.pdf

“What I wish I knew before teaching”: http://web.williams.edu/Mathematics/lg5/Rota.pdf

Diagrams / examples: Differential Equations Explained

Differential equations solver: Ordinary Differential Equations (ODE) Calculator - Symbolab

Types: Ordinary Differential Equations (ODEs)—Wolfram Language Documentation

Example: gravitational lensing: http://cliffcrosland.tumblr.com/post/115981256393/black-hole-js

Can you describe what is going to happen? Then let the light follow that path. You are basically creating a “video game” with certain rules [defined in the equations] and letting them play out.

Kilobots: devour.com is for sale | www.oxley.com - same instructions for each. Following the same playbook. Emergent behavior.


  • I gave the players instructions, what path will they take? Where will they be 1 minute into the game? Imagine a coach gives players an instruction (“Follow 3 feet behind your neighbor”). Where will they be? How about if the instruction is more complex? (“If your opponent moves, cover half the distance they went”). What will your path look like? Where will you be? Differential equations means that from the rules, we find the path they lead to. (Maybe there are a few similar ones.)


  • Regular algebra finds the point (x=3) that satisfies some constraints
  • Differential equations finds the path (f(x)) that satisfies the scenario

The full path is more difficult but more useful. A point tells you what happens now, the path gives info on the future and past.

There are different shapes (e^x, sine, cosine) which are well-behaved and we know the path. When we have a scenario, sometimes we figure out which well-studied path could make it work.

We classify the complexity of the scenario (ordinary, partial, etc.) and have techniques to cleanly separate it (method of separation, factor eqn into products, get independent and dependent variables on opposite sides).


  • Intuitive reasons to integrate with respect to independent variable (x). Let’s see… as we take the independent variable from 0 to x (final value), what is the impact on our path? Can we add up the accumulated influence on our path? [shown on the dependent side? y’ → dy/dx, how much our path is changing as we changed x?]

  • What is the intuition for separating? We have an idea of how x (the inputs) will be accumulate and how y (the results) will be accumulated. We get 2 different “accumulation patterns” (assuming t has been changing in the corner) and we need to see what conditions have them match up. For an equation like y’/y = 1, we know the accumulation pattern on the right [which accumulates to x] must match up with the accumulation pattern on the left (ln|y|). Therefore, we have ln|y| = x or y = e^x. [The scenario that would match the accumulation patterns given.]. We are thinking at the pattern and function level, not the variable level. (Simple integrals start us thinking at the function level.)

  • For the differentials (dy and dx), imagine “t” is changing off in the corner [they are both parameterized by t]. So t changes, we get dx, and that creates dy. We integrate both sides (treating x and y as if they were independent) as we are “walking through t”. (In my head, we are going through the time portion of the scenario.)

  • Example 2.7: We only need to use integral of 1/y => ln|y| if we have y as the denominator; for other examples we can just use regular integration. Want to solve for y = f(x), not x = f(y). Get the dependent variable cleanly stated in terms of the independent one. For u substitution [like u = 2y + 1], see du as “wider” change than dy. So the size of the chunk we are accumulating with dy is half what we’d be accumulating with du.

  • Sample scenario: exponential growth with additional payments coming in. Need to really understand u-substitution and walk yourself through the reasoning. Can see how we have a constant factor coming in. The solution is still an exponential with a constant. We may subtract the net present value of the income stream from the exponential. [Problem 23]. Can use wolfram alpha to help.

  • We have the moment-by-moment behavior and want to find the overall path. Like having a clue and working to get the full pattern. Sometimes we have a description like "y is based on x [y is a function of x, or y = f(x)]. When x changes, y changes the same amount [dy/dx = 1, or dy = dx]. What does y look like? [Answer: y = x + C, aka y is the same as x but might have a different offset. Try examples like x goes from 1 to 2, y goes from 10 to 11. y = x + 10.]

  • Gotcha: remember the difference between $y’$ (which is $\frac{dy}{dx}$) and $dy$. When we use $y’$ we already have a $dx$ available for use.

  • Q: what does “integrate both sides” really mean? (calculus - Can anyone explain the intuitive meaning of 'integrating on both sides of the equation' when solving differential equations? - Mathematics Stack Exchange). Or, treat in terms of a hidden variable (t) where they are both parameterized.

  • The key is clarifying 1) what y’ vs dy/dx means

  • What does the FTOC give us? To compute an indefinite integral (i.e. what function has this pattern of changes?), find an anti-derivative. When we say $h(y) dy = g(x) dx$, we mean "a function H(y) that has the derivative h(y) will accumulate y’s changes like we need. A function G(x) with derivative g(x) will accumulate x’s changes like we need. Because the accumulated changes are equal, these functions are equal. (This is the core trick, really understanding how we can separate and integrate. Intuitively realize this.)

  • Start with a simple example where dy/dx = 1 and work up. How about dy/dx = x. dy/dx = y. dy/dx = x/y.

  • If two functions have the same derivative, they only differ by a constant. Therefore H(y) = G(x) + C.

Talk about the high-level issues with Differential Equations

  • Want functions, not specific results. Find the behavior that has this relationship with itself. (Vs. a specific value that has this relationship with itself). Can you describe what you have and how it relates to itself? (Also: e, sine/cosine, are well-understood how they relate to themselves [i.e. self-derivatives]).

  • The main issue: really clarify how derivatives, integrals, etc. work. What does it mean to integrate? To use the FT OC? To have an anti-derivative? To find a pattern that works? (We have two candidate patterns that work.)

  • Integrals are like looking at the broken pieces and guessing the original. Depending on how complex the parts are, we can put it together with varying degrees of success. But if the vase has been “atomized” then it’s really hard. Have to numerically integrate (can glue it together and find the “weight” but not the actual pattern).

  • Learn to categorize the differential equations by their complexity. (like factoring equations that are quadratic, cubic, quintic, etc. Can’t automatically solve quintic equations. Some techniques like trial-and-error to factor them.)

  • Tools like LaPlace transform help. Look at any pattern as being made from spirals (or circles for Fourier Transform). Since exponents are easier to analyze / take derivatives, after we do the transform we may get some properties emerging. Sometimes you can’t say anything except “the solution has properties like XYZ”. So DiffEqs class… notice how they are, notice the complexity, but then plug them into a computer. Analytically solving them isn’t really an option.

  • Can we turn the function we have into something easier to analyze? (Yes. We convert our signal into easy-to-analyze exponents, and work with that. Just like taking a pile of rocks (unitary count) and “convert it” into base 10. We have a different quantity in each “bucket” and this is easier to analyze. Make a graph with a different amount in each digit. This is “decimal view” vs “unitary view” (the raw amount)). Isn’t addition, multiplication, etc. easier in “decimal view”? Because decimals have multiplication built-in. (unitary doesn’t).

  • Difference equation (Fibonnacci) to “differential equation”. Find a closed-form solution to find the nth Fibonacci number. How are they connected? Discrete vs. continuous? (Numeric solution means literally working our way up… ie., have to calculate all the intermediate values. Same thing for factorial – have to crank through each?).

  • Study the rules of behavior. If the DiffEqs are setup a certain way [weather] then we have Chaos (small changes lead to unpredictable results that ever-oscillate).

  • Draw the actual slope field. We know what y’ is (y’ = y^2 - t) so we have a 2d plot. Can draw the field. Can see the solution by starting at a random point and following the field along. Maybe have a simulator here? Slope and Direction Fields for Differential Equations - click the slope field and see. Try to hit the target. What initial conditions do you need to get to that spot?

  • Learn to describe the behavior you want [logistic] and the differential equation can help find the solution. Sometimes you have the behavior first, then work out the rest. Phase line and phase plane. [See sine via a phase line!]. Learn to describe the behavior vs. the entire path.

  • Equilibrium points. When derivative = 0, you will never change. So you start there and never change, constant solution. Think of y’ as a funky variable to solve for. Can estimate the slope field you’ll see. Can know something about the solution even if you can’t describe it analytically. [esp. for non-linear like y’ = y^3 - y]. Having a function which explains all of these solutions would be really hard to specify. There may be 3 types of solutions we can have, need to pick one or the other. Source/sink can tell if solutions are repelled or attracted to that equilibrium point.

  • DiffEqs: “These are the paths that follow the rules you laid out.” Simpler the rules, easier to have an explicit formula. Initial condition tells you which path/track you are on. Doing the derivative test [taking the second derivative] can predict the path. Existence and uniqueness theorem, if DiffEq is “nice” then can’t cross the equilibrium point. Only one derivative at that point and the equilibrium is already there. For non-nice functions [division by zero = undefined, which mean there could be several options! that’s all it means. multiple choices]. So you have 2 solutions that cross through and not clear which one to follow after.

  • Like following a gradient to the max value. Start with some initial conditions, where do you go? Some systems are chaotic, minor changes lead astray. Some pull you in like a black hole [if you’re nearby you’ll settle in]. Understand them qualitatively before quantitatively.

  • Idea… how to make a circular path. dy/dx = -x/y. Interesting. Can I solve this? dy.y = -x dx, 1/2 y^2 = -1/2x^2 + C. y^2 + x^2 = C. Solutions lie on a circle! In other cases, see how solutions lie on exponential curves.

  • A lot of relationships have derivatives in them, just like some have squares or square roots. If we avoid them we can’t describe a lot of connections.

  • DiffEqs is the “Algebra” of Calculus. Solve calculus scenarios. Key is learning to describe them. Some simple ones can be solved, most need a computer to run through and simulate the possibilities.

  • Bifurcations: When we change a parameter and number of equilibrium points change (or they go from source to sink).

  • Chaos theory: Chaos theory - Wikipedia – having a small change in initial conditions creates huge, non-predictable variations in output.

  • Have a table of “rules” and “emerging pattern”. “Grow by your current amount” => exponential growth. “Grow by -x/y” => circular growth. “Grow at steady rate” => linear growth. Etc. Given the rules, what does the overall pattern look like? It’s not always obvious that “changing by -x/y will move you in a circle”.

  • Translate integrals, etc. into simple language

  • $\int y(t)$ means "Some function whose changes match $y(t)$ ". Call this $Y(t)$. See integration and differentiation as saying “some function that…”. So when we say $\int t^2 = \frac{1}{3}t^3 + C$ we mean “Functions matching the pattern $\frac{1}{3}t^3 + C$, when derived, will have the pattern of changes we asked for”. (A vase shaped liked t^3 + C, when broken, creates shards in a t^2 pattern.

  • $\frac{d}{dx} \int y(t)$ means “The changes in $Y(t)$” which is $y(t)$ again. We’ve already setup Y(t) to have those changes.

  • Really want to think about what it means and have a narrative beyond the symbols.

  • Integrals: accumulation of changes. Anti-derivative: function that, when derived, gives the current pattern of changes. FTOC says these are the same [which is an insight! Can sidestep having to actually add up the changes. “Breaking the vase” analogy. Break a vase, don’t try to glue up the pieces.]

  • When doing DiffEqs, want a rock solid understanding of e, natural log, i, and friends. Have an intuition for all of these characters.

  • Have an intuition for the Chain Rule. See how we need some conversion factors in there as we go from u to v to w.

  • Goal is to build a model explaining the behavior. Black-Scholes model of how options “should” be priced given the various market forces, time, and the final condition at the end. What decay curve models the actual price? [Go from the description of the rules to the path that matches that description.]

  • Modeling: Get real data. Then construct a model (with some diffEqs). Generate data. Compare. How close is it? Does it predict accurately? Go from exponential to logistic (there is a carrying capacity, over that, you start decreasing population).

  • Exponential growth: y’ = ky

  • Exponential growth with carrying capacity y’ = ky(1 - y/N) [grow, but decrease as you get closer to N]

  • Exponential growth with carrying capacity and harvesting: y’ = ky(1 - y/N) - h [harvest at a constant rate]

We can make more complex models and see what happens. Will we ever run out? Given our starting point, what is going to happen? Will we over-harvest?

  • Can numerically approximate using a spreadsheet.

  • DiffEq like $y’ = e^t sin(y)$ is unstable. Because y starts changing by large amounts (due to $e^t$), will end up at random offsets ($sin(y)$ could be positive or negative). So small errors in calculation get you going positive or negative, changing slope by a large degree.

  • Homogenous equations. If we have x’ = bx + g(x), we can first worry about “x”. What solution will get us bx back out? Then worry about adding in a solution that will generate g(x) as well. We can combine them – one solution is only taking care of “bx”, the other will add in g(x) and possibly some bx term.

  • Eigenvector points in a direction and keeps pointing that way: $f(x) (0 \ 1)$. We have a function which controls its size but not the direction. It’s always pointed the same we, we aren’t changing the ratio of things inside the matrix. Both scaled the same amount.

  • Example: Navier Stokes in video games to model fluids, smoke, etc. Don’t have a better way to predict except to start the simulation and let it run. We have the “rules of how liquids diffuse” but can’t predict where they will end up. Need to walk it forward. Unsolved problem whether there even exists a solution (win a cool $1M - Clay institute).

  • Oliver's simple fluid dynamics simulator - see how realistic that looks? It’s because we have equations that model the real thing!

  • Solving the DiffEq isn’t that interesting to me. How can we learn to write it down? [We aren’t going to get analytic solutions, and even if we do, we’ll check with wolfram alpha etc. Like manually taking integrals. A few basics, but for a real-world scenario, just numerically integrate what you actually have].

  • What are differential equations? Our most realistic simulations of what’s happening. Here’s some examples: how would you get realistic smoke? Gravitational lensing? Etc. Hard to define ahead of time. You layout the rules of interaction and then walk them forward. If the rules are simple enough, you can predict where things go. Otherwise, you just have to follow them forward.

  • Most classes teach you how to solve (i.e., predict the position) for simple rules. But in practice you can’t. But learn to recognize simple shapes.

  • Rule: grow by current amount. Differential equation: d/dx y = x.

  • Analogy for football coach: You start following him, his coach gives him instructions to evade. Where do you end up? In the huddle and try to chase. Playbook. What’s in yours, what’s in theirs? What’s the end result? Differential equation is more a playbook than a running course. Playbook vs. course [where are you at time t?]. Walk in straight line, I’ll follow in a straight line too.

  • Double pendulum and chaos: don’t know when it will flip, but can detect what initial states will have a flip or not (and roughly speaking, how long it will be until it happens.). So we aren’t getting exact math solutions, we are setting up the “rules of behavior” and ask general questions about how things will play out. It’s not a simple mass-spring system we can deterministically figure out.

From Brandon:

"Off the top of my head, crash test simulations of vehicles (in the field of work I do) solve large sets (partial) differential equations. Anything related to FEA (finite element analysis) or CFD (computational fluid dynamics) is similar to what you are looking for. There are tons of YouTube videos related to this.

Let me look at some examples I may have and see if I can find a fun one that you may/may not want to use.

The Navier-Stokes is a differential equation that governs fluid flows and there is debate on whether an analytical solution exists for it. It’s one of the Millenium problems with a $1,000,000 prize. It is also the basis of most CFD software I mentioned, only able to be solved numerically. Maybe that’s interesting to you or maybe not!"

Also: The LaPlace transform gives you poles and zeros, to make general statements about the behavior of the system (even if no actual analytic solution).