# Linear Non-homogeneous Ordinary Differential Equations with complictted $r(x)$

Solve the following ode wihtout using variation of paramethers: $$y^{\prime\prime }-2y^\prime +y=\frac{e^x}{x}$$

Ususally when trying to solve problems in shape of $a_ny^{(n)}+a_{n-1}y^{(n-1)}+\dots +a_0y=r(x)$ we say that $y=y_h+y_p$ i.e is sum of $y_h$ a solution for homogenous equalation and $y_p$, a private solution chosen according to $r(x)$. the lecturer said that the following problem can be solved by using diagonalization of a matrix. I can't see here any matrix and I don't know how to solve such differential equations without variation of paramethers.

How can I solve the ode with diagonalization?

Hint: your ode can be rewritten in matrix form by defining the following variables:

$$y_1(t) = y(t), \quad y_2(t) = y'(t) = y_1'(t),$$

so you have:

$$y'_2 -2 y_2 + y_1 = e^x/x, \quad y'_1 = y_2,$$

and it can be arranged in matrix form as follows:

$$\left(\begin{array}{cc} y'_1 \\ y'_2 \end{array}\right) = \left(\begin{array}{cc} 0 & 1 \\ -1 & 2 \end{array}\right) \left(\begin{array}{cc} y_1 \\ y_2 \end{array}\right) + \left(\begin{array}{cc} 0 \\ e^x/x \end{array}\right).$$

The eigenvalues of the coefficient matrix are the roots of the characteristic equation for the homogenous part of the ode (my guess is that using diagonalization is only useful to solve this, not the complete ode).

Cheers.

Hint: let u = y' - y then you have u' - u =e^x/x and you have 1st order ODE. You then solve for u then for y.