Second-order linear ODEs

Where do the
solution formulas
come from?

A first-principles walkthrough of all three root cases — with analogies, interactive graphs, and every step of the math shown.

Distinct real roots Repeated root Complex roots
scroll

The equation and the magic guess

You have a second-order ODE that looks like this:

the ODE
\[ ay'' + by' + cy = 0 \]

Think of this as a rule about some unknown curve \(y(x)\): its acceleration \((y'')\), velocity \((y')\), and position \((y)\) must always mix together to give zero. Like a spring: the further it stretches, the harder it pulls back.

Analogy — the rubber band Most functions change shape when you differentiate them. \(\sin x\) becomes \(\cos x\), \(x^2\) becomes \(2x\). But \(e^{rx}\) is different — differentiating it just multiplies it by \(r\). It keeps its shape, just scaled. That's the only function with this property, and it's exactly what we need.

So we guess \(y = e^{rx}\) for some unknown \(r\). Then:

\(y = e^{rx}\)
our guess
\(y' = r e^{rx}\)
differentiate once — just multiplies by r
\(y'' = r^2 e^{rx}\)
differentiate again — multiplies by r²

Plug into the ODE:

\[ a\,r^2 e^{rx} + b\,r e^{rx} + c\,e^{rx} = 0 \]

Factor out \(e^{rx}\) — it's always positive, so it's never zero, we can divide it away:

characteristic equation
\[ ar^2 + br + c = 0 \]

A differential equation has become an algebra problem. That's the whole trick. Now we just solve for \(r\) using the quadratic formula:

\[ r = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

The term \(\Delta = b^2 - 4ac\) under the square root is called the discriminant. It's the fork in the road — everything depends on its sign.

Why two solutions? A second-order ODE needs two pieces of information to pin down a specific curve — like knowing both where you start and which direction you're heading. So we always need two independent solutions \(y_1\) and \(y_2\), and \(C_1, C_2\) are the two free constants.

The Wronskian \(W = y_1 y_2' - y_2 y_1'\) is how we check that two solutions are genuinely different — not the same solution wearing a disguise. If \(W \neq 0\), we're good.

Distinct real roots

CASE 01 Two different real numbers Δ > 0

The discriminant is positive, so the square root gives a real number. You get two different real values \(r_1\) and \(r_2\).

Analogy — two ramps Imagine two separate hills — one going steeply up, one gently down. You can ride either one alone, or any weighted blend of both. Each blending is a valid solution.

Each root gives a valid solution on its own:

\[ y_1 = e^{r_1 x}, \qquad y_2 = e^{r_2 x} \]

Because the ODE is linear (no \(y^2\), no products), any mixture of valid solutions is also valid. The general solution is:

general solution
\[ \boxed{y = C_1 e^{r_1 x} + C_2 e^{r_2 x}} \]

Wronskian check

Are these two solutions genuinely different, or are they secretly the same thing?

\(W = y_1 y_2' - y_2 y_1'\)
Wronskian definition
\(= e^{r_1 x} \cdot r_2 e^{r_2 x} - e^{r_2 x} \cdot r_1 e^{r_1 x}\)
plug in derivatives
\(= e^{(r_1+r_2)x}(r_2 - r_1)\)
factor out the exponential

Since \(r_1 \neq r_2\), the factor \((r_2 - r_1) \neq 0\), and exponentials are never zero. So \(W \neq 0\). They're independent. ✓

Interactive — distinct real roots
Worked example

\(y'' - 5y' + 6y = 0\)

\(r^2 - 5r + 6 = 0\)
characteristic equation
\((r-2)(r-3)=0\)
factor
\(r_1=2,\; r_2=3\)
two distinct real roots
\(y = C_1 e^{2x} + C_2 e^{3x}\)
general solution

Complex roots

CASE 02 Oscillation appears Δ < 0
Analogy — a swing When you push a swing, it oscillates back and forth. The \(e^{\alpha x}\) part decides whether the swings grow bigger, shrink away, or stay the same size forever. The \(\cos\) and \(\sin\) parts are the back-and-forth itself.

When \(\Delta < 0\), the square root gives an imaginary number. The roots come out as a conjugate pair:

\[ r = \alpha \pm \beta i, \qquad \alpha = \frac{-b}{2a},\quad \beta = \frac{\sqrt{4ac-b^2}}{2a} \]

This gives two complex solutions \(e^{(\alpha+\beta i)x}\) and \(e^{(\alpha-\beta i)x}\). They're valid, but complex-valued. We want real solutions.

Euler's formula is the translation dictionary between complex exponentials and trig:

\[ e^{i\theta} = \cos\theta + i\sin\theta \]

Complex exponentials and sines/cosines are the same thing — just written differently.

Expand the complex solutions using Euler's formula:

\(e^{(\alpha+\beta i)x} = e^{\alpha x}(\cos\beta x + i\sin\beta x)\)
Euler's formula applied
\(e^{(\alpha-\beta i)x} = e^{\alpha x}(\cos\beta x - i\sin\beta x)\)
conjugate
\(\dfrac{\text{sum}}{2} = e^{\alpha x}\cos\beta x\)
add them — imaginary parts cancel
\(\dfrac{\text{difference}}{2i} = e^{\alpha x}\sin\beta x\)
subtract them — real parts cancel

Both are real, both are valid solutions. Wronskian (after product rule expansion):

\[ W = \beta\, e^{2\alpha x} \]

Since \(\beta \neq 0\) (the roots are genuinely complex), \(W \neq 0\). They're independent. The general solution:

general solution
\[ \boxed{y = e^{\alpha x}(C_1\cos\beta x + C_2\sin\beta x)} \]
Interactive — complex roots (oscillation)
Worked example

\(y'' + 4y = 0\)

\(r^2 + 4 = 0\)
characteristic equation
\(r = \pm 2i\)
\(\alpha = 0,\;\beta = 2\)
\(y = C_1\cos 2x + C_2\sin 2x\)
pure oscillation — no growth or decay since \(\alpha=0\)

Repeated root

CASE 03 The borderline case Δ = 0
Analogy — two identical maps If both your solutions are \(e^{rx}\), you've just found the same solution twice. You haven't actually found a second direction — like having two identical maps instead of one for each axis. We need something genuinely different.

When \(\Delta = 0\), the quadratic gives only one root: \(r = -b/(2a)\). We have \(y_1 = e^{rx}\). But we need a second, independent solution.

Reduction of order — where \(xe^{rx}\) comes from

Instead of guessing a fixed form, we ask: what if the amplitude in front of \(e^{rx}\) is allowed to slowly drift? In other words, assume:

\[ y_2 = v(x)\,e^{rx} \]

where \(v(x)\) is some unknown function. Differentiate (product rule):

\(y_2' = e^{rx}(v' + rv)\)
product rule
\(y_2'' = e^{rx}(v'' + 2rv' + r^2v)\)
product rule again

Plug into the ODE and factor out \(e^{rx}\):

\[ a(v'' + 2rv' + r^2v) + b(v' + rv) + cv = 0 \]

Group the terms by what's multiplying \(v''\), \(v'\), and \(v\):

\(av''\)
the \(v''\) group
\(+(2ar+b)\,v'\)
the \(v'\) group — but \(r=-b/2a\) makes \(2ar+b=0\)
\(+\underbrace{(ar^2+br+c)}_{=\,0}\,v\)
\(r\) is a root of the characteristic eq., so this is zero

Both the \(v'\) and \(v\) terms vanish. We're left with the simplest possible ODE:

\[ av'' = 0 \implies v'' = 0 \]

Integrate twice:

\(v' = C_1\)
integrate once
\(v = C_1 x + C_2\)
integrate again

The simplest non-trivial choice is \(v = x\), giving \(y_2 = xe^{rx}\). Wronskian:

\[ W = e^{rx}(e^{rx}+rxe^{rx}) - xe^{rx}(re^{rx}) = e^{2rx} \neq 0 \]

Independent. The general solution:

general solution
\[ \boxed{y = (C_1 + C_2 x)\,e^{rx}} \]

Geometrically: \(e^{rx}\) and \(xe^{rx}\) are genuinely different shapes. One is a pure exponential; the other is an exponential that also climbs linearly. No constant multiple can turn one into the other.

Interactive — repeated root
Worked example

\(y'' - 4y' + 4y = 0\)

\(r^2 - 4r + 4 = 0\)
characteristic equation
\((r-2)^2 = 0\)
perfect square
\(r = 2\) (repeated)
only one root
\(y = (C_1 + C_2 x)e^{2x}\)
general solution

Summary

Every case flows from the same single idea: guess \(y = e^{rx}\), turn the ODE into the quadratic \(ar^2+br+c=0\), and read off the behavior from \(\Delta\).

Δ roots general solution physical behavior
> 0 two real \(r_1 \neq r_2\) \(C_1 e^{r_1 x} + C_2 e^{r_2 x}\) grow and/or decay
< 0 \(\alpha \pm \beta i\) \(e^{\alpha x}(C_1\cos\beta x + C_2\sin\beta x)\) oscillation ± envelope
= 0 one repeated \(r\) \((C_1 + C_2 x)e^{rx}\) knife-edge: exponential × linear ramp
The thread that ties everything together The repeated root case is at the exact boundary between the other two. As \(\Delta \to 0\) from above (two real roots collapsing into one), the solution \(C_1 e^{r_1 x} + C_2 e^{r_2 x}\) continuously deforms into \((C_1 + C_2 x)e^{rx}\). The \(xe^{rx}\) isn't magic — it's what the two-root solution becomes when the two roots merge.