y''+5y=x+2.
Solve first for y''+5y=0.
Let y=Asin(x√5)+Bcos(x√5), where A and B are constants, then:
y'=(A√5)cos(x√5)-(B√5)sin(x√5),
y''=-5Asin(x√5)-5Bcos(x√5)=-5y.
Therefore y''+5y=0.
Let y=ax+b, then y''=0 and y''+5y=5ax+5b.
Therefore 5ax+5b≡x+2.
Matching coefficients, a=⅕, b=⅖.
Now combine the two solutions for y:
y=Asin(x√5)+Bcos(x√5)+(x+2)/5 is the whole solution.