Introduction to the Differential Equations Special Series

A casual dive into first- and second-order linear differential equations, kicking things off with the integrating factor method — because this stuff shows up *everywhere* in nature!!

Title banner: Differential Equations Special

OK so today I wanna do a post about “(linear) differential equations” — the thing every STEM undergrad in college runs into an absurd number of times.

(Why, you ask??? Because I forgot it all lol. Let’s go — I’ll study while I write.)

Before we dive in — back in middle and high school, you spent a lot of time solving systems of equations, right? What did “solving an equation” mean back then? It meant: find the $x, y$ that make the equation true. Yeah?

Then what is a differential equation?????

I think you can put it really simply: it’s finding the function that makes the equation true.

So the goal of this post is — among linear differential equations, the one that shows up an insane amount in nature!! The simplest form of it, the “second-order linear differential equation”:

The goal: a₂ d²y/dx² + a₁ dy/dx + a₀y = f(x)

The goal is to crush and solve differential equations of this shape!! ($y$ and $f(x)$ are functions of $x$, the coefficients are constants, and $a_2\ne0$. When we divide by $a_2$, we divide the right-hand side by it too.) It’s a tiny tiny slice of the giant zoo of differential equations, but apparently it’s important because this exact form shows up everywhere in nature?!?!

<I’m studying out of Boas’s mathematical physics book, so the mathematical rigor might be… lacking ;; sorry. This is more of a methods-style discussion.. so ;;>

Now that we know where we’re going, let’s walk there step by step, starting with the easy stuff.

The first-order linear DE and the integrating factor

We’ll do the first-order linear differential equation before the second-order one.

First-order linear DE: y′ + Py = Q

When we run into a 1st-order linear DE that looks like this!! ($P, Q$ are both functions of $x$.) How do we crush and solve this?!?!

Let’s smash it with the integrating factor method!! First, The simpler equation y′ + Py = 0 — we’ll grab a clue by finding the solution to this simpler thing.

Separating the variables of y′ + Py = 0: (1/y) dy = −P dx, integrate both sides, ln y = ∫−P dx + C (constant of integration)

Exponentiating: y = e^(∫−P dx + C) = e^(∫−P dx) e^C = A e^(∫−P dx)

I just lumped some constant together and called it $A$. Kinda feels like I’m just integrating mindlessly, like an integration machine — The solution so far: y = A e^(∫−P dx) — and we’ve gotten this far.

Now what is this thing??

The original equation was The original equation written as y′ = −Py. If we apply what we just found to the left-hand side of this,

Left-hand side: y′ = d/dx (A e^(∫−P dx)) = −PA e^(∫−P dx)

Right-hand side: −Py = −P(A e^(∫−P dx))

Boom — we found the function of $x$ that makes the LHS equal the RHS!! That $y$ is

The solution y = A e^(∫−P dx) = A e^(−I), writing I ≡ ∫P dx for convenience; e^I is called the integrating factor

But wait — the solution we actually want: we need $y$ that satisfies The full equation y′ + Py = Q,,,,, ;_; what the heck what the heck!! T_T

OK let’s try multiplying both sides by the integrating factor $e^I$!?!?!

Multiplying by e^I: y′e^I + Pye^I = Qe^I, and since (ye^I)′ = y′e^I + Pye^I this says (ye^I)′ = Qe^I; integrating both sides, ye^I = ∫Qe^I dx + C′ (some constant)

Found the y that satisfies it: y = e^(−I)∫Qe^I dx + e^(−I)C′

So,

General solution of dy/dx + P(x)y = Q(x): y = e^(−I)∫Qe^I dx + e^(−I)C′ with I ≡ ∫P dx, to memorize and use whenever you meet one

And now,

A messy example: y′ + x/(1 + x) y = 2x/(1 + x²)

Even when a junk-looking equation like that stares us in the face, we are not even slightly scared anymore!!

The second-order linear DE, right-hand side 0

OK, onward.

Our destination is the second-order linear DE — so why did we bother with the first-order one…………

The reason is: handling the 2nd-order one, we get to recycle the stuff above wholesale heh heh heh

The goal again: a₂ d²y/dx² + a₁ dy/dx + a₀y = f(x)

Our goal!! Let’s write it down one more time?!?

Ah, one thing to notice — in the first-order DE we just did, the coefficients were functions of $x$. In the second-order DE, the coefficients are constants.

It’s not that you can’t solve it when the coefficients aren’t constants — apparently there’s a whole bag of case-by-case techniques. Variation of parameters or power-series methods, that kind of thing???? Anyway, the variable-coefficient case — we’re setting that aside.

The constant-coefficient goal: a₂ d²y/dx² + a₁ dy/dx + a₀y = f(x)

To work toward solving this, just like with the 1st-order, let’s start with the case where the right-hand side is 0 ^^

Right-hand side zero: a₂ d²y/dx² + a₁ dy/dx + a₀y = 0

Introducing the differential operator D ≡ d/dx, so Dy = dy/dx and yD = y d/dx

In operator form, (a₂D² + a₁D + a₀)y = 0; making the leading coefficient 1 gives (D² + 2c₁D + c₀²)y = 0

Let’s drag in the quadratic formula, the same way we factored stuff back in middle school.

Quadratic formula for D: D = −c₁ ± √(c₁² − c₀²), and the square root gets a placeholder subscript name

Ugh… what do I name the subscript ;_; I’ll just take the G from GD park…..

Factored: (D − (−c₁ + c_G))(D − (−c₁ − c_G))y = 0

$D$ is an operator, so the way you have to read this is~~~

Any y with (D + c₁ − c_G)y = 0 or (D + c₁ + c_G)y = 0 is a solution

Let’s try the first one.

The first factor is just a first-order DE, y′ + (c₁ − c_G)y = 0, so y₁ = A e^(−(c₁ − c_G)x) = A e^(−ax) with a ≡ c₁ − c_G

By the same principle, y₂ = B e^(−(c₁ + c_G)x) = B e^(−bx) with b ≡ c₁ + c_G

Making this jump — y’all aren’t, like, shocked or anything right?!?~~~!?! In case you’re like “bro he’s just integrating mindlessly like an integration machine again,,,” let me walk through it one more time.

The $y_1$ and $y_2$ that just appeared — what are they?

The equation a₂ d²y/dx² + a₁ dy/dx + a₀y = 0

They were $y$’s that satisfy this equation. And two of them popped out!! So if you plug $y_1$ into that equation, the equation holds —

Plugging in y₁: a₂ d²y₁/dx² + a₁ dy₁/dx + a₀y₁ = 0

and if you plug in $y_2$, the equation also holds.

Plugging in y₂: a₂ d²y₂/dx² + a₁ dy₂/dx + a₀y₂ = 0

Now here’s where you start to feel what “linear” actually means:

Because it’s linear, the linear combination of those two solutions is also a solution!!

Why do we keep saying linear linear linear linear /// I’m gonna throw up from all this linear linear — the reason it’s called linear is, <for more detail, look forward to my “Linear Algebra I Studied” series in the summer of 2015 ♡> → it’s out: Prologue: Heralding the Beginning (Linear Algebra I Studied #1)

The equation a₂ d²y/dx² + a₁ dy/dx + a₀y = 0 once more

because even if you plug $(y_1 + y_2)$ in for $y$ here, .,,,,,, it’s still a solution!

Huh???? Wanna try plugging it in?!

Plugging in y₁ + y₂: the terms regroup into the y₁ equation plus the y₂ equation, 0 + 0 = 0

(Lightbulb on!!) Ahhh I see~~ so ‘$y_1 + y_2$’ is also a solution?!?!

Rather than saying “the solution is $y_1$” or “the solution is $y_2$,” when we wanna talk in the most general terms, we lump them together and say “the solution is $y_1 + y_2$.” That’s the more comprehensive way to put it ~~~~~~ oh ho ho ho hong

So this solution is, apparently, called the General Solution ^^^ NOW do you see why it’s nauseating to keep saying linear linear linear like a broken record?!?!

So the general solution of what we just did above is~~

General solution: y = A e^(−ax) + B e^(−bx)

There’s one more thing to think about..!! Which is —

The quadratic formula for D again: D = −c₁ ± √(c₁² − c₀²)

Earlier I just kinda casually assumed the inside of the square root is positive ~~ and waltzed on past ;_; We also have to think about when it’s not positive.. It’ll be simple, right??

When the inside is negative: D = −c₁ ± i√(c₀² − c₁²) = −c₁ ± ic_G

So the general solution $y_1 + y_2$ is

Complex roots: y₁ + y₂ = A e^(−(c₁ − ic_G)x) + B e^(−(c₁ + ic_G)x) = e^(αx)(A e^(iβx) + B e^(−iβx)) with α ≡ −c₁, β ≡ c_G; Euler’s formula turns it into sines and cosines if you like

Shall we think about one more case? By now I bet you can guess what case~~ What if the inside of the square root is exactly 0?!?!

The repeated-root case (D − a)(D − a)y = 0

Easy.

With u ≡ (D − a)y the equation becomes (D − a)u = 0, a first-order DE, so u = A e^(ax)

Then y′ − ay = A e^(ax) gives y = (Ax + C′)e^(ax)

OK, summarizing in one sentence one more time!! Solving a linear 2nd-order equation with constant coefficients and zero on the right-hand side — introduce the operator $D$ and do the (equivalent of) factoring,

Summary for (D − a)(D − b)y = 0: if a ≠ b, y = A e^(ax) + B e^(bx); if a = b, y = (A′x + B′)e^(ax); for complex roots α ± iβ, exponentials or sines and cosines

Boom — we can now solve the RHS-equals-0 case of linear 2nd-order DEs ~~~~~~~~~

A nonzero right-hand side: the particular solution

We’re almost at the goal!! Finally,

The goal: a₂ d²y/dx² + a₁ dy/dx + a₀y = f(x)

We’re gonna find the $y$ that satisfies this. A few things to lay down first. T_T

Honestly, you can’t do this easily for just any $f(x)$… ;_; It’s a pretty limited case — but what if that limited situation happens to show up a lot in nature? Then its significance isn’t small at all, right~?~? I think it’ll be useful!!

So let’s go. When $f(x)$ is related to an exponential, we can find it suuuuper easily ~~!! So we’ll put $f(x) = k e^{cx}$ on the right-hand side, ta-da-da-da-da~ Then introduce operator $D$, same principle as before — we’ll start the discussion from here:

(D − a)(D − b)y = k e^(cx): with y_c (complementary solution, right-hand side 0) and y_p (particular solution), y_c + y_p still satisfies the equation, so it is the general solution

We already covered how to find $y_c$ earlier, so let’s go on a quest to find $y_p$. Go go go go go go go~!!

How does one find the particular solution?~?~?~?

Brute force, first pass: with (D − b)y ≡ u, (D − a)u = k e^(cx) gives u = k/(c − a) e^(cx) + C e^(ax)

Brute force, second pass: (D − b)y = u gives y = k/((c − a)(c − b)) e^(cx) + (constant) e^(ax) + C′ e^(bx), so y_p looks like E e^(cx)

Lemme think about this juuust a tiny bit more simply~!! Brute forcing? Nope nope nope nope!!

Guessing: y″ − (a + b)y′ + aby = k e^(cx), so y_p must be of the form E e^(cx)

Plugging y_p = E e^(cx) in gives E = k/((c − a)(c − b)), the same as the brute-force result

Here again we have to split into cases………………… ;; This post is getting way too long, so I’ll show just one more case and then wrap it up?? That cool!?~ It’s already plenty long and I’m scared it’s gonna get longer ;; Sob sob, sorry for blowing this up like this over content that’s not even that big a deal T_T

When c = a (a ≠ b): (D − c)(D − b)y = k e^(cx), and the first pass gives u = kx e^(cx) + A e^(cx)

Second pass with integration by parts: y = Kx e^(cx) + A′e^(cx) + B′e^(bx); the green terms are the complementary solution, the red one is y_p

If you brute force through all of them you can pin down the form of $y_p$ for each case!!!!! Fun, right?!?!

Summary table: y_p = C e^(cx) when c differs from a and b, C x e^(cx) when c equals a (or b), C x² e^(cx) when a = b = c

Rather than calling it a proof — since we showed that the form of $y_p$ comes out like that, from here on we just say “the form of $y_p$ is that!!" then determine the constant $C$, and we walk our way to the general solution!!

One more thing to add,

For a₂y″ + a₁y′ + a₀y = k sin αx: extend it to a₂Y″ + a₁Y′ + a₀Y = k e^(iαx), take Y_p = C e^(iαx) from the formula, then keep the imaginary part

Same resonance warning as before: if $i\alpha$ is a characteristic root, multiply the guess by $x$ (or $x^2$ for a double root) before solving for its coefficient. Otherwise its denominator would be zero!

And that’s the method of solving 2nd-order linear differential equations, up to here. I’ll upload worked-out practice problems when I’m bored.

The spring problem — extremely important in physics — and stuff like the RLC circuit in circuit theory — it’s so satisfying when you can swoosh~ through and crush them with the 2nd-order DE method above ?~?~?~

Everybody, be happy ~


Heads-up. The figures here are the original notes, slips and all. A few things to watch for:

  • In the first-order separation, use $\ln|y|$ on an interval where $y\ne0$; the final arbitrary $A$ includes negative values and $A=0$. In operator notation, $Dy=y'$ is a function, whereas $yD$ is an operator acting on whatever follows; they cannot be swapped.
  • In the complex-root case, $c_G$ is defined by $c_0^2 - c_1^2 = c_G^2$ (the note keeps the earlier $c_1^2 - c_0^2$), so that $D = -c_1 \pm ic_G$. And in case iii) of the summary, the factor is $e^{\alpha x}$, not $e^{ax}$: $y = e^{\alpha x}(A\cos\beta x + B\sin\beta x)$.
  • In the brute-force solution of $(D - a)(D - b)y = ke^{cx}$, the second term carries the constant $C$ from $u$: $\frac{C}{a - b}e^{(a-b)x}$, not $\frac{c}{a - b}$.
  • In the case $c = a$, the integrating factor comes from $I = \int -b\,dx = -bx$ (not $\int -bx\,dx$), the parts integral is $\int kx\,e^{(c-b)x}dx = \frac{kx}{c - b}e^{(c-b)x} - \int \frac{k}{c - b}e^{(c-b)x}dx$, and the line after it is $\frac{kx}{c - b}e^{cx} - \frac{k}{(c - b)^2}e^{cx} + \frac{A}{c - b}e^{cx} + Be^{bx}$; the form $Kxe^{cx} + A'e^{cx} + B'e^{bx}$ is right. In the summary table, the conditions are on the exponent $c$ (lowercase), not on a constant $C$.

Comments

Discussion happens via GitHub Discussions. You'll need a GitHub account to comment.