Answer
See below
Work Step by Step
Given $y''+2y'+y=x^{-1}e^x$
In this case the substitution $y(x) = e^{rx}$ yields the indicial equation
$r^2+2y+1=0$
It follows that two linearly independent solutions to the given differential equation are
$y_1(x)=e^{-x}\\
y_2(x)=xe^{-x}$
so that the general solution is
$y(x)=u_1e^{-x}+u_2e^{-x}$
We first compute the appropriate derivatives
$y'=e^{rx}(u'+u)=u_1'(x)e^{-x}+u_2'(x)xe^{-x}\\
y''=e^{rx}(u''+u)=u_1'(x)(e^{-x})'+u_2'(x)(xe^{-x})'$
Substituting these expressions into the given equation, we find that $u$ must satisfy
$u_2'(e^{-x})=\frac{e^x}{x}\\
\rightarrow u_2'(x)=\frac{e^{2x}}{x}\\
\rightarrow u_2(x)=\frac{(2x-1)e^{2x}}{x^2}$
and $u_1'(x)=-e^{2x}\\
\rightarrow u_2(x)=-\frac{e^{2x}}{2}$
Hence, the general solution is:
$y(x)=C_1e^{-x}+C_2xe^{-x}-\frac{1}{2}e^x+xe^{-x}(\frac{(2x-1)e^{2x}}{x^2})$