5
$\begingroup$

I was given the equation

$y' = -xy$, where $y(0) = 1$.

My solution was as follows:

$$\frac{dy}{dx} = -xy $$

$$dy = -xy \ dx $$

$$\int {dy} = \int {-xy dx} $$

$$y = -\frac{x^2}{2}y + c $$

$$y + \frac{x^2}{2}y = c $$

$$y(1 + \frac{x^2}{2}) = c $$

$$y = \frac{c}{1 + \frac{x^2}{2}} $$

I tried plugging in $0$ and $1$ respectively to find $c$, and got $c = 0$.

I just know that what I did is wrong. Where did I go wrong, please? Thanks!

$\endgroup$
  • 1
    $\begingroup$ Why don't you separate the variables like $$\frac{dy}{y}=-xdx?$$ Also the final conclusion is definitely wrong. $\endgroup$ – Fakemistake Feb 24 at 9:20
11
$\begingroup$

Hint:

This is a variable separable differential equation that is we can separate the differential equation such that for some functions $f(x)$ and $g(y)$: $f(x)\mathrm dx =g(y)\mathrm dy$. $$\dfrac{\mathrm dy}{\mathrm dx}=-xy \implies \int \dfrac{1}{y}\mathrm dy =-\int x \mathrm dx$$

Now all that is left is to compute the integral and use the inital condition to figure out the value of constant. Can you proceed?


Note that you cannot simply integrate $-xy$ wrt $x$. Your computation assumes that $y$ is a constant which it most certainly is not.

$\endgroup$
  • 1
    $\begingroup$ That helped a lot! Thank you! $\endgroup$ – A.Smith Feb 24 at 15:25
4
$\begingroup$

(Too long for a comment.)

No one else has mentioned this, so I will...

Remember: $y$ is a function of $x$, not something that is constant with respect to variation of $x$. (Forgetting this is a fairly common error when first performing implicit differentiation.) It can help to write "$y(x)$" rather than just "$y$".

Your error is believing $\int -x y(x) \, \mathrm{d}x = \frac{-1}{2}x^2 y$. But $y$ is not some constant in this integral; it is a function that depends on $x$. Otherwise, what is written could be the absurdity (when, say $y(x) = \frac{1}{x^2}$), "$\int -x \cdot \frac{1}{x^2} \,\mathrm{d}x = \frac{-1}{2} x^2 \cdot \frac{1}{x^2} + C_1 = C$" rather than the correct $$ \int -x \cdot \frac{1}{x^2} \,\mathrm{d}x = \ln|x| + C \text{.} $$

Quick way to verify this: Implicitly differentiate your antiderivative to see if you get the integrand and differential element back:\begin{align*} \left( \frac{-1}{2}x^2 y(x) \right)' &= \frac{-1}{2}x^2 (y(x))' + \left( \frac{-1}{2}x^2 \right)' y(x) \\ &= \frac{-1}{2}x^2 \,\mathrm{d}y(x) + \left( \frac{-1}{2} \cdot 2 x \,\mathrm{d}x \right) y(x) \\ &= \frac{-1}{2}x^2 \,\mathrm{d}y(x) - x y(x) \,\mathrm{d}x \text{,} \end{align*} which isn't quite "$- x y\,\mathrm{d}x$".

(However, we have shown \begin{align*} \int \left( \frac{-1}{2}x^2 \frac{\mathrm{d}y(x)}{\mathrm{d}x} - x y(x) \right) \,\mathrm{d}x &= \int \frac{\mathrm{d}}{\mathrm{d}x} \left( \frac{-1}{2}x^2 y(x) \right) \, \mathrm{d} x \\ &= \frac{-1}{2}x^2 y(x) + C \text{.} \end{align*} Familiarity with this kind of manipulation could be useful in the future.)

$\endgroup$
3
$\begingroup$

After writing

$$\int\frac{\mathrm{d}y}{y}=\int -x\,\mathrm{d}x,$$

you get $\ln|y|=-\frac{x^2}{2}+c_1$, which implies

$$y(x)=c\exp(-x^2/2)\quad\text{for}\quad c=\pm\exp(c_1).$$

After plugging in $y(0)=1$, you get $c=1$, so

$$y(x)=\exp(-x^2/2).$$

$\endgroup$
  • $\begingroup$ Thank you so so much! I super appreciate it! $\endgroup$ – A.Smith Feb 24 at 15:53
  • $\begingroup$ You're welcome :) $\endgroup$ – st.math Feb 24 at 16:32
3
$\begingroup$

Here is another method that does not use separation of variables and uses integrating factors. Write $$ y'+xy=0 $$ and multiply both sides by $e^{\int x\, dx}=e^{x^2/2}$ to get that $$ 0=y'e^{x^2/2}+xye^{x^2/2}=\frac{d}{dx}(ye^{x^2/2}). $$ So $$ ye^{x^2/2}=c\implies y=ce^{-x^2/2} $$ for some $c$. Since $y(0)=1$, we deduce that $$ y=\exp(-x^2/2). $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.