# Solving $\frac{dy}{dt} = (y-y^2)te^{t^{2}}$: tried wolfram alpha but no success with the given initial condition

I am trying to solve the following differential equation with integrating factor. I have tried the wolfram alpha and am not able to make much sense out of the answers which I was given through my professor (I was also not able to make much sense out of the answer which wolfram gave either).

Anyhow, I want to solve $\frac{dy}{dt} = (y-y^2)te^{t^{2}}$ with the initial condition where $y(0) = 2$.

I have gotten up to the point where $\int\frac{1}{y} + \int\frac{1}{1-y}dy = \frac{1}{2}dy\int{e^u du}$ where $u=t^2$.

Then I got up to the point where $$\ln(\frac{y}{1-y}) = \frac{1}{2}e^{t^2}+c$$

Now as for the initial condition, I see that the solution were solved as $c$ being added along with the initial condition, but I am wondering why this is so as I am used to solving for the constants as being $Ce^{t^2}$ for example.

Secondly, the initial conditions were solved using the equation $$\ln(\frac{y}{1-y}) = \frac{1}{2}e^{t^2}+c$$ where it was given that $\ln(2) = \frac{1}{2} + c$. Eventually, $c = \ln(2)-\frac{1}{2}$.

So I am not sure how eh got this solution. Could someone please explain ?

Thank you

It's a separable differential equation. Write it as

$$\dfrac{dy}{y - y^2} = t e^{t^2}\; dt$$

and integrate both sides; don't forget the arbitrary constant $c$ from one of the integrations. You could use partial fractions on the left, $u = t^2$ on the right. You could get

$$\ln \left|\dfrac{y}{1-y}\right| = \dfrac{1}{2} e^{t^2} + c$$

Now the initial condition: $y(0) = 2$, i.e. when $t=0$, $y= 2$. Plug that in:

$$\ln \left| \dfrac{2}{1-2}\right| = \ln (2) = \dfrac{1}{2} + c$$

so $c = \ln (2) - 1/2$. Thus

$$\ln \left| \dfrac{y}{1-y} \right| = \dfrac{1}{2} e^{t^2} - \dfrac{1}{2} + \ln(2)$$

By the way, you can solve for $y$ explicitly:

$$y = \dfrac{2 \exp\left(\left(e^{t^2}-1)/2\right)\right)}{2 \exp\left(\left(e^{t^2}-1)/2\right)\right)-1}$$

• I guess the biggest question I have is how can $\ln(\frac{2}{1-2}) = \ln(2)$. I thought that one can never take $\ln$ of a negative number and expect to get a real number. A look up on wolfram says that it is $-i\pi$. I think it is this part that confuses me – PutsandCalls Feb 29 '16 at 6:18
• You can do logarithms of negative numbers if you use complex numbers. That's what Wolfram does. But notice that in my solution I put in absolute values (precisely to avoid logarithms of negative numbers). It's not $\ln \left( \dfrac{2}{1-2}\right)$, it's $\ln \left| \dfrac{2}{1-2}\right|$. – Robert Israel Feb 29 '16 at 6:29
• Ah I understand now, makes a lot of sense why it must strictly positive. Thank you – PutsandCalls Feb 29 '16 at 6:38
• @PutsandCalls: You could also say that since you integrate where $y(t)>1$ around the initial condition, the integral $\int \frac{dy}{1-y}$ should be rewritten to have positive denominator as in $-\int\frac{dy}{y-1}$. – LutzL Feb 29 '16 at 10:01