Skip to main content
\(\newcommand{\trace}{\operatorname{tr}} \newcommand{\real}{\operatorname{Re}} \newcommand{\imaginary}{\operatorname{Im}} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section2.4Solving Systems Analytically

Mixing problems model how substances flow back and forth between two or more compartments. These problems often arise in applications—for example, we might want to model how greenhouse gases flow back and forth between different layers of the earth's atomosphere[17], how chemicals move between tanks in a refinery or a brewery, or how pollutants move between a series of lakes or pounds. Systems of differential equations can prove very useful when it comes to modeling such situations.

Subsection2.4.1Mixing Problems

We will use linear systems of differential equations such as \begin{align*} \frac{dx}{dt} & = ax + by\\ \frac{dy}{dt} & = cx + dy \end{align*} to illustrate how we can use systems of differential equations to model how substances flow back and forth between two or more compartments. Suppose that we have two tanks (\(A\) and \(B\)) between which a mixture of brine flows (Figure 2.28). Tank \(A\) contains 300 liters of water in which 100 kilograms of salt has been dissolved and Tank \(B\) contains 300 liters of pure water. Fresh water is pumped into Tank \(A\) at the rate of 500 liters per hour, and brine is pumped into Tank \(B\) from Tank \(A\) at the rate of 500 liters per hour. Brine is also drained at a rate 500 liters of brine per hour from Tank \(B\text{.}\) All brine mixtures are well-stirred. If we let \(x = x(t)\) be the amount of salt in Tank \(A\) at time \(t\) and \(y = y(t)\) be the amount of salt in Tank \(B\) at time \(t\text{,}\) then we know that \begin{align*} x(0) & = 100\\ y(0) & = 0 \end{align*} We know that the salt concentrations in the two tanks are \(x/300\) kilograms per liter and \(y/300\) kilograms per liter. Thus, we can describe the rate of change in each tank with a differential equation, \begin{align*} \frac{dx}{dt} & = - 500 \cdot \frac{x}{300} = - \frac{5}{3} x,\\ \frac{dy}{dt} & = 500 \cdot \frac{x}{300} - 500 \cdot \frac{y}{300} - 500 \cdot \frac{y}{300} = \frac{5}{3} x - \frac{5}{3} y. \end{align*}

<<SVG image is unavailable, or your browser cannot render it>>

Figure2.28Mixing example with two tanks

We can now ask how we might solve the system of equations \begin{align*} \frac{dx}{dt} & = - \frac{5}{3} x,\\ \frac{dy}{dt} & = \frac{5}{3} x - \frac{5}{3} y. \end{align*} The task of solving the system \begin{align*} \frac{dx}{dt} & =f(x,y),\\ \frac{dy}{dt} & = g(x,y), \end{align*} may be quite difficult or even impossible. However, we can find solutions in certain cases. For example, if we have a system of the form \begin{align*} \frac{dx}{dt} & =f(x),\\ \frac{dy}{dt} & = g(y), \end{align*} then each equation is an autonomous first-order equation. To solve our system, we only need to solve two first-order equations. Such a system is said to be decoupled. Generalizing slightly, we say the a partially coupled system is a system of the form \begin{align*} \frac{dx}{dt} & =f(x),\\ \frac{dy}{dt} & = g(x, y). \end{align*} Since the first equation is an autonomous first-order equation in \(x\text{,}\) we can solve this equation separately, and substitute our solution into the second equation.

Consider the system \begin{align*} \frac{dx}{dt} & = x \\ \frac{dy}{dt} & = x + y. \end{align*} We can easily solve the first equation, \(dx/dt = x\text{,}\) to obtain \(x = a e^t\text{.}\) Using this information in the second equation, we have \begin{equation*} \frac{dy}{dt} - y = a e^t \end{equation*} which is a first-order linear equation. This equation has an integrating factor \(\mu(t) = e^{-t}\text{,}\) and \begin{equation*} \frac{d}{dt} (e^{-t} y) = \mu(t) \left(\frac{dy}{dt} - y \right)= a e^t \mu(t) = a. \end{equation*} Therefore, the solution to our second equation is \begin{equation*} y(t) = at e^t + be^t. \end{equation*}

Revisiting the mixing problem that we posed at the beginning of this section, we have the following initial value problem, \begin{align*} \frac{dx}{dt} & = - \frac{5}{3} x,\\ \frac{dy}{dt} & = \frac{5}{3} x - \frac{5}{3} y.\\ x(0) & = 100,\\ y(0) & = 0. \end{align*} Solving \(dx/dt = - (5/3) x\) is easy. We can quickly determine that \(x(t) = c_1 e^{-5t/3}\text{.}\) Applying the initial condition \(x(0) = 100\text{,}\) we can determine that \(c_1 = 100\) and \(x(t) = 100 e^{-5t/3}\text{.}\) Our second equation now becomes \begin{equation*} \frac{dy}{dt} = \frac{5}{3} x - \frac{5}{3} y = \frac{500}{3} e^{-5t/3} - \frac{5}{3} y. \end{equation*} This last equation is a first-order linear equation \begin{equation*} \frac{dy}{dt} + \frac{5}{3} y = \frac{500}{3} e^{-5t/3}. \end{equation*} Multiplying both sides of this last equation by the integrating factor \(\mu(t) = e^{5t/3}\) yields \begin{equation*} \frac{d}{dt} (e^{5t/3}y) = e^{5t/3}\frac{dy}{dt} + e^{5t/3}\frac{5}{3} y = \frac{500}{3}. \end{equation*} Integrating both sides of this last equation gives us \begin{equation*} e^{5t/3}y = \frac{500}{3} t + c_2. \end{equation*} Using our initial condition \(y(0) = 0\text{,}\) we can determine that \(c_2 = 0\text{.}\) Thus, \begin{equation*} y = \frac{500}{3} t e^{-5t/3} \end{equation*}

Subsection2.4.2Using Sage to Solve Linear Systems

Solving linear systems such as \begin{align*} x' & = ax + by\\ y' & = cx + dy \end{align*} is much more difficult, since we cannot use the same strategies that we used to solve partially-coupled systems. We will devote all of Chapter 3 to find an answer. However, we can use Sage to solve linear systems for the moment. The following is a Sage interact that will solve the initial-value problem \begin{align*} x' & = 3x - 4y\\ y' & = 2x + y\\ x(0) \amp = 1\\ y() \amp = 1; \end{align*} however, we can change the coefficients and initial value to be anything that we like.

Subsection2.4.3Harmonic Oscillators

The equation \begin{equation*} \frac{d^2 x}{dt^2} + 3 \frac{dx}{dt} + 2 x = 0 \end{equation*} is a specific case of a damped harmonic oscillator, where \(m = 1\text{,}\) the spring constant is 2, and the damping constant is 3. We can rewrite this equation as a first-order linear system, \begin{align*} \frac{dx}{dt} & = v,\\ \frac{dv}{dt} & = - 2x - 3v. \end{align*} Suppose that \(x(0) = 0\) is the initial position of the mass and \(v(0) = 1\) is the initial velocity. We can use Sage to verify that the solution to our system is \begin{align*} x(t) & = e^{-t} - e^{-2t},\\ v(t) & = - e^{-t} + 2 e^{-2t}. \end{align*} This is an example of an over-damped harmonic oscillator (Figure 2.29). In other words, a spring-mass system that is modeled by this system of equations has so much damping that the mass will not oscillate.

Figure2.29An over-damped harmonic oscillator

Now let us relax the damping and increase the spring constant on our harmonic oscillator, \begin{equation*} \frac{d^2 x}{dt^2} + 2 \frac{dx}{dt} + 10 x = 0. \end{equation*} The corresponding linear system is \begin{align*} \frac{dx}{dt} & = v,\\ \frac{dv}{dt} & = - 10x - 2v\\ x(0) \amp = 0\\ v(0) \amp = 1. \end{align*} Notice that our initial conditions have not changed. We again use Sage to solve our system.

The solution to our system is \begin{align*} x(t) & = \frac{1}{3} e^{-t} \sin t,\\ v(t) & = e^{-t} \cos 3t - \frac{1}{3} e^{-t} \sin 3t. \end{align*} Notice that the system oscillates due to the sine and cosine terms in the solution. This system is underdamped (Figure 2.30).

Figure2.30An under-damped harmonic oscillator

Subsection2.4.4Important Lessons

  • A system of the form \begin{align*} \frac{dx}{dt} & =f(x),\\ \frac{dy}{dt} & = g(y) \end{align*} is said to be decoupled. Such a system can be solved by solving each equation independently.
  • A system of the form \begin{align*} \frac{dx}{dt} & =f(x),\\ \frac{dy}{dt} & = g(x, y) \end{align*} a partially coupled system. Since the first equation is an autonomous first-order equation in \(x\text{,}\) we can solve this equation separately, and substitute our solution into the second equation.
  • We can use Sage to solve systems of the form \begin{align*} x' & = ax + by\\ y' & = cx + dy. \end{align*}
  • Sage is useful for investigating the behavior of harmonic oscillators.

Subsection2.4.5Exercises

1

This is an exercise.