Solve by the method of variation of parameters y'' - 2y' + y…
Solve by the method of variation of parameters $y'' - 2y' + y = \frac{e^x}{x}$.
Explanation of Method
A repeated-root equation with $y_1=e^x,\ y_2=xe^x$; a full independent check confirms $y^*=xe^x(\ln x-1)$ satisfies the ODE.
Step 1: Solve the homogeneous equation
\[ r^2 - 2r + 1 = (r-1)^2 = 0 \implies r=1\ (\text{double root}). \]
The fundamental system is
\[ y_1 = e^x, \qquad y_2 = xe^x. \]
Step 2: Wronskian
\[ W(y_1,y_2) = \begin{vmatrix} e^x & xe^x \\[4pt] e^x & (x+1)e^x \end{vmatrix} = e^{2x}(x+1) - xe^{2x} = e^{2x}. \]
Step 3: Set up the variation-of-parameters system
Write $y=u_1e^x+u_2xe^x$: \[u_1'e^x + u_2'xe^x = 0, \tag{I}\]
\[ u_1'e^x + u_2'(x+1)e^x = \frac{e^x}{x}. \tag{II} \]
Subtracting (I) from (II): $u_2'e^x=e^x/x$, so $u_2'=1/x$; then from (I), $u_1'=-xu_2'=-1$.
Step 4: Integrate
\[ u_1 = \int(-1)\,dx = -x, \qquad u_2 = \int\frac{dx}{x} = \ln x. \]
Step 5: Form the particular solution
\[ y^* = u_1e^x + u_2xe^x = -xe^x + xe^x\ln x = xe^x(\ln x - 1). \]
Step 6: Verify $y^*$
Differentiate $y^*=xe^x(\ln x-1)$: $y^{*\prime} = e^x(\ln x-1) + xe^x(\ln x-1) + e^x = e^x\bigl[(x+1)(\ln x-1)+1\bigr].$
\[ y^{*\prime\prime} = e^x\bigl[(x+1)(\ln x-1)+1\bigr] + e^x\!\left[(\ln x-1)+\frac{x+1}{x}\right] = e^x\!\left[(x+2)(\ln x-1)+1+\frac{x+1}{x}\right]. \]
Now form $y^{*\prime\prime}-2y^{*\prime}+y^*$ and collect the $(\ln x-1)$ coefficients separately from the rest:
\[ (\ln x-1)\bigl[(x+2)-2(x+1)+x\bigr] + \left(1+\frac{x+1}{x}-2\right) = (\ln x-1)\cdot0 + \frac{x+1}{x}-1 = \frac1x. \] So $y^{*\prime\prime}-2y^{*\prime}+y^*=e^x/x. $\checkmark$
Step 7: General solution
Since $y^*=xe^x\ln x - xe^x$ and $-xe^x$ is a multiple of $y_2=xe^x$, it is absorbed into $C_2xe^x$:
Result
Final answer:
\[\boxed{\,y = C_1e^x + C_2xe^x + xe^x\ln x\,}\]
Remark
Domain. The forcing term $e^x/x$ and the term $\ln x$ both require $x>0$.