# Thread: Differential Eq. - Separation of Variables

1. ## Differential Eq. - Separation of Variables

Solve the following Differential Equation:

$\displaystyle \frac{dy}{dx}=x(1-y)$ , $\displaystyle y(1)=0$

$\displaystyle \frac{1}{1-y}dy=xdx$

$\displaystyle u= 1-y$ , $\displaystyle du=-1dy \rightarrow dy=-du$

$\displaystyle -\int \frac{1}{u}du=\int xdx$

$\displaystyle -\ln(u) = \frac{x^2}{2} + C \rightarrow -\ln(1-y)=\frac{x^2}{2} + C$

$\displaystyle \ln(1-y)=-\frac{x^2}{2} - C \rightarrow 1-y=e^{-\frac{x^2}{2} - C}$

$\displaystyle y=-e^{-\frac{x^2}{2} - C} + 1$

Did I do up to here correctly?

2. Originally Posted by VitaX
Solve the following Differential Equation:

$\displaystyle \frac{dy}{dx}=x(1-y)$ , $\displaystyle y(1)=0$

$\displaystyle \frac{1}{1-y}dy=xdx$

$\displaystyle u= 1-y$ , $\displaystyle du=-1dy \rightarrow dy=-du$

$\displaystyle -\int \frac{1}{u}du=\int xdx$

$\displaystyle -\ln(u) = \frac{x^2}{2} + C \rightarrow -\ln(1-y)=\frac{x^2}{2} + C$

$\displaystyle \ln(1-y)=-\frac{x^2}{2} - C \rightarrow 1-y=e^{-\frac{x^2}{2} - C}$

$\displaystyle y=-e^{-\frac{x^2}{2} - C} + 1$

Did I do up to here correctly?
Dear VitaX,

Yes, you are correct.

3. Originally Posted by Sudharaka
Dear VitaX,

Yes, you are correct.
Alright my problem now is solving for C with the initial condition stated.

$\displaystyle 0=-e^{-\frac{(1)^2}{2} - C} + 1$

How do I solve for C now because if I bring 1 to the left side and raise both sides to Ln, that doesn't work out since Ln of -1 is non real answer. What can I do to solve for C?

4. Originally Posted by VitaX
Solve the following Differential Equation:

$\displaystyle \frac{dy}{dx}=x(1-y)$ , $\displaystyle y(1)=0$

$\displaystyle \frac{1}{1-y}dy=xdx$

$\displaystyle u= 1-y$ , $\displaystyle du=-1dy \rightarrow dy=-du$

$\displaystyle -\int \frac{1}{u}du=\int xdx$

$\displaystyle -\ln(u) = \frac{x^2}{2} + C \rightarrow -\ln(1-y)=\frac{x^2}{2} + C$

$\displaystyle \ln(1-y)=-\frac{x^2}{2} - C \rightarrow 1-y=e^{-\frac{x^2}{2} - C}$

$\displaystyle y=-e^{-\frac{x^2}{2} - C} + 1$

Did I do up to here correctly?
You're missing an important modulus and $\displaystyle \pm$.

$\displaystyle \frac{dy}{dx} = x(1 - y)$

$\displaystyle \frac{1}{1 - y}\,\frac{dy}{dx} = x$

$\displaystyle \int{\frac{1}{1 - y}\,\frac{dy}{dx}\,dx} = \int{x\,dx}$

$\displaystyle \int{\frac{1}{1 - y}\,dy} = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} + C_2 = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} = \frac{x^2}{2} + C$ where $\displaystyle C = C_1 - C_2$

$\displaystyle \ln{|1 - y|} = -\frac{x^2}{2} - C$

$\displaystyle |1 - y| = e^{-\frac{x^2}{2} - C}$

$\displaystyle |1 - y| = e^{-C}e^{-\frac{x^2}{2}}$

$\displaystyle 1 - y = Ae^{-\frac{x^2}{2}}$ where $\displaystyle A = \pm e^{-C}$

$\displaystyle y = 1 - Ae^{-\frac{x^2}{2}}$.

Now if $\displaystyle y(1) = 0$ then

$\displaystyle 0 = 1 - Ae^{-\frac{1^2}{2}}$

$\displaystyle 0 = 1 - Ae^{-\frac{1}{2}}$

$\displaystyle Ae^{-\frac{1}{2}} = 1$

$\displaystyle A = e^{\frac{1}{2}}$.

Therefore $\displaystyle y = 1 - e^{\frac{1}{2}}e^{-\frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1}{2} - \frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1 - x^2}{2}}$.

5. Originally Posted by Prove It
You're missing an important modulus and $\displaystyle \pm$.

$\displaystyle \frac{dy}{dx} = x(1 - y)$

$\displaystyle \frac{1}{1 - y}\,\frac{dy}{dx} = x$

$\displaystyle \color{red}{\int{\frac{1}{1 - y}\,\frac{dy}{dx}\,dx} = \int{x\,dx}}$

$\displaystyle \int{\frac{1}{1 - y}\,dy} = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} + C_2 = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} = \frac{x^2}{2} + C$ where $\displaystyle C = C_1 - C_2$

$\displaystyle \ln{|1 - y|} = -\frac{x^2}{2} - C$

$\displaystyle |1 - y| = e^{-\frac{x^2}{2} - C}$

$\displaystyle |1 - y| = e^{-C}e^{-\frac{x^2}{2}}$

$\displaystyle 1 - y = Ae^{-\frac{x^2}{2}}$ where $\displaystyle A = \pm e^{-C}$

$\displaystyle y = 1 - Ae^{-\frac{x^2}{2}}$.

Now if $\displaystyle y(1) = 0$ then

$\displaystyle 0 = 1 - Ae^{-\frac{1^2}{2}}$

$\displaystyle 0 = 1 - Ae^{-\frac{1}{2}}$

$\displaystyle Ae^{-\frac{1}{2}} = 1$

$\displaystyle A = e^{\frac{1}{2}}$.

Therefore $\displaystyle y = 1 - e^{\frac{1}{2}}e^{-\frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1}{2} - \frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1 - x^2}{2}}$.
Dear Prove It,

Silly me!! I did'nt notice the error of the modulus sign. Thank you very much for showing us that mistake. Anyhow although insignificant, there is a typo in your third line.

Goodbye!!

6. I follow you up until you bring A into the equation. I'm not quite sure why you do that because I really wasn't taught anything about that.
I should say that this question here is from Calculus II, and that we've only just gone into the intro to Differential Equations, nothing serious. Is there another way to do it without introducing the A? What's this modulus?

Originally Posted by Prove It
You're missing an important modulus and $\displaystyle \pm$.

$\displaystyle \frac{dy}{dx} = x(1 - y)$

$\displaystyle \frac{1}{1 - y}\,\frac{dy}{dx} = x$

$\displaystyle \int{\frac{1}{1 - y}\,\frac{dy}{dx}\,dx} = \int{x\,dx}$

$\displaystyle \int{\frac{1}{1 - y}\,dy} = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} + C_2 = \frac{x^2}{2} + C_1$

$\displaystyle -\ln{|1 - y|} = \frac{x^2}{2} + C$ where $\displaystyle C = C_1 - C_2$

$\displaystyle \ln{|1 - y|} = -\frac{x^2}{2} - C$

$\displaystyle |1 - y| = e^{-\frac{x^2}{2} - C}$

$\displaystyle |1 - y| = e^{-C}e^{-\frac{x^2}{2}}$

$\displaystyle 1 - y = Ae^{-\frac{x^2}{2}}$ where $\displaystyle A = \pm e^{-C}$

$\displaystyle y = 1 - Ae^{-\frac{x^2}{2}}$.

Now if $\displaystyle y(1) = 0$ then

$\displaystyle 0 = 1 - Ae^{-\frac{1^2}{2}}$

$\displaystyle 0 = 1 - Ae^{-\frac{1}{2}}$

$\displaystyle Ae^{-\frac{1}{2}} = 1$

$\displaystyle A = e^{\frac{1}{2}}$.

Therefore $\displaystyle y = 1 - e^{\frac{1}{2}}e^{-\frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1}{2} - \frac{x^2}{2}}$

$\displaystyle y = 1 - e^{\frac{1 - x^2}{2}}$.

7. Originally Posted by Sudharaka
Dear Prove It,

Silly me!! I did'nt notice the error of the modulus sign. Thank you very much for showing us that mistake. Anyhow although insignificant, there is a typo in your third line.

Goodbye!!
No, there's nothing wrong. I've used the CORRECT notation, not the sloppy "treat the derivative as a fraction" notation.

8. Originally Posted by VitaX
I follow you up until you bring A into the equation. I'm not quite sure why you do that because I really wasn't taught anything about that.
I should say that this question here is from Calculus II, and that we've only just gone into the intro to Differential Equations, nothing serious. Is there another way to do it without introducing the A?
You should know the rule for exponentials

$\displaystyle a^{m + n} = a^ma^n$.

All I've done is renamed $\displaystyle \pm e^{-C}$ as $\displaystyle A$.

9. Originally Posted by Prove It
No, there's nothing wrong. I've used the CORRECT notation, not the sloppy "treat the derivative as a fraction" notation.
Ah!! I get it. Thanks again.

10. Originally Posted by Prove It
You should know the rule for exponentials

$\displaystyle a^{m + n} = a^ma^n$.

All I've done is renamed $\displaystyle \pm e^{-C}$ as $\displaystyle A$.
Yah I know that rule. I guess I just didn't figure a substitution needed to be done here as we've never really used one like you did in our problems. Why the +/- though? I suppose that's because it is still an intro to Differential Equations. And also I was wondering what your 3rd line was about, but I see now. And the "sloppy" method of treating the derivative as a fraction. That's the method I was taught in class so far

Edit:

$\displaystyle y=-e^{-\frac{x^2}{2}}e^{-C} + 1 \rightarrow 0=-e^{-\frac{(1)^2}{2}}e^{-C} + 1$

$\displaystyle -\frac{1}{e^{-C}}=-e^{-\frac{1}{2}} \rightarrow -e^C=-e^{\frac{1}{2}}$

$\displaystyle \ln-e^C=\ln-e^{\frac{1}{2}} \rightarrow -C=-\frac{1}{2}$

$\displaystyle C=\frac{1}{2}$

So this is what you were getting at basically? If not where did I go wrong?

Plug back in:

$\displaystyle y=-e^{\frac{-x^2-1}{2}} + 1$

11. The only differences between our answers is a minus sign:

My answer: $\displaystyle y=1-e^{\frac{-x^2-1}{2}}$

Prove's answer: $\displaystyle y=1-e^{\frac{-x^2+1}{2}}$

I should say that I have to then compare or do % error between some values in Euler's Rule, which I already did. And Your answer is the correct one. Can anyone tell me how I got an extra minus sign in there? Or perhaps my value for C I obtained is wrong?

12. Originally Posted by VitaX
Yah I know that rule. I guess I just didn't figure a substitution needed to be done here as we've never really used one like you did in our problems. Why the +/- though? I suppose that's because it is still an intro to Differential Equations. And also I was wondering what your 3rd line was about, but I see now. And the "sloppy" method of treating the derivative as a fraction. That's the method I was taught in class so far

Edit:

$\displaystyle y=-e^{-\frac{x^2}{2}}e^{-C} + 1 \rightarrow 0=-e^{-\frac{(1)^2}{2}}e^{-C} + 1$

$\displaystyle -\frac{1}{e^{-C}}=-e^{-\frac{1}{2}} \rightarrow \color{red}{-e^C=-e^{\frac{1}{2}}}$

$\displaystyle \ln-e^C=\ln-e^{\frac{1}{2}} \rightarrow -C=-\frac{1}{2}$

$\displaystyle C=\frac{1}{2}$

So this is what you were getting at basically? If not where did I go wrong?

Plug back in:

$\displaystyle y=-e^{\frac{-x^2-1}{2}} + 1$
Dear VitaX,

Please check the part highlighted. Did you find the mistake?

13. Originally Posted by Sudharaka
Dear VitaX,

Please check the part highlighted. Did you find the mistake?
Oh, thanks for that. I would have been searching for a while to find my error.