# Thread: Differential Eq. - Separation of Variables

1. ## Differential Eq. - Separation of Variables

Solve the following Differential Equation:

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

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

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

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

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

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

$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:

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

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

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

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

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

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

$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.

$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:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Now if $y(1) = 0$ then

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Now if $y(1) = 0$ then

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

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

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

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

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

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

$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 $\pm$.

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

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

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

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

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

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

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

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

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

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

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

Now if $y(1) = 0$ then

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

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

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

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

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

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

$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

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

All I've done is renamed $\pm e^{-C}$ as $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

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

All I've done is renamed $\pm e^{-C}$ as $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:

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

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

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

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

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

Plug back in:

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

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

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

Prove's answer: $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:

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

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

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

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

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

Plug back in:

$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.