For a repeated root the second solution $te^{rt}$ seemed to come from nowhere. Reduction of order is the systematic version: if you know one solution $y_1$ of a second-order linear homogeneous equation, it produces a second one, even when the coefficients are not constant.
🔑 Key idea
Put $y'' + p(t)y' + q(t)y = 0$ in standard form and set $y = v(t)\,y_1(t)$. Then $w = v'$ satisfies a first-order equation, and $$y_2 = y_1\int \frac{e^{-\int p\,dt}}{y_1^{2}}\,dt.$$
💡 Why it works
With $y = vy_1$: $y' = v'y_1 + vy_1'$ and $y''$ $= v''y_1 + 2v'y_1' + vy_1''$. Substituting, $$v\underbrace{(y_1'' + py_1' + qy_1)}_{=\,0} + v''y_1 + v'(2y_1' + py_1) = 0.$$ The terms with $v$ itself cancel because $y_1$ is a solution. With $w = v'$: $y_1w' + (2y_1' + py_1)w = 0$, which separates: $\frac{w'}{w} = -\frac{2y_1'}{y_1} - p$, so $w = \frac{e^{-\int p\,dt}}{y_1^{2}}$. Integrate once more for $v$.
✏️ Worked example: Where $te^{rt}$ comes from
$y_1 = e^{3t}$ solves $y'' - 6y' + 9y = 0$. Find a second solution.
Reading $p$ before dividing by the coefficient of $y''$ (using $-3$ instead of $-\frac{3}{t}$ in the second example) gives a wrong $w$. Also remember $y_2 = v\,y_1$, not $v$ alone. Any constant multiple of $y_2$, or $y_2$ plus a multiple of $y_1$, is just as good, so constants of integration can be dropped. Finish by substituting $y_2$ into the equation.
$y_1 = t^{2}$ and $y_2 = t^{2}\ln t$ from the second example. The factor $v = \ln t$ bends $y_2$ away from $y_1$, so neither is a multiple of the other.
This connects with the Wronskian. The function $w = v'$ found here is $\left(\frac{y_2}{y_1}\right)' = \frac{W}{y_1^{2}}$, and $e^{-\int p\,dt}$ is exactly Abel's formula for $W$. So reduction of order says: choose the Wronskian you want, then integrate $\frac{W}{y_1^{2}}$ and multiply by $y_1$. The same substitution $y = vy_1$ also works for the nonhomogeneous equation; then the first-order equation for $w$ gains a right side.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.