VII.H Solving Differential Equations by Separation of Variables

© 2014/2023 M. Flashman
Motivation: Our model for the growth of a population $P$ in Chapter VI.A led us to the differential equation $ \frac {dP}{dt} = P$ with the initial condition that $P(0) = 1$.  Although this model might seem reasonable over a short period of time, with many situations the relation of the population size to some aspects of the environment that cannot change such as physical space and food resources can restrain the growth substantially. Our initial model may not be very accurate for any long period of time. In fact, if the population is greater than the capacity of the environment, one might expect to see the population size diminish rather than grow.
What kind of growth rate would be appropriate for a situation with a population growing in a way that depends both on the size of the population and a population capacity fixed by factors other than the population size.
  One differential equation that might reflect this situation is  $\frac {dP}{dt} = P ( A - P )$ with the initial condition $P(0) = 1$.  [This equation is called the logistic equation.] Here the constant $A$ represents the population capacity, so that $A-P$ is the excess (or deficit ) of capacity over the current population at time $t$. This factor is a control on the rate of population growth which otherwise would depend solely on $P$, the population size at time $t$.
Figure VII.H.1.S  Evaluate Sage to see the tangent field for $\frac {dP}{dt} = P ( 2 - P )$ with the integral curve through $(0,1)$.
Figure VII.H.1 The tangent field for $\frac {dy}{dx} = y ( 2 - y )$ with the integral curve through $(0,1)$.

By routine analysis of  $\frac {dP}{dt}$, the differential equation seems to make sense. When $A - P > 0$ the population will increase, while when $A - P < 0$ the population will decrease. We notice also that when $P = 0$  or $P = A$ the population will not grow without some external disturbance. We would like to answer the usual questions for this model as well, namely  what do we expect for $P(1)$ and what if any is the long run population limit?  For a visual approach to this differential equation we can consider the tangent field in Figures VII.H.1S created with SAGE and VII.H.1 created with GeoGebra where $A = 2$ and the integral curve drawn through the initial point $(0,1)$.

Now what we would like best is to have a formula for the population as an explicit function of time. 
In this section we will develop a simple technique for solving this and many other differential equations called separation of variables.
We'll begin with some simpler examples to understand this technique before we return to solve our motivating example.

Example VII.H.1.  Suppose $P'(t) = 3 t^2$. There is no difficulty in finding the general solution to this differential equation.
$P(t) = \int P'(t) dt = \int 3 t^ 2 dt = t^ 3 + C$.                   
This seems simple enough.  To find $P$ we merely integrate $P'(t)$ with respect to $t$.
Here's another way to look at this:  $\frac {dP}{dt} = 3 t^ 2$, so
$P = \int \frac {dP}{dt}dt = \int 3 t ^2 dt  = t^ 3 + C$.

Recalling the differential notation here we can replace  $\frac {dP}{dt} dt$ with the differential $dP$ and the last equation becomes 
$P = \int dP = \int 3 t^2 dt = t^ 3 + C$.

Now at least formally in terms of manipulating the symbols one might follow what we've done as follows:
●    we have taken the original equation  $\frac {dP}{dt} = 3 t^ 2$
●    multiplied both sides by dt to obtain  $\frac {dP}{dt}dt = 3 t^2 dt$ ,
●    cancelled the factor $dt$ (even though it really isn't a factor) resulting in the differential equation  $dP = 3 t^ 2 dt$.
●    Now integrating the differentials gives the final equation:
  $P = \int 1 dP = \int 3 t ^2 dt = t^ 3 + C.$

Because in the differential equation the variable $P$ appears on one side while the variable $t$ appears on the other, we say that in this equation we have separated the variables.
Comment: Don't be fooled by the notation here. Though the differential $dt$ seems to be cancelled what has happened is that the differential $dP$ is hiding a rather trivial substitution for the sake of simplifying the integral of the expression $P'(t)$.

Here's an example where we truly need to separate the variables.

Figure VII.H.2.S  Evaluate Sage to see the tangent field for $\frac {dP}{dt} = \frac{3 t^ 2} {2 P}$ with the integral curve through $(0,1)$.
Example VII.H.2.  Suppose $P'(t) = \frac {3 t ^2 } {2 P(t)}$ where $P(t) \ne  0$ for any $t$ and $P(0) = 1$.  To solve this differnetial equation, we begin by expressing the equation in the Liebniz differential notation as  $\frac {dP}{dt} = \frac{3 t^ 2} {2 P}$ . Now multiply both sides of the equation  by $P dt$ to obtain the differential equation  $2 P dP = 3 t^2 dt$. See! We've separated the variables.  Now we integrate both sides of the equation to find
$ P^ 2 =  \int 2 P dP  =   \int 3 t ^2 dt  = t ^3 + C$.
This gives us an implicit equation for $P$ which we can solve for two possible continuous solutions, $P = \sqrt{t^ 3 + C}$ and $P = - \sqrt{t^ 3 + C}$ . Finally the initial condition that $P(0) = 1$ means that $C =1$ and  therefore $P = \sqrt{t^ 3 + 1}$.

For a visual approach to this differential equation we can consider the tangent field in Figures VII.H.2S created with SAGE and VII.H.2 created with GeoGebra with the integral curve drawn through the initial point $(0,1)$.
Figure VII.H.2 The tangent field for $\frac {dy}{dx} = \frac{3x^2}{2y}$ with the integral curve through $(0,1)$.

Let's summarize the process used in the last example.
Step 0. To use the technique called separation of variables the differential equation must have the form $P'(t) = \frac{g(t)}{r(P(t))}$. This is sometimes not so easy to recognize.

Step 1. Write the equation in Leibniz form as $ \frac {dP}{dt} = \frac{g(t)}{r(P)}$.

Step 2. Multiply both sides $r(P) dt$ to obtain the differential equation  $r(P) dP = g(t) dt$.  See! You've separated the variables.

Step 3. Integrate both sides to obtain an equation giving an implicit relation between $P$ and $t$. [This may not be so easy. Remember that integration is sometimes just not possible in elementary terms.]

Step 4.  If possible solve the equation of step 4 explicitly for $P$ as a function of $t$.

Example VII.H.3.  Let's apply this technique to solving the differential equation for a population model where the rate of growth is proportional to the population $P$ at any time $t$ and where the population initially is $1000$ while after one hour the population is $1200$.
Solution: First we express the rate statement as a differential equation, namely that $ \frac {dP}{dt} = k P$  where $k$ is a constant of proportionality.  Now we separate the variables to obtain the differential equation  $\frac1P dP = k dt$.  Now integrate: $\ln│P│=  \int \frac1P dP  =   \int k dt  = k t + C$.
This gives us an implicit relation between $P$ and $t$. We'll use this to find the constants before going any further to solve explicitly for $P$. When $t = 0$ we were told $P = 1000$. Thus $\ln(1000) = k 0 + C$.
When $t = 1$ we have $P = 1200$ , so $\ln(1200) = k⋅1 + ln(1000)$.
Thus $k = \ln(1200) - \ln(1000) = \ln(\frac {1200}{1000} = \ln (\frac 65 )$.
So we have  $\ln │P│ = \ln(\frac 65 t + \ln(1000)$.
Writing this relation using the natural exponential function we have $P = e^{ \ln(\frac 65)t + ln(1000)}  = e^{ \ln(\frac 65)t} ⋅ e^{ln(1000)}= 1000 (\frac65)^ t$.
So we have found that then $P = 1000 (\frac65)^ t$.
It is not hard to see that this solution matches the initial conditions and the differential equation , $P ' = 1000 (\frac65)^t ⋅ ln(\frac65) = ln(\frac65) P$.
Comment: The solution to the differential equation  $\frac {dP}{dt} = kP$  with $P(0) = P_0$ may be found similarly to be $P = P_0e^{kt}$ . This has application to numerous other contexts besides population which are explored further in the exercises. 

Now we return to our initial motivation for this section.
Example VII.H.4. Suppose  $\frac {dP}{dt} = (2 - P)P = 2P - P ^2$ with $P(0) = 1$.
Find $P(1)$ and discuss the value of $P$ when $t > > 0$.
Solution: We begin by separating the variable to obtain the differential equation  
$\frac1{ (2 - P) P } dP  = 1 dt$ .
Integrating the left side of this equation uses the techniques for integrating rational functions. 
It is not difficult to check that $\int    \frac 1{   (2 - P) P }dP  = \frac12 ln│P│  - \frac12 ln│2-P│+ C = \frac12 ln│\frac P{2-P}│+C$.
Since the integral of  $1 dt$ is $t + C$, we have the implicit relation $\frac12 ln│\frac P{2-P}│ = t + C$.
Using the initial condition that when $t = 0, P = 1$, we find that $\frac12 ln(1) = 0 + C$ so $C=0$ and $ln│\frac P{2-P}│ = 2t$.
Now we can transform the equation using the natural exponential function to find that $\frac P{2-P} = e^{2t}$.
Now a little algebra will allow us to solve for $P$.
Multiply both sides by $2-P$ so $P = (2-P) e^{2t}$  and thus  $2 e ^{2t} = P + P e^{2t} = P (1 + e ^{2t})$.
Therefore $P =  \frac{2e^{2t}} {1+e^{2t}}= \frac2 {1 + e^{ -2t}}$ .(Did you follow the last step in algebra?)
Now we can answer our questions.
$P(1) = \frac 2{1 + e ^{-2}}$ and when $t > > 0 , P(t) ≈ 2$, i.e. $\lim_{ t→∞} P(t) = 2 $

Exercises VII.H:
In exercises 1 - 5, give (at least) an equation that implicitly solves the differential equation. Assume  $P(0) = 3$ and either find  exactly or estimate $P(1)$. Draw a tangent field for the differential equation and illustrate on that figure the graph of the particular solution where $P(0) = 3$.
  1. $P'(t) = \frac1{3 P(t)^2}   P(t) \ne 0$.
  2. $P'(t) = \frac t{3 P(t)^2}   P(t) \ne 0$.
  3. $P'(t) = P(t)^2$ .
  4. $P'(t) = t P(t)^2$ .
  5. $P'(t) = 2(P(t) - 1)$

  6. Using the technique of separation of variables solve the logistic equation :  $\frac {dP}{dt} = 3 P ( 10 - P )$  with a)$P(0) = 5$ and   b) $P(0) = 15$.
    In each case find exactly and estimate P(1) and P(100).
  7. Using the technique of separation of variables solve the general logistic equation :  $\frac {dP}{dt} = k P ( A - P )$ with $P(0) = P_0$.
  8. Suppose a population satisfies the logistic equation and $P(0) = 100$ and $P(1) = 200$. Discuss briefly the solution to the logistic equation with relation to this information and what, if any, additional information you would need to estimate $P(100)$.
  9. Suppose a population satisfies the differential equation  $\frac {dP}{dt} = k P$ with  $P(0)=100 and P(1)=200$. Solve this differential equation and estimate $P(100)$.

  10. (Project) Go to the library and look up the populations of the United States, China , India, and Egypt  for the years 1920, 1940, and 1980. Based on this data for each country make estimates for the population in 1990 based on an exponential growth model and the logistic model.  Which estimate was closer to the correct population according to your source. Draw a graph illustrating the information you have assembled and the models you are using for your estimates. Based on this information give an estimate for the populations of these countries in the year 2000.

  11. Use separation of variables to solve the differential equation $\frac {dA}{dt}=kA$ assuming that $A(0)=A_0$.

    Radioactive Decay: Radioactive materials decay with time in the sense that in a given amount of a certain matter the mass of radioactive matter it  contains will decrease. One can presume that this decay is due in large part to the interaction of the radioactive matter. The radioactive atoms emit subatomic particles of matter as they decay triggering further radioactive reactions in other radioactive atoms. This suggests that the rate of decay for a radioactive mass will be proportional to the amount of radioactive material present. This can be verified experimentally for most radioactive matter. If we let $A(t)$ denote the amount of radioactive matter present at time $t$, then the rate of decay would be $\frac{dA}{dt} = A'(t)$ and the equation that expresses the relation of the rate of decay to the material present is $\frac{dA}{dt} = k A$ where $k$ is a constant of proportionality. Notice that for this to make sense in terms of the value of $A$ decreasing, the constant $k$ should be a negative number.

    Half Life: The half life of a radioactive material is the time it takes for one half of the material to decay. Thus if $A(t)$ is the amount of material present at time $t$, and $t_h$ is the half life, then
    $A(t_h) = \frac12 A(0)$. 

  12. Suppose $A(t)$ is the amount of a radioactive isotope measured in grams  present at time t hours and initially there are 100 grams present  but that after one hour  only 75 grams remain.
    a) Estimate the amount of material that will remain after 50, 100 and 500 years.
    b) Estimate the number of years before there will be 100, 10, and 1 kilogram  of the material remaining.

  13. Suppose the half life of a radioactive material is 20 years and we have 1000 kilograms of the material presently.
    a) Find a formula expressing $A(t)$ explicitly as a function of time.  
    b) Estimate how many grams of the isotope will remain after 2, 5, and 10 hours.
    c) Estimate when there will be exactly 50 , 10 and 1 gram of the isotope remaining.

  14. Suppose the half life of a radioactive isotope is $t_h$. Give a simple exponential formula (without the number $e$ ) for $A(t)$ in terms of $t, t_h$ and $A_0 = A(0)$.
    Radioactive Isotope Dating: Many organic and inorganic materials contain small but measurable amounts of radioactive substances which at some point in time will not increase. [For example, traces of the radioactive isotope  carbon-14 are found in human bones at a fairly constant proportion of all the carbon in the body. These amount of these traces in the body  change only by ingestion of carbon-14 present in food. After death the only changes in the carbon-14 present in a body result from radioactive decay. ] Measuring the presence of these isotopes in an object where the decay is presumed and knowing the levels of these isotopes when the decaying started allows a scientist to estimate  how long it has been since the moment when the decay began. The next problems though fictitious in facts illustrate how this dating is done.

  15. Suppose that the amount of the radioactive isotope USH-92 present in a skeleton was found to be 20 milligrams whereas at death a normal skeleton would have 85 milligrams . The half-life of USH-92 has been found to be 5000 years.
    a) Give an estimate for the age of the skeleton, i.e. if $A(t)$ is the amount of USH-92 present in a skeleton $t$ years after death, find a value $t*$ so that using $A(0) = 85$ as an initial condition, $A(t*) = 20$.
    b) Our devices for measuring USH-92 are not very accurate. It has been found that any measurement can be as much as 2 milligrams away from the correct measurement.  What is the possible error in the dating of the skeleton's age resulting from an inaccurate measurement of the USH-90 ?
    c) If we purchased a more accurate USH measuring device, we could improve the accuracy so the error would be no more than $.5$ milligrams. How would this improve the accuracy of our age estimates?
    d) Current technology for detecting the presence of USH-92 in bones does not allow us to measure accurately less than 5  milligrams of USH-92.  What is the oldest possible bone that can be detected accurately using  USH-92 dating.
    e) The half-life of USH-90 has recently been reviewed and one group of scientists now believe its half life is 5500 years.  Redo the previous parts of this problem using this new half life for USH-92.