Solve the ODE $xy'-y=x^2$ for initial conditions $y(0)=0, -1$ and $1$
i found $y=x^2+cx$ but the answer from my lecturer is $y=Ce^x$ so how does he get that answer?
Solve the ODE $xy'-y=x^2$ for initial conditions $y(0)=0, -1$ and $1$
i found $y=x^2+cx$ but the answer from my lecturer is $y=Ce^x$ so how does he get that answer?
Copyright © 2021 JogjaFile Inc.
There are a few fishy things happening here. Regarding initial conditions, since at $x=0$ the ODE degenerates to $y(0)=0$, one cannot define $y(0)=\pm 1$. Moreover, plugging in the solution $y=Ce^x$ gives us
$$Ce^x(x-1)=x^2,$$
which is clearly not true for all $x$, so this solution cannot be correct for this ODE.
Away from $x=0$ we can divide the ODE by $x$ to write:
$$y' -\frac{1}{x} y =x.$$
Then, using integrating factors (multiply by $-\frac{1}{x}$), we have
$$\frac{d}{dx} \left( -\frac{1}{x}y\right) = -1.$$
Integrating both sides yields
$$-\frac{1}{x} y = -x+C$$
and so
$$y = x^2+Cx,$$
as you determined. Again, this problem does not seem well-posed because this general solution must have $y(0)=0$, no matter what value of $C$ I plug in. For this ODE to be well-posed, we must assign initial conditions at a non-zero value of $x$.