This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using Mathematica. If you have never used Mathematica before and would like to learn more of the basics for this computer algebra system, it is strongly recommended looking at the APMA 0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The Mathematica commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts.

Finally, you can copy and paste all commands into your Mathematica notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License (GPL). You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015;

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to Part II of the course APMA0340
Introduction to Linear Algebra with Mathematica

Reduction to a single differential equation

The Gauss elimination method for solving systems of algebraic equations can be adapted to systems of linear differential equations, not necessarily in normal form (written as \( \dot{\bf x}(t) = {\bf P}(t)\, {\bf x}(t) + {\bf f}(t) . \) ) In many cases, it is possible to eliminate all but one dependent variable in succession until there remains only a single differential equation containing only one dependent variable. When this single differential equation can be solved, other dependent variables can be found in turn, using the original system of equations. Such a procedure, called the method of elimination, provides an effective tool for solving some systems of differential equations. The solution obtained may contain the sufficient number of constants of integration to identify it as the general solution. However, the eliminating procedure may not lead to an equivalent single differential equation, and some solutions could be missing. We illustrate the elimination method in the following examples.

Example: Suppose that there are two large interconnected tanks feeding each other; one of them we call tank A and the other one tank B. Suppose that initially tank A holds 160 liters of a brine solution, and tank B contains 140 liters of the same solution. Fresh water flows into tank A at a rate 4 liters per minute, and fluid is drained out of tank B at the same rate. Also, 2 liters per minute of fluid are pumped from tank B to tank A, and 4 liters per minute from tank A to tank B. The liquids inside each tank are kept well stirred so that each mixture is homogeneous. If initially, the brine solution in tank contains x0 kg of salt and that tank B contains y0 kg of salt, determine the amount of salt in each tank at time t > 0.

Example: Consider again two tanks A and B with capacities 160 and 140 liters, respectively. Suppose that the rate of exchange between the two tanks remains the same, at 4 liters per minute. In this case, based on input and output rates, we obtain the following system of ordinary differential equations:

\[ \begin{split} \dot{x} &= \frac{4y}{140} - \frac{4x}{160} , \\ \dot{y} &= \frac{4x}{160} - \frac{4y}{140} . \end{split} \]

Example: Consider the system of ordinary differential equations

\[ \begin{cases} \dot{x}_1 &= x_1 + 2\,x_2 , \\ \dot{x}_2 &= 3\, x_1 -4\, x_2 . \end{cases} \]
Upon introducing the derivative operator \( \texttt{D} = {\text d}/{\text d}t , \) we rewrite the given system of equations in operator form:
\[ \begin{split} \left( \texttt{D} -1 \right) x_1 - 2\, x_2 &= 0 , \\ -3\, x_1 + \left( \texttt{D} +4 \right) x_2 &= 0 . \end{split} \]
Multiplying the first equation by 3 and the last equation by \( \left( \texttt{D} -1 \right) , \) we obtain
\[ \begin{split} 3 \left( \texttt{D} -1 \right) x_1 - 6\, x_2 &= 0 , \\ -3 \left( \texttt{D} -1 \right) x_1 + \left( \texttt{D} -1 \right) \left( \texttt{D} +4 \right) x_2 &= 0 . \end{split} \]
Adding these equations, we eliminate the dependent variable x1:
\[ \left( \texttt{D} -1 \right) \left( \texttt{D} +4 \right) x_2 - 6\, x_2 = 0 \qquad \mbox{or} \qquad \left( \texttt{D} + 5 \right) \left( \texttt{D} -2 \right) x_2 =0 . \]
So we reduced the given system to a single differential equation with constant coefficients. Since its characteristic equation \( \left( \lambda +5 \right) \left( \lambda -2 \right) = 0 \) has two real roots, we claim that the general solution for x2 is
\[ x_2 (t) = c_1 e^{-5t} + c_2 e^{2t} , \]
where c1 and c2 are arbitrary constants. Using the second equation of the given system
\[ 3\,x_1 (t) = \left( \texttt{D} +4 \right) x_2 , \]
we derive the general solution for function x1:
\[ x_1 (t) = \frac{1}{3} \left( \texttt{D} +4 \right) x_2 \left[ c_1 e^{-5t} + c_2 e^{2t} \right] = - \frac{1}{3}\, c_1 e^{-5t} + 2\,c_2 e^{2t} . \]




Return to Mathematica page

Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions