I'm trying to solve the equation $$y' = 1 - y^2$$ Here is my attempt: $$y' = 1 - y^2$$ Divide by (1-y^2) $$\frac{y'}{1-y^2} = 1$$ Integrate both sides: $$\frac{1}{2}\log|\frac{y+1}{y-1}|=t+c$$ Rearrange $$y = \frac{ke^{2t}+1}{ke^{2t}-1}$$ I'd have thought that solution was right, but we have to figure out a specific solution with y(0) = 0. But this isn't possible with the above equation.
How can I solve this non-linear differential equation?
-
0Doesn't $y(0)=0$ imply $k=-1$? – 2011-05-19
-
0While I was writing this, I rewrote $e^{2c}$ = $k$. Am I allowed to set k to -1? – 2011-05-19
-
0+1 for showing your work. No, working in the reals, you cannot have $k=-1$ when it came from $e^{2c}$. Good for you to keep track of that-it is easy to miss. – 2011-05-19
-
0Yes, you may set $k$ to a negative number because $c$ can be complex. Any solution with any complex values of the integration constants is OK, and this particular choice even ends up with a real $y$ for real $t$. A related comment: the absolute value as a part of the logarithm's argument is counterproductive because it is not a holomorphic function. I think it's a good idea to avoid all such symbols that only work on the real axis - and create a wrong discontinuity when the argument of the absolute value vanishes. – 2011-05-19
-
0Dear @Ross, I don't think your comment is right. "Working in the reals" only means that you must filter the solutions at the *very end* to make sure that they're real if this is what you were asked about. However, all intermediate steps can and should use complex numbers, otherwise you're missing some solutions. This is, in fact, why complex numbers were first used. Some cubic equations have all 3 roots being real, but you still need complex numbers in intermediate steps (of the Cardan formula) to calculate these roots. This situation is completely analogous. – 2011-05-19
-
0@Lubos: you are right that complex solutions can turn out to be real. Integrating trig functions is another case – 2011-05-19
-
0@user6312: a slight correction-it should be $t=0, y=0,$ which makes the argument of $\log$ be $1$. Then $c=0$ is correct – 2011-05-19
-
0@Ross Millikan: Thanks for the correction. Since comments seem to be uneditable, I will delete. – 2011-05-19
-
1@Ross, @Luboš: I don't think complex numbers are the issue here. When seeking real-valued solutions, one can indeed stay completely within the real realm, if one handles the absolute value signs correctly. (Cont.) – 2011-05-19
-
1(Cont.) From the integrated expression it follows that $\left| \frac{y+1}{y-1} \right| = \exp 2(t+c)$, hence $\frac{y+1}{y-1} = \pm e^{2c} e^{2t}$. Now let $k = \pm e^{2c}$; then $k$ can be anything except zero. By letting $k$ run through the nonzero real numbers, you get all the real-valued solutions $y(t)$, except the constant ones $y(t)=1$ and $y(t)=-1$ which should have been noted separately before dividing by $1-y^2$. – 2011-05-19
3 Answers
Since you want a solution near $y=0$, you should use $1-y$ in the denominator (as it will be positive) and can remove the absolute value signs. This changes some signs in your answer, giving $$y = \frac{ke^{2t}-1}{ke^{2t}+1}$$ and $k=1$ gives $y(0)=0$
-
0I thought this wasn't legal since k came from $e^{2c}$ (finding c would involve the log of a negative number) however I realized that there is no reason why c can't be complex. – 2011-05-19
-
0Dear @Hannesh, it's not only legal but mandatory to allow all integration constants throughout the calculation being arbitrary complex numbers. Solving equations - algebraic or differential - in the reals isn't *simpler* than in complex numbers. Quite on the contrary, it's more complicated because you must solve it using all possible complex values of the parameters, and at the very end, you must do an extra job of filtering out the solutions that are not real. See the exchanges right under your question. – 2011-05-19
-
0See Hans's comment above. There's no need for complex valued integration constants here as long as you don't ignore the absolute value. – 2011-05-19
Reducing from what you have a little more, we get that equal to Tanh[x-k].
Tanh[-k] == 0 //Seting x to zero
Therefore k = 0, leaving Tanh[x] as your function.
-
0Exactly, this is the right compact form of the solution. tanh is sinh/cosh so its derivative is $(\cosh^2 t - \sinh^2 t)/\cosh^2 t = 1/\cosh^2 t$ which is equal to $1-\tanh^2 t$, indeed. – 2011-05-19
I wrote it down and solved it in a slightly different way. The first thing you should notice is that $y = 1$ and $y = -1$ are the two constant solutions, which allows you then to divide $y'$ by $1-y^2$, since you want to study it for $y(0) \in (-1,1)$, knowing that any solution starting in $(-1,1)$ stays there (or dies in 1).
Then yes, with some algebra you manage to get
$\left(\log \frac{1+y}{1-y}\right)' = 2$
if I haven't screwed up with the signs; now integrating it from 0 to $t$ you get:
$\log \frac{1+y(t)}{1-y(t)} - \log \frac{1+y(0)}{1-y(0)} = 2t$
without the absolute value since everything in the argument of the logs is non-negative. By imposing $y(0) = 0$ the second term in the left vanishes and you're left with an easy expression that if inverted gives the following:
$y(t) = \frac{e^{2t} - 1}{e^{2t} + 1}$
which is simply
$y(t) = \tanh (t)$
and of course double checking $y(0) = 0$.