Where does $xe^x$ solution come from when the characteristic polynomial is square?
Solution 1:
Here is an algebraic way to do this. Suppose that the caracteristic equation of $y'' + ay' + y =0$ has a double root $r$. This means that $X^2 + aX + b = (X-r)^2$, hence $y'' + ay' + y = A^2(y)$, where $A$ is the endomorphism : $$ A(y) = (D-r)(y) = y' - ry,$$ where $D$ is the usual derivation. The kernel of $A$ is well known. Thus $A(e^{rx})=0$.
Note that $A$ satisfies the Leibnitz rule in the following sense : $$ A(fg) = f' \times g + f \times A(g).$$
Hence in order to solve $A^2(y)=0$, write $y(x) = z(x)e^{rx}$. The Leibnitz rule and the fact that $A(e^{rx})=0$ imply : $$ A(y) = z'(x) e^{rx}.$$ $$ A^2(y) = z''(x) e^{rx}.$$ So $A^2(y)=0$ iff $z''(x)=0$.
Some highlights : there is the notion of a differential module $M$ over a differential ring $R$. Here the ring $R$ is $C^\infty(\mathbb{R})$ (or you can also take $\mathbb{R}[X]$) with usual derivation and the module $M$ is $C^\infty(\mathbb{R})$ where the derivation is $A=D-r$. Here I have just found a basis in order to make $M$ isomorphic to $R^n$.
Solution 2:
I don't know if you think it's "natural", but the $x$ comes from the method of reduction of order. If $y_1$ is a one solution of a linear, homogeneous equation and we need a second, linearly independent solution, a reasonable guess is $y_2 = v(x)y_1$. Sort of as you explain it, $ce^{rx}$ is a solution for all constants $c$, but they're all linearly dependent. So we keep the "solution-ness" of the $e^{rx}$ but remove the "constant-ness" of the $c$ by replacing it with a function $v(x)$. Then by straightforward calculations, we find, in your case, that $v=x$ works.
Solution 3:
I have also wondered about this question for some time, but the most satisfactory answer that I got was that the following:
if $r_0$ is a double root of the characteristic equation of a differential equation of constant coefficient, i.e
$$L(e^{rx}) = p(r) e^{rx},$$ where $p$ is the characteristic polynomial of the ODE correspond to $L$, and $p(r_0) = 0$. Then $p$ has the form $$p(r) = A \cdot (r-r_0)^2.$$
Now observe that
$$p'(r) = A \cdot 2 \cdot (r-r_0),$$ hence $r_0$ is also a root of $p'(r)$.
Therefore, if we differentiate $L$ wrt $r$, we get
$$\frac{dL(e^{rx})}{dr} = \frac{dL(e^{rx})}{ d(e^{rx}) } * \frac{d((e^{rx}))}{dr } = p(r) \cdot xe^{rx} = L(x \cdot e^{rx})$$
and also $$\frac{dL(e^{rx})}{dr}= \frac{d(p(r)e^{rx})}{dr} = [p'(r) + xp(r)]\cdot e^{rx},$$
hence
$$L(x \cdot e^{rx}) = [p'(r) + xp(r)]\cdot e^{rx},$$ and plugging $r = r_0$, we see that
$$L(x e^{r_0 x}) = 0,$$ since both $p'(r_0)$ and $p(r_0)$ equal to zero.
Therefore, $x e^{r_0 x}$ is also a solution of the ODE given by $L$.Moreover, since $e^{rx}$ and $xe^{rx}$ are linearly independent, we have two independent solution from a double root.
tl:dr
When the the characteristic equation has double root $r_0$, the very fact that $r_0$ is both a zero of $p(r)$ and $p'(r)$ makes $xe^{r_0 x}$ another independent solution.