Note : Probably, you made a mistake in writing the assignment. I will correct the task so that it can be solved.
Solve ordinary differential equation :
dx2d2y−2x⋅dxdy+(x2+2)y=e(x2+2)
From the theory we know that for solving the equation
y′′+f(x)⋅y′+g(x)⋅y=F(x)
convenient to introduce a new variable
y(x)=k(x)⋅exp(−21⋅∫f(x)dx)
In our case,
dx2d2yf(x)−2x⋅dxdy+g(x)(x2+2)y=F(x)e(x2+2)
Then,
f(x)=−2x→−21⋅∫f(x)dx=−21⋅∫(−2x)dx=2x2y(x)=k(x)⋅ex2/2→dxdy=k′⋅ex2/2+xk⋅ex2/2dxdy=ex2/2⋅(k′+xk)dx2d2y=k′′⋅ex2/2+xk′⋅ex2/2+k⋅ex2/2+xk′⋅ex2/2+x2k⋅ex2/2dx2d2y=ex2/2⋅(k′′+2xk′+k+x2k)
We substitute the found derivatives into the initial equation
dx2d2y−2x⋅dxdy+(x2+2)⋅y=e⋅(x2+2)ex2/2⋅(k′′+2xk′+k+x2k)−2x⋅ex2/2⋅(k′+xk)++(x2+2)⋅ex2/2⋅k=e⋅(x2+2)∣∣÷(e−x2/2)k′′+2xk′+k+x2k−2xk′−2x2k+x2k+2k=e−x2/2⋅e⋅(x2+2)k′′+3k=e−x2/2⋅e⋅(x2+2)
This is a second order inhomogeneous equation. The solutions will have the form :
k(x)=khom(x)+kpart(x),wherekhom(x):k′′+3k=0→k(x)=eλx→k′(x)=λ⋅eλxandk′′(x)=λ2⋅eλxeλx⋅(λ2+3)=0→⎣⎡λ1=i3λ2=−i3⟶khom(x)=A1⋅ei3x+A2⋅e−i3x≡C1cos(3x)+C2sin(3x)khom(x)=C1cos(3x)+C2sin(3x)
We look for a particular solution in the form
kpart(x)=e−x2/2⋅(Ax2+Bx+C)k′′=(e−x2/2)′′⋅(Ax2+Bx+C)+2(e−x2/2)′(Ax2+Bx+C)′+e−x2/2(Ax2+Bx+C)′′=e−x2/2(x2−1)(Ax2+Bx+C)++e−x2/2(−2x)(2Ax+B)+e−x2/2(2A)k′′+3k=e−x2/2((x2−1)(Ax2+Bx+C)−4Ax2−2Bx+2A)→e−x2/2((x2−1)(Ax2+Bx+C)−4Ax2−2Bx+2A)++3⋅e−x2/2(Ax2+Bx+C)=e(1−x2)/2(x2+2)∣∣÷(e−x2/2)Ax4+Bx3+Cx2−Ax2−Bx−C−4Ax2−2Bx+2A++3Ax2+3Bx+3C=e(x2+2)Ax4+Bx3+(C−2A−e)x2+(2A+2C−2e)=0⎩⎨⎧x4:A=0x3:B=0x2:C−2A−e=0→C=ex0:2A+2C−2e=0
Conclusion,
kpart(x)=e−x2/2⋅e
Then,
k(x)=khom(x)+kpart(x)→k(x)=C1cos(3x)+C2sin(3x)+e−x2/2⋅e
Finally, general solution is
y(x)=ex2/2⋅k(x)==(C1cos(3x)+C2sin(3x)+e−x2/2⋅e)⋅ex2/2→y(x)=(C1cos(3x)+C2sin(3x))⋅ex2/2+e
ANSWER
y(x)=(C1cos(3x)+C2sin(3x))⋅ex2/2+e
Comments