ODE
\[ (1-x)^2 y''(x)-4 (1-x) y'(x)+2 y(x)=\cos (x) \] ODE Classification
[[_2nd_order, _exact, _linear, _nonhomogeneous]]
Book solution method
TO DO
Mathematica ✓
cpu = 0.184776 (sec), leaf count = 24
\[\left \{\left \{y(x)\to \frac {-\cos (x)+c_1 (x-1)+c_2}{(x-1)^2}\right \}\right \}\]
Maple ✓
cpu = 0.18 (sec), leaf count = 29
\[\left [y \left (x \right ) = \frac {\textit {\_C1} x}{\left (x -1\right )^{2}}-\frac {\cos \left (x \right )}{\left (x -1\right )^{2}}+\frac {\textit {\_C2}}{\left (x -1\right )^{2}}\right ]\] Mathematica raw input
DSolve[2*y[x] - 4*(1 - x)*y'[x] + (1 - x)^2*y''[x] == Cos[x],y[x],x]
Mathematica raw output
{{y[x] -> ((-1 + x)*C[1] + C[2] - Cos[x])/(-1 + x)^2}}
Maple raw input
dsolve((1-x)^2*diff(diff(y(x),x),x)-4*(1-x)*diff(y(x),x)+2*y(x) = cos(x), y(x))
Maple raw output
[y(x) = 1/(x-1)^2*_C1*x-cos(x)/(x-1)^2+_C2/(x-1)^2]