First-order Separable ODE

ifeg

New member
I am having a problem. I think i went well in decomposing the partial fraction and integrating, however my answer leaves me concerned. please help if i have gone wrong.

Solve: dy/dx + y^2 = y.

after taking partial fractions, i simplified this to: (1/y + 1/ (1-y) ) dy = dx

and i integrated that to ln (mod) y + ln (mod) (1-y) = x + c

how do i transpose for y here? when i take exponents on either side i get y + 1 - y = e^x + c

which works out to 0= e^x + c.

This doesn't seem right... is it? what's wrong?? ThePerfectHacker

Well-known member
Re: Solving differential equations

I am having a problem. I think i went well in decomposing the partial fraction and integrating, however my answer leaves me concerned. please help if i have gone wrong.

Solve: dy/dx + y^2 = y.

after taking partial fractions, i simplified this to: (1/y + 1/ (1-y) ) dy = dx

and i integrated that to ln (mod) y + ln (mod) (1-y) = x

how do i transpose for y here? when i take exponents on either side i get y + 1 - y = e^x

which works out to 0= e^x.
(Let us suppose that $0<y<1$ always to avoid division by zero problems and other problems).

The equation is $y' + y^2 = y$. Let us rewrite this as $y' = y -y^2$. Then by dividing we get that,
$$\frac{y'}{y(1-y)} = 1$$
Now we need to use partial fractions,
$$\frac{1}{y(1-y)} = \frac{1}{y} + \frac1{1-y}$$
Therefore,
$$\frac{y'}{y(1-y)} = \left( \log y - \log (1-y) \right) '$$
Thus, the differencial equation reduces to,
$$\left( \log y - \log (1-y) \right) ' = 1$$
This means that,
$$\log y - \log (1-y) = x + k$$
Now by rule of logarithms this means,
$$\log \left( \frac{y}{1-y} \right) = x + k$$
This means that,
$$\frac{y}{1-y} = Ce^x$$
Now solve for $y$ and what do you get ... ?

• sbhatnagar and ifeg

ifeg

New member
Re: Solving differential equations

(Let us suppose that $0<y<1$ always to avoid division by zero problems and other problems).

The equation is $y' + y^2 = y$. Let us rewrite this as $y' = y -y^2$. Then by dividing we get that,
$$\frac{y'}{y(1-y)} = 1$$
Now we need to use partial fractions,
$$\frac{1}{y(1-y)} = \frac{1}{y} + \frac1{1-y}$$
Therefore,
$$\frac{y'}{y(1-y)} = \left( \log y - \log (1-y) \right) '$$

Thus, the differencial equation reduces to,
$$\left( \log y - \log (1-y) \right) ' = 1$$
This means that,
$$\log y - \log (1-y) = x + k$$
Now by rule of logarithms this means,
$$\log \left( \frac{y}{1-y} \right) = x + k$$
This means that,
$$\frac{y}{1-y} = Ce^x$$
Now solve for $y$ and what do you get ... ?
How did the minus sign (log y - log (1-y) ) get there? that's where i went different. I don't follow.

CaptainBlack

Well-known member
Re: Solving differential equations

How did the minus sign (log y - log (1-y) ) get there? that's where i went different. I don't follow.
It is because: $\frac{d}{dx}(\ln(1-y))= \frac{1}{1-y} \; \frac{d}{dx}(1-y)=- \frac{1}{1-y}\;y'$

• ifeg

ifeg

New member
Re: Solving differential equations

(Let us suppose that $0<y<1$ always to avoid division by zero problems and other problems).

The equation is $y' + y^2 = y$. Let us rewrite this as $y' = y -y^2$. Then by dividing we get that,
$$\frac{y'}{y(1-y)} = 1$$
Now we need to use partial fractions,
$$\frac{1}{y(1-y)} = \frac{1}{y} + \frac1{1-y}$$
Therefore,
$$\frac{y'}{y(1-y)} = \left( \log y - \log (1-y) \right) '$$
Thus, the differencial equation reduces to,
$$\left( \log y - \log (1-y) \right) ' = 1$$
This means that,
$$\log y - \log (1-y) = x + k$$
Now by rule of logarithms this means,
$$\log \left( \frac{y}{1-y} \right) = x + k$$
This means that,
$$\frac{y}{1-y} = Ce^x$$
Now solve for $y$ and what do you get ... ?
solving for $y$, i got $$y = \frac{Ae^x}{1-Ae^x} ; A=e^c$$

CaptainBlack

Well-known member
Re: Solving differential equations

solving for $y$, i got $$y = \frac{Ae^x}{1-Ae^x} ; A=e^c$$
Substitute back into the original equation to confirm that it is indeed a solution.

Opps... as Danny says get the sign right first, ... I had forgotten that I had fixed that is my Maxima code CB

Last edited:

Jester

Well-known member
MHB Math Helper
Re: Solving differential equations

solving for $y$, i got $y = \frac{Ae^x}{1-Ae^x} ; A=e^c$

• ifeg

ifeg

New member
Re: Solving differential equations

Oh yeh, it's $$y = \frac{Ae^x}{1+Ae^x} ; A=e^c$$

(it was the wee hours of the morning, and i hadn't slept since the night before that so I wasn't 100% )

Thanks again

Prove It

Well-known member
MHB Math Helper
Re: Solving differential equations

I wish people wouldn't forget the modulus signs...

$$\int{\frac{1}{x}\,dx} = \ln{|x|} + C$$, not $$\ln(x) + C$$.

ThePerfectHacker

Well-known member
Re: Solving differential equations

I wish people wouldn't forget the modulus signs...

$$\int{\frac{1}{x}\,dx} = \ln{|x|} + C$$, not $$\ln(x) + C$$.
No, I disagree. I have noticed from teaching Calculus that this is the single biggest mistake taught in integration.
Why? Well here is the reason.

Theorem: If $f$ and $g$ are two differenciable functions on an open interval $I$ such that $f' = g'$ then $f - g$ is constant.

Now, the function $1/x$ is defined on $(-\infty,0)\cup(0,\infty)$. It is defined on a disconnected set. As a result its most general anti-derivative does not need to differ by a constant. Indeed, consider the following function,

$$f(x) = \left\{ \begin{array}{c} \log x \text{ if } x>0 \\ \log (-x) + 1 \text{ if } x<0 \end{array} \right.$$

Then clearly $f'(x) = \frac{1}{x}$ on $(-\infty,0)\cup (0,\infty)$. But $f(x) \not = \log |x| + C$ for some constant $C$!

Last edited:
• PaulRS

Prove It

Well-known member
MHB Math Helper
Re: Solving differential equations

No, I disagree. I have noticed from teaching Calculus that this is the single biggest mistake taught in integration.
Why? Well here is the reason.

Theorem: If $f$ and $g$ are two differenciable functions on an open interval $I$ such that $f' = g'$ then $f - g$ is constant.

Now, the function $1/x$ is defined on $(-\infty,0)\cup(0,\infty)$. It is defined on a disconnected set. As a result its most general anti-derivative does not need to differ by a constant. Indeed, consider the following function,

$$f(x) = \left\{ \begin{array}{c} \log x \text{ if } x>0 \\ \log (-x) + 1 \text{ if } x<0 \end{array} \right.$$

Then clearly $f'(x) = 0$ on $(-\infty,0)\cup (0,\infty)$. But $f(x) \not = \log |x| + C$ for some constant $C$!
I should have been more clear then. I was making the point that it is incorrect to say that the antiderivative of $$\frac{1}{x}$$ is $$\ln{x}$$ due to $$\ln{x}$$ not being defined on $$(-\infty, 0)$$ while $$\frac{1}{x}$$ is...

ThePerfectHacker

Well-known member
Re: Solving differential equations

I should have been more clear then. I was making the point that it is incorrect to say that the antiderivative of $$\frac{1}{x}$$ is $$\ln{x}$$ due to $$\ln{x}$$ not being defined on $$(-\infty, 0)$$ while $$\frac{1}{x}$$ is...
You need to specify the domain of $\frac{1}{x}$. If you take the largest possible domain then its most general anti-derivative is not $\log |x| + C$, that is wrong, and it is just never explained in Calculus classes. To get around this problem I just say that the most general anti-derivative of $\frac{1}{x}$ on the domain $x>0$ is $\log x + C$. If however we choose $x<0$ then the most general anti-derivative is $\log (-x) + C$. However, we must specify what interval we choose for the domain of $\frac{1}{x}$, because that theorem only works when the open set is connected i.e. when the domain is an open interval.

This is actually why I just assumed that $y$, the solution to the equation, always satisfies $0<y<1$ in order to not deal with those problems.

Prove It

Well-known member
MHB Math Helper
Re: Solving differential equations

You need to specify the domain of $\frac{1}{x}$. If you take the largest possible domain then its most general anti-derivative is not $\log |x| + C$, that is wrong, and it is just never explained in Calculus classes. To get around this problem I just say that the most general anti-derivative of $\frac{1}{x}$ on the domain $x>0$ is $\log x + C$. If however we choose $x<0$ then the most general anti-derivative is $\log (-x) + C$. However, we must specify what interval we choose for the domain of $\frac{1}{x}$, because that theorem only works when the open set is connected i.e. when the domain is an open interval.

This is actually why I just assumed that $y$, the solution to the equation, always satisfies $0<y<1$ in order to not deal with those problems.
And together, i.e. in the domain $$(-\infty, 0) \cup (0, \infty)$$, the most general antiderivative therefore is

$\begin{cases} \log{x} + C \textrm{ if }x > 0 \\ \log{(-x)} + C \textrm{ if } x < 0 \end{cases}$

which is the very DEFINITION of an absolute value function, namely

$|x| = \begin{cases} x \textrm{ if } x \geq 0 \\ -x \textrm{ if } x < 0 \end{cases}$

There's nothing wrong with using the absolute value function in the logarithm...

ThePerfectHacker

Well-known member
Re: Solving differential equations

And together, i.e. in the domain $$(-\infty, 0) \cup (0, \infty)$$, the most general antiderivative therefore is

$\begin{cases} \log{x} + C \textrm{ if }x > 0 \\ \log{(-x)} + C \textrm{ if } x < 0 \end{cases}$

which is the very DEFINITION of an absolute value function, namely

$|x| = \begin{cases} x \textrm{ if } x \geq 0 \\ -x \textrm{ if } x < 0 \end{cases}$

There's nothing wrong with using the absolute value function in the logarithm...
No. The constants do not need to be the same! The most general anti-derivative is,

$$\left\{ \begin{array} {c} \log x + c_1 \text{ if } x>0 \\ \log(-x) + c_2 \text{ if } x<0 \end{array} \right.$$

Do you see why this is not the same thing as $\log |x| + C$ ?

Prove It

Well-known member
MHB Math Helper
Re: Solving differential equations

No. The constants do not need to be the same! The most general anti-derivative is,

$$\left\{ \begin{array} {c} \log x + c_1 \text{ if } x>0 \\ \log(-x) + c_2 \text{ if } x<0 \end{array} \right.$$

Do you see why this is not the same thing as $\log |x| + C$ ?
Actually, it IS the same. $$C$$ is arbitrary, so it could be used to represent $$c_1$$ or $$c_2$$, depending on the value of $$x$$...

ThePerfectHacker

Well-known member
Re: Solving differential equations

Actually, it IS the same. $$C$$ is arbitrary, so it could be used to represent $$c_1$$ or $$c_2$$, depending on the value of $$x$$...
No! It is not the same. Let me make it even simpler. Ignore $1/x$. Let me just ask you the following question.

What is the most general anti-derivative of $0$?

It depends on what domain we choose for the zero function. If I define the function $g(x) = 0$ on $(-\infty,\infty)$ then the most general anti-derivative is $C$, and by $C$ I simply mean the constant function which is identically $C$ throughout the domain $(-\infty,\infty)$.

In fact, what is the proof of the above statement, i.e. that the most general anti-derivative of $g(x)$ is $C$? It uses the mean-value theorem.

However, let us define the function $h(x) = 0$ but with domain $(-\infty,0)\cup (0,\infty)$ then the most general anti-derivative is no longer just the constant function. Indeed, consider the function $F$ defined to be $1$ on $(-\infty,0)$ and defined to be $2$ on $(0,\infty)$. Then clearly $F'=0$ however $F$ is not a constant function.

It would be helpful to know exactly what goes wrong in the above statement. If you try to use the mean-value theorem for the function $h$ it is not going to work because if you pick a point $p$ in $(-\infty,0)$ and you pick a point $q$ in $(0,\infty)$ then the interval $[p,q]$ is no longer part of the domain of $h$! And so you cannot use the mean-value theorem any longer!

The most general anti-derivative of $h$ is rather the function $c_1$ on $(-\infty,0)$ and $c_2$ on $(0,\infty)$ where $c_1$ and $c_2$ can be different numbers.

I am not sure what your back ground is, but here is a much general result that is topological in nature (again, I am not sure what your back ground is so perhaps this will be meaningless to you in which case just ignore it). Theorem: If $U$ is an open (non-empty) subset of $\mathbb{R}$ and $f$ is a differenciable function on $U$ so that $f' = 0$ then $f$ is locally-constant, in particular it is constant on the connected components of $U$ (and so if $U$ is an interval then $f$ must be constant through out).