Section 1.4 Linear equations and the integrating factor
In section Section 1.2 we saw existence and uniqueness for a completely general first order ODE. In Section 1.3 last class we saw separable differential equations which is a specific class of first order ODEs. Now in section 1.4 we are seeing a different class of ODEs called linear ODEs, and they are particularly nice because they come with a method that always works (provided you can evaluate the integrals) to solve the ODE. We will also see that this comes with a particularly nice Existence & Uniqueness theorem that is stronger than the one for generic ODEs.
One of the most important types of equations we will learn how to solve are the so-called linear equations. In fact, the majority of the course is about linear equations. In this section we focus on the first order linear equation. A first order equation is linear if we can put it into the form:
The word βlinearβ means linear in and no higher powers nor functions of or appear. The dependence on can be more complicated.
Solutions of linear equations have nice properties. For example, the solution exists wherever and are defined, and has the same regularity (read: it is just as nice). But most importantly for us right now, there is a method for solving linear first order equations.
The trick is to rewrite the left-hand side of (1.3) as a derivative of a product of with another function. To this end we find a function such that
Now we integrate both sides. The right-hand side does not depend on and the left-hand side is written as a derivative of a function. Afterwards, we solve for The function is called the integrating factor and the method is called the integrating factor method.
We are looking for a function such that if we differentiate it, we get the same function back multiplied by That seems like a job for the exponential function! Let
We compute:
Of course, to get a closed form formula for we need to be able to find a closed form formula for the integrals appearing above.
Example 1.4.1.
Note that we do not care which antiderivative we take when computing You can always add a constant of integration, but those constants will not matter in the end.
Exercise: Try it! Add a constant of integration to the integral in the integrating factor and show that the solution you get in the end is the same as what we got above.
Advice: Do not try to remember the formula itself, that is way too hard. It is easier to remember the process and repeat it.
Since we cannot always evaluate the integrals in closed form, it is useful to know how to write the solution in definite integral form. A definite integral is something that you can plug into a computer or a calculator. Suppose we are given
Look at the solution and write the integrals as definite integrals.
You should be careful to properly use dummy variables here. If you now plug such a formula into a computer or a calculator, it will be happy to give you numerical answers.
Video 1.4.2. Integrating Factor Examples.
Letβs work through a full example.
Exercise: Write the solution of the following problem as a definite integral, but try to simplify as far as you can. You will not be able to find the solution in closed form.
Remark 1.4.1.
Before we move on, we should note some interesting properties of linear equations. First, for the linear initial value problem there is always an explicit formula (1.4) for the solution. Second, it follows from the formula (1.4) that if and are continuous on some interval then the solution exists and is differentiable on Compare with the simple nonlinear example we have seen previously, and compare to Theorem 1.2.1.
Example 1.4.2.
Let us discuss a common simple application of linear equations. This type of problem is used often in real life. For example, linear equations are used in figuring out the concentration of chemicals in bodies of water (rivers and lakes).
A 100 liter tank contains 10 kilograms of salt dissolved in 60 liters of water. Solution of water and salt (brine) with concentration of 0.1 kilograms per liter is flowing in at the rate of 5 liters a minute. The solution in the tank is well stirred and flows out at a rate of 3 liters a minute. How much salt is in the tank when the tank is full?
Let us come up with the equation. Let denote the kilograms of salt in the tank, let denote the time in minutes. For a small change in time, the change in (denoted ) is approximately
In our example,
Our equation is, therefore,
Subsection 1.4.1 Exercises
In the exercises, feel free to leave answer as a definite integral if a closed form solution cannot be found. If you can find a closed form solution, you should give that.
Exercise 1.4.1.
Solve
Solution.
so we get
Integrating
Exercise 1.4.2.
Solve
Exercise 1.4.3.
Solution.
Multiplying by the integrating factor and integrating
Applying the initial condition we get therefore
Exercise 1.4.4.
Solve
Exercise 1.4.5.
Answer.
Multiplying by the integrating factor and integrating
This integral doesnβt have a closed form, so it is left as a definite integral
Applying the initial condition we get so finally
Exercise 1.4.6.
Suppose there are two lakes located on a stream. Clean water flows into the first lake, then the water from the first lake flows into the second lake, and then water from the second lake flows further downstream. The in and out flow from each lake is 500 liters per hour. The first lake contains 100 thousand liters of water and the second lake contains 200 thousand liters of water. A truck with 500 kg of toxic substance crashes into the first lake. Assume that the water is being continually mixed perfectly by the stream.
- Find the mass of toxic substance as a function of time in both lakes.
- When will the concentration in the first lake be below 0.001 kg per liter?
- When will the concentration in the second lake be maximal?
Solution.
(a) Lake 1:
Applying the initial condition the equation becomes \[ x_1(t)=500e^{-t/200} \]
Lake 2:
Where \[ p(t)=\frac{1}{400}, f(t)=\frac{5e^{-t/200}}{2}, r(t)=e^{t/400} \] Multiplying and integrating \[ e^{t/400}x_2=-1000e^{-t/400}+C \] Applying the initial condition we find so \[ x_2=1000(e^{-t/400}-e^{-t/200}) \] (b) At concentration kg. Plugging into the solution for the first lake \[ 100=500e^{-t_f/200}\rightarrow t_f\approx 321.89 \rm hours \] (c) The critical point can be obtained by setting the first derivative to zero \[ \frac{dx_2}{dt}=1000(-\frac{1}{400}e^{-t/400}+\frac{1}{200}e^{-t/200})=0 \] Solving for we find hours.
Exercise 1.4.7.
Newtonβs law of cooling states that where is the temperature, is time, is the ambient temperature, and is a constant. Suppose that for some constants and That is, the ambient temperature oscillates (for example night and day temperatures).
- Find the general solution.
- In the long term, will the initial conditions make much of a difference? Why or why not?
Solution.
(a) \[ xβ=-kx+kA_0\cos(\omega t) \] \[ p(t)=k, f(t)=kA_0\cos(\omega t), r(t)=e^{kt} \] Multiplying and integrating
(b) In the long term, becomes large, so the term vanishes. The initial condition is
So we can write the solution as
Where the last term vanishes at large and so the initial condition doesnβt matter.
Exercise 1.4.8.
Initially 5 grams of salt are dissolved in 20 liters of water. Brine with concentration of salt 2 grams of salt per liter is added at a rate of 3 liters a minute. The tank is mixed well and is drained at 3 liters a minute. How long does the process have to continue until there are 20 grams of salt in the tank?
Answer.
The solution is plugging in the values given, we get minutes.
Exercise 1.4.9.
Initially a tank contains 10 liters of pure water. Brine of unknown (but constant) concentration of salt is flowing in at 1 liter per minute. The water is mixed well and drained at 1 liter per minute. In 20 minutes there are 15 grams of salt in the tank. What is the concentration of salt in the incoming brine?
Answer.
The solution is where is the concentration and is the integration constant. Plugging in the given values we find g/L.
Exercise 1.4.10.
Solve
Exercise 1.4.11.
Exercise 1.4.12.
Suppose a water tank is being pumped out at 3 The water tank starts at 10 L of clean water. Water with toxic substance is flowing into the tank at 2 with concentration at time When the tank is half empty, how many grams of toxic substance are in the tank (assuming perfect mixing)?
Answer.
grams
Exercise 1.4.13.
Suppose we have bacteria on a plate and suppose that we are slowly adding a toxic substance such that the rate of growth is slowing down. That is, suppose that If find the population at
Exercise 1.4.14.
A cylindrical water tank has water flowing in at cubic meters per second. Let be the area of the cross section of the tank in meters. Suppose water is flowing from the bottom of the tank at a rate proportional to the height of the water level. Set up the differential equation for the height of the water, introducing and naming constants that you need. You should also give the units for your constants.
Answer.
where is a constant with units