Thread: Solving a first-order nonlinear ordinary differential equation

1. Solving a first-order nonlinear ordinary differential equation

xy' + y^2 = 1, y(1) = 0
xy' = 1 - y^2
dy / (1-y^2) = dx / x

Need to take into account the possiblity of having "divided away" solution. We check if = +/- 1 are solutions by inserting them into the equation. They aren't solutions.

Moving on. We get (1/2)ln|1+y| - (1/2)ln|1-y| = ln|x| + C

This is where I'm stuck. Since we have the initial condition y(1) = 0 we need to figure out C in this step before moving on, right? What I've done in previous exercises is to isolate y and take it from there, but I don't know how to do it in this case. I've tried doing the following:

ln| (1+y) / (1-y) | = ln|x|^2 + 2C
Multiply with e and we get
| (1+y) / (1-y) | = x^2 + e^(2C)

But, well, I can't get it to work out.

2. It's easiest if you write your starting arbitrary constant as ln(C), which is still a constant. Then you can simplify using logarithm rules.

3. Oh.

So, then it goes:
(1/2)ln| 1+y | - (1/2)ln| 1-y | = ln| x | + ln| C |
ln (1+y) / (1-y) = ln| x |^2 + ln | C | ^2

Multiply by e
(1+y) / (1-y) = x^2 + C^2
1+y = (x^2 + C^2)(1-y)
y = x^2 + C^2 - 1 - y(x^2 + C^2)
y(1 + x^2 + C^2) = x^2 + C^2 - 1
y = (x^2 + C^2 - 1) / (x^2 + C^2 + 1)

y(1) = 0 = (1^2 + C^2 - 1) / (1^2 + C^2 + 1) = C^2 / (2 + C^2) => C = 0

Solution is y = (x^2 - 1) / (x^2 + 1) (Which according to wolfram is correct)

I did end up at the correct answer, but is my path there correct?

Also, it's fine to use ln|C| instead of C, since it's just a constant, that is, it's whatever we want it to be?

4. Originally Posted by Sabo
(1/2)ln| 1+y | - (1/2)ln| 1-y | = ln| x | + ln| C |
ln (1+y) / (1-y) = ln| x |^2 + ln | C | ^2

Multiply by e
(1+y) / (1-y) = x^2 + C^2
You got lucky. Look at the log rules:
$ln|x^2| + ln|C^2| = ln|C^2x^2|$

As it happened the final solution had a condition that gave you a C that worked.

Originally Posted by Sabo
Also, it's fine to use ln|C| instead of C, since it's just a constant, that is, it's whatever we want it to be?
That's correct. Using ln(C) is a common trick to simplify the equations. Note though, you can still simply use C, it's just more complicated. (And not worth the extra trouble.)

-Dan

5. I can't help but to feel quite lost sometimes when it comes to math.

You say I got lucky because of the way I did it. But, I didn't do anything wrong, did I? Just because the log rules say that you can do what you did doesn't mean one has to do it that way. Or? It may be a simpler way, but is it a must?

I'm even a bit curious in regards to using the log rules like that. I can't get the equation to work if I do it.
y + 1 = C^2x^2(1 - y) = C^2x^2 - C^2x^2y
y(1 + C^2x^2) = C^2x^2 - 1
y = (C^2x^2 - 1) / C^2x^2
If y(1) = 0, that gives (C^2 - 1) / C^2, which would mean C = +/- 1, which isn't a solution. What am I doing wrong?

6. Originally Posted by Sabo
I can't help but to feel quite lost sometimes when it comes to math.

You say I got lucky because of the way I did it. But, I didn't do anything wrong, did I? Just because the log rules say that you can do what you did doesn't mean one has to do it that way. Or? It may be a simpler way, but is it a must?

I'm even a bit curious in regards to using the log rules like that. I can't get the equation to work if I do it.
y + 1 = C^2x^2(1 - y) = C^2x^2 - C^2x^2y
y(1 + C^2x^2) = C^2x^2 - 1
y = (C^2x^2 - 1) / C^2x^2
You dropped a "1" from the LHS when you divided:
$y = \frac{C^2x^2 - 1}{C^2x^2 + 1}$

-Dan

7. Originally Posted by Sabo
You say I got lucky because of the way I did it. But, I didn't do anything wrong, did I? Just because the log rules say that you can do what you did doesn't mean one has to do it that way. Or? It may be a simpler way, but is it a must?
The fact of the matter is that ln(a) + ln(b) = ln(ab). So
$e^{ln(a) + ln(b)} = e^{ln(ab)} = ab$

What you are suggesting is that
$e^{ln(a) + ln(b)} = a + b$

A simple numerical example will prove this wrong. You have to follow the rules. Like I said, you got lucky somewhere.

-Dan

8. Doh.
Yeah, see what you mean now. For some reason I was doing e^ln|x|^2 + e^ln|C|^2, when it should be e^(ln|x|^2 + ln|C|^2).

I still don't get the equation though. y = (C^2x^2 - 1) / (C^2x^2 + 1). y(1) = 0 = (C^2 - 1) / (C^2 + 1). For this to be 0 the numerator has to be 0, no? So C^2 = 1 => C = +/- 1, which is wrong.

I can't help but to feel a bit stupid right about now. hrms.