Differential Equations
Units and Topics
Unit 2. First Order Equations
2.2 Linear Equations and Integrating Factors
A first order equation is called linear when y and y′ appear only to the first power and are not multiplied by each other. A linear equation is solved by multiplying it by a function called an integrating factor, which turns the left side into the derivative of a product. This topic covers the standard form of a linear equation, the integrating factor, the method of solution, and the two parts of the solution.
You need Topics 1.1 and 2.1 for this topic. The topic uses the product rule, the chain rule, and the integrals of powers, of 1/t, and of exponential functions.
1. Linear Equations
A first order equation is linear when it can be written in the form
y′ + p(t) y = q(t)This form is called the standard form. The functions p(t) and q(t) contain only t. They can be constants, and they do not have to be linear functions of t. The word linear describes how y and y′ appear in the equation.
| Equation | Linear | Reason |
|---|---|---|
| y′ + 2y = 4 | Yes | p(t) = 2 and q(t) = 4 |
| y′ = t² − 3y | Yes | y′ + 3y = t², so p(t) = 3 and q(t) = t² |
| ty′ + 2y = 4t² | Yes | Dividing by t gives y′ + 2/t y = 4t |
| y′ + (sin t) y = et | Yes | p(t) = sin t and q(t) = et |
| y′ + y² = t | No | y appears to the second power |
| yy′ = t | No | y is multiplied by y′ |
| y′ = sin y | No | y is inside the sine |
An equation can be both linear and separable. The equation y′ = ky of Topic 2.1 is an example, with p(t) = −k and q(t) = 0. The equation y′ + 2y = 4t is linear, and it is not separable.
A linear equation with q(t) = 0 is called homogeneous. The function q(t) is often called the forcing, because in physics it describes an influence from outside the system.
2. The Idea of the Method
The method starts from the product rule. For a function μ(t) and a solution y(t),
(μy)′ = μy′ + μ′yThe left side of a linear equation, y′ + p(t)y, has two terms, like the right side of the product rule. Multiplying the equation by μ gives μy′ + μp(t)y. This is the derivative of the product μy when μ′ = μp(t). The left side can then be integrated in one step.
A first example
For the equation y′ + 2y = 4, the function μ = e2t has the derivative μ′ = 2e2t = 2μ, so it satisfies μ′ = μp(t) with p(t) = 2.
y′ + 2y = 4the equatione2ty′ + 2e2ty = 4e2tmultiply both sides by e2t(e2ty)′ = 4e2tby the product rule, the left side is the derivative of e2tye2ty = 2e2t + Cintegrate both sides with respect to ty = 2 + Ce−2tdivide both sides by e2tThe general solution is y = 2 + Ce−2t with any constant C.
3. The Integrating Factor
The function μ(t) is called an integrating factor. It must satisfy the condition μ′ = p(t)μ. This condition is a separable equation for μ.
dμ/dt = p(t) μthe condition1/μ dμ = p(t) dtseparate the variablesln|μ| = ∫ p(t) dtintegrate both sidesμ = e∫ p(t) dtapply the exponential function, and choose the positive functionOnly one integrating factor is needed, so the constant of integration in ∫ p(t) dt is set to 0.
The integrating factor. For the equation y′ + p(t)y = q(t), the integrating factor is μ(t) = e∫ p(t) dt. The equation must be in the standard form before p(t) is read from it.
| p(t) | ∫ p(t) dt | Integrating factor μ(t) |
|---|---|---|
| 2 | 2t | e2t |
| −3 | −3t | e−3t |
| 2t | t² | et² |
| 2/t | 2 ln t | e2 ln t = t² |
| −1/t | −ln t | e−ln t = 1/t |
The last two rows are for t greater than 0. They use the rule ea ln t = ta.
4. The Method
The method has five steps.
- Write the equation in the standard form y′ + p(t)y = q(t).
- Calculate the integrating factor μ(t) = e∫ p(t) dt.
- Multiply both sides of the equation by μ(t). The left side is then (μy)′.
- Integrate both sides, and add one constant C on the right side.
- Divide both sides by μ(t).
In symbols, the steps give
(μy)′ = μ(t) q(t)after the multiplication by μμy = ∫ μ(t) q(t) dt + Cintegrate both sidesy = 1/μ(t) [∫ μ(t) q(t) dt + C]divide by μIt is better to follow the steps for each equation than to memorize the last line.
A complete example with constant coefficients
Solve y′ + 2y = 4 with the initial condition y(0) = 5. Part 2 found the general solution y = 2 + Ce−2t.
y(0) = 2 + Ce⁰ = 2 + Csubstitute t = 02 + C = 5the initial condition y(0) = 5C = 3subtract 2 from both sidesy = 2 + 3e−2tthe solutionThe check substitutes the solution in the equation.
y′ = −6e−2tthe derivative of the solutiony′ + 2y = −6e−2t + 4 + 6e−2tsubstitute y′ and yy′ + 2y = 4the equation is satisfied5. An Equation with a Coefficient That Depends on t
Solve ty′ + 2y = 4t² for t greater than 0, with the initial condition y(1) = 2.
y′ + 2/t y = 4tdivide by t to reach the standard form, so p(t) = 2/t and q(t) = 4tμ = e2 ln t = t²the integrating factort²y′ + 2ty = 4t³multiply the standard form by t²(t²y)′ = 4t³the left side is the derivative of t²yt²y = t⁴ + Cintegrate both sidesy = t² + C/t²divide both sides by t²The initial condition gives the constant.
y(1) = 1 + Csubstitute t = 11 + C = 2the initial condition y(1) = 2C = 1subtract 1 from both sidesy = t² + 1/t²the solutionThe coefficient p(t) = 2/t has no value at t = 0. The solution with C = 1 grows without limit as t approaches 0, and it exists for t greater than 0. A solution of a linear equation exists on the whole interval on which p(t) and q(t) are continuous. Topic 2.6 returns to this.
The most common error
The integrating factor must be calculated from the standard form. In the equation ty′ + 2y = 4t², the coefficient of y is 2, and the function e2t is not an integrating factor. The division by t comes first.
6. The Two Parts of the Solution
The solutions of Parts 4 and 5 have the same structure.
| Equation | General solution | Part without C | Part with C |
|---|---|---|---|
| y′ + 2y = 4 | y = 2 + Ce−2t | 2 | Ce−2t |
| y′ + 2/t y = 4t | y = t² + C/t² | t² | C/t² |
The part without C is one solution of the equation. It is called a particular solution. The part with C is the general solution of the homogeneous equation y′ + p(t)y = 0, and it is equal to C/μ(t).
Structure of the solution. The general solution of a linear equation is one particular solution plus the general solution of the homogeneous equation.
The same structure appears for linear equations of second order in Unit 3.
Constant coefficients
For the equation y′ + ky = b with constants k and b, the method gives
(ekty)′ = bektmultiply by the integrating factor ektekty = b/k ekt + Cintegrate both sidesy = b/k + Ce−ktdivide by ektFor a positive k, the term Ce−kt approaches 0 as t increases. It is called the transient. Each solution approaches the constant b/k, which is called the steady state. The steady state is the equilibrium solution of Topic 1.2, and it does not depend on the initial condition. The initial condition decides only the constant C of the transient.
Try it: the equation y′ + ky = b
The gray segments are the direction field of the equation y′ + ky = b. The blue curve is the solution with y(0) = y₀, drawn from the formula of Part 6. The green dashed line is the steady state. The sliders set k, b, and y₀.
7. A Forcing That Depends on t
Solve y′ + y = e−t with the initial condition y(0) = 2.
μ = etthe integrating factor, with p(t) = 1(ety)′ = ete−t = 1multiply by et. The right side is 1ety = t + Cintegrate both sidesy = te−t + Ce−tdivide by etC = 2the initial condition y(0) = 2y = (t + 2)e−tthe solutionThe particular solution is te−t. The forcing e−t has the same form as the solution e−t of the homogeneous equation, and the particular solution then contains the additional factor t. Unit 3 returns to this.
A forcing that oscillates
Solve y′ + y = sin t with the initial condition y(0) = 0. The method needs the integral of et sin t, which is found by integrating by parts two times.
∫ et sin t dt = 1/2 et (sin t − cos t) (ety)′ = et sin tmultiply by the integrating factor etety = 1/2 et (sin t − cos t) + Cintegrate both sidesy = 1/2(sin t − cos t) + Ce−tdivide by et0 = −1/2 + Cthe initial condition y(0) = 0y = 1/2(sin t − cos t) + 1/2 e−tthe solution, with C = 1/2The transient 1/2 e−t approaches 0. After a long time the solution is the oscillation 1/2(sin t − cos t), which has the same period as the forcing.
8. An Example from Physics: Falling with Air Resistance
An object of mass m falls from rest. The gravitational force mg acts downward, and the air exerts a resistive force bv upward, where v is the downward velocity and b is a positive constant. The second law of Newton gives
m dv/dt = mg − bvDividing by m and moving the term with v to the left gives a linear equation in the standard form.
v′ + b/m v = gIn this part, b/m is 0.2 per second, g is 9.8 m/s², v is in meters per second, and t is in seconds.
v′ + 0.2v = 9.8the equation, with k = 0.2 and the constant right side 9.8v = 9.8/0.2 + Ce−0.2tthe general solution from Part 6v = 49 + Ce−0.2tbecause 9.8/0.2 = 490 = 49 + Cthe initial condition v(0) = 0v = 49(1 − e−0.2t)the solution, with C = −49The steady state is 49 m/s. It is called the terminal velocity. At this velocity the resistive force is equal to the gravitational force, and the acceleration is 0. In symbols, the terminal velocity is mg/b.
The time at which the object has one half of the terminal velocity follows from the solution.
24.5 = 49(1 − e−0.2t)set v equal to 24.5e−0.2t = 1/2divide by 49, then solve for the exponential function−0.2t = ln(1/2) = −ln 2take the natural logarithm of both sidest = 5 ln 2divide by −0.2t = 3.5 secondswith ln 2 = 0.693Common Mistakes
- Reading p(t) from an equation that is not in the standard form. The coefficient of y′ must be 1.
- Multiplying only the left side by the integrating factor. Both sides are multiplied.
- Leaving out the constant C in the integration step, or adding it at the end. For y′ + 2y = 4, the result y = 2e−2t + C is wrong, and y = 2 + Ce−2t is correct.
- Dividing only one term by μ in the last step. The constant C is divided by μ too.
- Losing the sign of p(t). For y′ − 3y = 0, p(t) is −3, and the integrating factor is e−3t.
- Writing e2 ln t as 2t. The correct value is t².
Summary
| Idea | Statement |
|---|---|
| Linear equation, standard form | y′ + p(t)y = q(t) |
| Integrating factor | μ(t) = e∫ p(t) dt |
| Main step | μy′ + μp(t)y = (μy)′ |
| Solution | y = 1/μ [∫ μq dt + C] |
| Structure | A particular solution plus C/μ(t) |
| y′ + ky = b | y = b/k + Ce−kt |
| Steady state and transient | For a positive k, the solutions approach b/k, and Ce−kt approaches 0 |
| Falling with air resistance | v′ + b/m v = g has the terminal velocity mg/b |
Practice
Work each problem on paper first. Then open the answer to check your work.
1. Which of these equations are linear: y′ = t³ − 5y, y′ = ty², t²y′ + y = cos t, and y′ = ey?
y′ = t³ − 5y is linear. Its standard form is y′ + 5y = t³.
t²y′ + y = cos t is linear. Its standard form is y′ + 1/t² y = (cos t)/t².
y′ = ty² and y′ = ey are not linear, because y appears to the second power or inside the exponential function.
2. Solve y′ + 3y = 6 with y(0) = 0.
μ = e3tthe integrating factor, with p(t) = 3(e3ty)′ = 6e3tmultiply both sides by e3te3ty = 2e3t + Cintegrate both sidesy = 2 + Ce−3tdivide by e3t0 = 2 + Cthe initial condition y(0) = 0y = 2 − 2e−3tthe solution, with C = −2
3. Solve y′ − y = e2t with y(0) = 3.
μ = e−tthe integrating factor, with p(t) = −1(e−ty)′ = e−te2t = etmultiply both sides by e−te−ty = et + Cintegrate both sidesy = e2t + Cetmultiply both sides by et3 = 1 + Cthe initial condition y(0) = 3y = e2t + 2etthe solution, with C = 2
4. Solve ty′ + y = 3t² for t greater than 0, with y(1) = 4.
y′ + 1/t y = 3tdivide by t to reach the standard formμ = eln t = tthe integrating factor(ty)′ = 3t²multiply the standard form by tty = t³ + Cintegrate both sidesy = t² + C/tdivide by t4 = 1 + Cthe initial condition y(1) = 4y = t² + 3/tthe solution, with C = 3
The left side of the given equation, ty′ + y, is already the derivative of ty. The method finds this.
5. Solve y′ + 2ty = 2t with y(0) = 3.
μ = et²the integrating factor, with p(t) = 2t(et²y)′ = 2tet²multiply both sides by et²et²y = et² + Cintegrate both sides. The derivative of et² is 2tet²y = 1 + Ce−t²divide by et²3 = 1 + Cthe initial condition y(0) = 3y = 1 + 2e−t²the solution, with C = 2
This equation is also separable, because y′ = 2t(1 − y). The method of Topic 2.1 gives the same solution.
6. An object falls from rest with air resistance. Its downward velocity satisfies v′ + 0.5v = 9.8, with v in meters per second and t in seconds. Find the terminal velocity, v(t), and the velocity after 2 seconds.
v = 9.8/0.5 + Ce−0.5tthe general solution of y′ + ky = bv = 19.6 + Ce−0.5tthe terminal velocity is 19.6 m/s0 = 19.6 + Cthe initial condition v(0) = 0v = 19.6(1 − e−0.5t)the solutionv(2) = 19.6(1 − e−1)substitute t = 2v(2) = 12.4 m/swith e−1 = 0.368
Python Practice
Step 1. Check a solution
Part 4 found the solution y = 2 + 3e−2t of the equation y′ + 2y = 4. The code below checks it. It stores the function at 10001 times between 0 and 1, estimates the derivative with np.gradient, and prints the largest difference between the left side y′ + 2y and the right side 4.
Python
The largest difference is about 0.0006, so the function satisfies the equation. Now check the solution y = t² + 1/t² of the equation ty′ + 2y = 4t² of Part 5, for times between 1 and 2. Three lines need a change. The largest difference should be about 0.0004.
Python
Step 2. The formula and the method of Euler
The code below solves y′ + 2y = 4 with y(0) = 5 in two ways. For the method of Euler, the equation is written as y′ = 4 − 2y. The loop takes 1000 steps up to the time t = 1. The line after the loop calculates the value of the formula y = 2 + Ce−2t with C = y0 − 2.
Python
The method gives 2.4052, and the formula gives 2.4060. Now change the initial value to y(0) = 0. Both values should be close to 1.729.
Python
Step 3. The steady state
The code below calculates the solution y = 2 + 3e−2t at the times 0, 1, 2, 5, and 10.
Python
The values are 5, 2.406, 2.055, 2.0001, and 2.0000. They approach the steady state b/k = 4/2 = 2. The equation y′ + 0.5y = 4 with y(0) = 5 has the steady state 4/0.5 = 8 and the solution y = 8 − 3e−0.5t. Change the second line so that it calculates this solution. The last value should be about 7.98.
Python
With the smaller k, the transient decreases more slowly, so the solution needs more time to come close to the steady state.
Step 4. A forcing that oscillates
Part 7 found the general solution y = 1/2(sin t − cos t) + Ce−t of the equation y′ + y = sin t. Substituting t = 0 gives y(0) = −1/2 + C, so C = y(0) + 1/2. The code below follows the solution with y(0) = 0 by the method of Euler up to the time t = 3 and compares it with the formula.
Python
The method gives 0.5911, and the formula gives 0.5904. Now start at y(0) = 1. Both values should be close to 0.640.
Python
The two starting values differ by 1. At t = 3 the two solutions differ by only e−3 = 0.05, because they differ only in the transient.
Step 5. Approaching the terminal velocity
Part 8 found the velocity v = 49(1 − e−0.2t) of a falling object. The object has the fraction p of the terminal velocity when 1 − e−0.2t = p.
1 − e−0.2t = pthe conditione−0.2t = 1 − psolve for the exponential function−0.2t = ln(1 − p)take the natural logarithm of both sidest = −5 ln(1 − p)divide both sides by −0.2The natural logarithm is typed as np.log. The code below calculates the time at which the object has 90 percent of the terminal velocity.
Python
The time is 11.5 seconds. Now find the time at which the object has 99 percent of the terminal velocity. The result should be about 23.03 seconds.
Python
Quiz
This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.
Choose how your answers are checked
1. Which of these equations is linear?
The equation y′ + t²y = sin t has the standard form y′ + p(t)y = q(t), with p(t) = t² and q(t) = sin t. The functions p(t) and q(t) can be any functions of t. In the other three equations, y appears to the second power, is multiplied by y′, or is inside the cosine.
2. What is the integrating factor of the equation ty′ + 3y = t², for t greater than 0?
y′ + 3/t y = tdivide by t to reach the standard form, so p(t) = 3/t∫ 3/t dt = 3 ln tthe integral of p(t)μ = e3 ln t = t³the integrating factorThe function e3t is the result of reading p(t) from the equation before the division by t.
3. Solve y′ + 3y = 6 with y(0) = 5, and find y(1).
(e3ty)′ = 6e3tmultiply by the integrating factor e3te3ty = 2e3t + Cintegrate both sidesy = 2 + Ce−3tdivide by e3tC = 3the initial condition y(0) = 5y(1) = 2 + 3e−3 = 2.149substitute t = 1
4. A solution of ty′ + y = 2t, for t greater than 0, satisfies y(1) = 3. Find y(2).
(ty)′ = 2tthe left side ty′ + y is the derivative of tyty = t² + Cintegrate both sides1(3) = 1 + Cthe initial condition y(1) = 3C = 2subtract 1y = t + 2/tdivide by ty(2) = 2 + 1 = 3substitute t = 2
5. The velocity of a falling object satisfies v′ + 0.5v = 10. Which value does v approach after a long time?
v = 10/0.5 + Ce−0.5tthe general solution of v′ + kv = bv = 20 + Ce−0.5tbecause 10/0.5 = 20The transient Ce−0.5t approaches 0, so each solution approaches the steady state 20. At this value, v′ = 10 − 0.5(20) = 0.