Scientia sine finibus

Differential Equations / Unit 1, Differential Equations and Their Solutions / Topic 1.1

Units and Topics

Unit 1. Differential Equations and Their Solutions

1.1 What a Differential Equation Is

A differential equation is an equation that contains an unknown function and one or more of its derivatives. This topic covers what a differential equation says, what a solution is, how to check a solution, and how an initial condition selects one solution from a family of solutions.

You have already used differential equations in physics. The second law of Newton, F = ma, is a differential equation, because the acceleration is the second derivative of the position. The laws of radioactive decay, of cooling, and of electric circuits are differential equations as well. Most laws of physics give the rate at which a quantity changes. A rate of change is a derivative, so these laws are differential equations.

What you need for this topic: the derivatives of powers, exponential functions, sines, and cosines, the chain rule, and the integrals of powers.

1. What a Differential Equation Is

In an equation of algebra, such as 2x + 1 = 7, the unknown is a number. In a differential equation, the unknown is a function. The equation gives a relation between the function and its derivatives, and the task is to find the function.

dy/dt = 2t dy/dt = y

The first equation asks for a function y(t) whose derivative is 2t. The second equation asks for a function that is equal to its own derivative at each time t.

The variable t is called the independent variable, and y is called the dependent variable, because the value of y depends on t. In this course the independent variable is usually the time t, and sometimes it is a position x. The derivative dy/dt is also written y′, and the second derivative d²y/dt² is written y″.

Examples from physics

SituationDifferential equationWhat it says
An object falls without air resistancedv/dt = −gThe velocity changes at a constant rate
A radioactive sample decaysdN/dt = −kNThe number of nuclei decreases at a rate that is proportional to the number that is left
A mass moves on a springm d²x/dt² = −kxThe mass times the acceleration is equal to the force of the spring

2. What a Solution Is

A solution of a differential equation is a function that makes the equation true at each point of an interval when the function and its derivatives are substituted into the equation.

To check a solution, calculate the derivatives that the equation contains, substitute them, and compare the two sides. A solution can be checked without knowing how it was found.

Check 1: the function y = e3t in the equation y′ = 3y

y = e3tthe functiony′ = 3e3tthe derivative, by the chain rule3y = 3e3tthe right side of the equationy′ = 3ythe two sides are equal at each time t

The function is a solution.

Check 2: the function y = sin 2t in the equation y″ = −4y

y = sin 2tthe functiony′ = 2 cos 2tthe first derivativey″ = −4 sin 2tthe second derivative−4y = −4 sin 2tthe right side of the equationy″ = −4ythe two sides are equal at each time t

The function is a solution.

Check 3: the function y = t² in the equation y′ = y

y = t²the functiony′ = 2tthe derivative, which is the left sidey = t²the right side of the equation2t = t²true only for t = 0 and t = 2

The function is not a solution. The two sides are equal at two times only, and a solution must make the equation true at each point of an interval.

The solution of an equation of algebra is a number. The solution of a differential equation is a function. Solving a differential equation means finding a formula, a graph, or a table of values for the whole function.

3. Families of Solutions

A differential equation usually has many solutions. The equation y′ = 2t is solved by integration, and an integral contains a constant.

y′ = 2tthe equationy = t² + Cintegrate both sides

Each value of the constant C gives one solution: t², t² + 1, t² − 5, and so on. The formula with the constant is called the general solution, and the solutions together are called a family of solutions. A solution with a chosen value of the constant is called a particular solution.

The equation y′ = ky, with a constant k, also has a family of solutions. Its general solution is y = Cekt. The check has three lines.

y = Cektthe general solutiony′ = kCektthe derivative, by the chain ruley′ = k(Cekt) = kythe equation is satisfied for each value of C

For k = 1 this is the equation y′ = y, with the general solution y = Cet. Topic 2.1 shows how to find this general solution, and why the equation has no other solutions.

Try it: a family of solutions

The curves are solutions y = Cekt of the equation y′ = ky. The blue curve is the solution for the value of C that the slider sets. The red line is the tangent to the blue curve at the green point. Move the sliders, and compare the slope of the tangent with k times y.

The drawing shows what the equation y′ = ky says. At each point of each solution curve, the slope is k times the height. The equation gives the slope at each point. It does not select one curve, so each curve of the family is a solution.

Equations with a second derivative

The equation y″ = −4y contains a second derivative, and its general solution contains two constants, A and B.

y = A cos 2t + B sin 2tthe general solutiony′ = −2A sin 2t + 2B cos 2tthe first derivativey″ = −4A cos 2t − 4B sin 2tthe second derivativey″ = −4(A cos 2t + B sin 2t) = −4ythe equation is satisfied for all values of A and B

In general, an equation whose highest derivative is the second derivative has two constants in its general solution, and each higher derivative adds one more constant.

4. Initial Conditions

To select one solution from a family, an extra condition is needed. The most common condition gives the value of the function at one time, usually the starting time. It is called an initial condition. A differential equation together with its initial conditions is called an initial value problem.

Example 1: y′ = y with y(0) = 3

y = Cetthe general solutiony(0) = Ce⁰ = Csubstitute t = 0C = 3the initial condition y(0) = 3y = 3etthe solution

Example 2: y′ = 2t with y(1) = 5

y = t² + Cthe general solutiony(1) = 1 + Csubstitute t = 11 + C = 5the initial condition y(1) = 5C = 4subtract 1 from both sidesy = t² + 4the solution

Example 3: y″ = −4y with y(0) = 1 and y′(0) = 6

The general solution has two constants, so two conditions are needed. The second condition gives the value of the derivative at the starting time.

y = A cos 2t + B sin 2tthe general solutiony′ = −2A sin 2t + 2B cos 2tits derivativey(0) = Asubstitute t = 0, with cos 0 = 1 and sin 0 = 0A = 1the condition y(0) = 1y′(0) = 2Bsubstitute t = 0 in the derivative2B = 6the condition y′(0) = 6B = 3divide both sides by 2y = cos 2t + 3 sin 2tthe solution

The second law of Newton leads to the same kind of problem. The law is an equation for the second derivative of the position. The position and the velocity at the start are the two initial conditions, and together with the law they determine the whole motion.

5. The Order of an Equation, and Linear Equations

Differential equations are classified by two properties, because the methods of solution depend on them.

The order of a differential equation is the order of the highest derivative in it. An equation with y′ and no higher derivative has the order 1 and is called a first order equation. An equation with y″ and no higher derivative is a second order equation.

A linear equation is one in which the unknown function and its derivatives appear only to the first power. They are not multiplied by each other, and they are not placed inside another function. The coefficients of a linear equation can depend on t. Any other equation is called nonlinear.

EquationOrderKindReason
y′ = 3y1Lineary and y′ appear to the first power
y″ + 4y = 02Lineary and y″ appear to the first power
t y′ + y = cos t1LinearThe coefficient t and the term cos t contain only t
y′ = y²1Nonlineary is squared
y y′ = t1Nonlineary is multiplied by y′
θ″ + sin θ = 02NonlinearThe unknown function θ is inside a sine

The last equation describes a pendulum. Linear equations have systematic methods of solution, which Units 2 to 5 teach. Most nonlinear equations cannot be solved with a formula, and Units 1, 6, and 7 teach how to study them with graphs and with numerical methods.

The equations of Units 1 to 9 have one independent variable. They are called ordinary differential equations. An equation for a function of several variables, such as a temperature that depends on the position and on the time, contains partial derivatives and is called a partial differential equation. Unit 10 introduces partial differential equations.

6. A Complete Example: Radioactive Decay

A sample contains 800 radioactive nuclei at the time t = 0. In each year, a fixed fraction of the nuclei that are present decays, so the rate of change of the number N is proportional to N. The constant of proportionality is k = 0.1 per year. The equation is of the first order, and it is linear. The unknown function is N(t), with t in years.

The solution

dN/dt = −0.1Nthe equationN = Ce−0.1tthe general solution of y′ = ky, with k = −0.1N(0) = Csubstitute t = 0C = 800the initial condition N(0) = 800N = 800e−0.1tthe solution

The check

dN/dt = −0.1(800e−0.1t)the derivative of the solution, by the chain ruledN/dt = −0.1Nthe equation is satisfiedN(0) = 800e⁰ = 800the initial condition is satisfied

The number after 10 years

N(10) = 800e−0.1(10)substitute t = 10N(10) = 800e−1multiply in the exponentN(10) = 294rounded to a whole number

The half-life

The half-life is the time in which the number falls to one half of its starting value.

800e−0.1t = 400one half of 800e−0.1t = 1/2divide both sides by 800−0.1t = ln(1/2) = −ln 2take the natural logarithm of both sidest = (ln 2)/0.1divide both sides by −0.1t = 6.93 yearswith ln 2 = 0.693

The steps of this example are used again in each topic of the course: write the equation, classify it, find the general solution, use the initial conditions, and check the result.

Common Mistakes

  • Checking a solution at one value of t. A solution must satisfy the equation at each point of an interval.
  • Leaving out the constant of integration. Without it, the general solution is missing, and most initial conditions cannot be satisfied.
  • Treating a solution as a number. The solution of a differential equation is a function.
  • Confusing the order with a power. The equation (y′)² = y has the order 1, because its highest derivative is the first derivative.
  • Calling y′ = y² linear because the derivative appears to the first power. The unknown function must also appear only to the first power.
  • Using one initial condition for a second order equation. Two constants need two conditions.

Summary

IdeaStatement
Differential equationAn equation that contains an unknown function and its derivatives
SolutionA function that makes the equation true at each point of an interval
General solutionThe family of solutions, written with constants such as C
Initial conditionA value of the function, or of a derivative, at one time. It fixes a constant
OrderThe order of the highest derivative in the equation
Linear equationThe unknown function and its derivatives appear only to the first power
y′ = kyThe general solution is y = Cekt

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Check that y = e−2t is a solution of y′ + 2y = 0.

y = e−2tthe functiony′ = −2e−2tthe derivative, by the chain ruley′ + 2y = −2e−2t + 2e−2tsubstitute into the left sidey′ + 2y = 0the equation is satisfied at each time t

The function is a solution.

2. Is y = t³ a solution of the equation t y′ = 3y?

y = t³the functiony′ = 3t²the derivativet y′ = t(3t²) = 3t³the left side3y = 3t³the right sidet y′ = 3ythe two sides are equal at each t

The function is a solution.

3. Find the general solution of y′ = 6t², and the solution with y(1) = 5.

y′ = 6t²the equationy = 2t³ + Cintegrate both sides. This is the general solutiony(1) = 2 + Csubstitute t = 12 + C = 5the initial condition y(1) = 5C = 3subtract 2 from both sidesy = 2t³ + 3the solution

4. Find the solution of y′ = 4y with y(0) = 7, and its value at t = 0.5.

y = Ce4tthe general solution of y′ = ky, with k = 4y(0) = Csubstitute t = 0C = 7the initial condition y(0) = 7y = 7e4tthe solutiony(0.5) = 7e²substitute t = 0.5y(0.5) = 51.7with e² = 7.389

5. Give the order of each equation, and say whether it is linear: y″ + t y′ = et, y′ = sin y, y‴ = y, and y y′ = t.

y″ + t y′ = et has the order 2 and is linear. The coefficient t and the term et contain only t.

y′ = sin y has the order 1 and is nonlinear, because y is inside a sine.

y‴ = y has the order 3 and is linear.

y y′ = t has the order 1 and is nonlinear, because y is multiplied by y′.

6. The general solution of y″ = −9y is y = A cos 3t + B sin 3t. Find the solution with y(0) = 2 and y′(0) = −3.

y = A cos 3t + B sin 3tthe general solutiony′ = −3A sin 3t + 3B cos 3tits derivativey(0) = Asubstitute t = 0A = 2the condition y(0) = 2y′(0) = 3Bsubstitute t = 0 in the derivative3B = −3the condition y′(0) = −3B = −1divide both sides by 3y = 2 cos 3t − sin 3tthe solution

Python Practice

This part shows how to do the calculations of this topic with Python. Python is a programming language that is widely used in science and engineering. You do not need to know any programming, and you do not need to install anything, because the code runs on this page.

Work through the steps in order. Each step explains the code before you run it. Press Run to run the code in a box. The result appears in the gray area under the box. Some steps ask you to change the code. Type in the box, press Run again, and the page tells you whether the result is correct. Press Reset to bring back the original code. The first run takes a few seconds, because the page has to load Python.

Step 1. Print a result

Python reads the code one line at a time, from the top to the bottom. The instruction print shows a result. The value to show goes inside the parentheses. The code in the box below adds two numbers and shows the sum. Press Run.

Python

The gray area shows 5. Python uses + for addition, - for subtraction, * for multiplication, / for division, and ** for a power. For example, 2 ** 3 is 2³, which is 8.

Now change the code in the next box so that it prints the product of 7 and 6. Replace the two numbers and the symbol between them. Then press Run.

Python

Step 2. The value of a solution at one time

A name can store a value, so that the value can be used again on a later line. The equals sign stores the value on its right under the name on its left. In the code below, the second line stores the number 0.5 under the name t. The third line calculates 3e2t and stores the result under the name y. The last line prints it.

The exponential function ex is written as np.exp(x). The name np stands for NumPy. NumPy is the part of Python that contains the functions of mathematics. This page has already loaded it. Python does not understand 2t as a product. A multiplication must always be typed with the * sign.

A line that starts with # is a comment. Python skips comments. They are notes for the person who reads the code.

Python

The result is 8.154845485377136, which is 3e. Python shows many more decimal places than a calculator.

In the next box, change the code so that it calculates the same function at the time t = 1. The result should be 3e², which is about 22.167.

Python

Step 3. The values of a solution at many times

A solution of a differential equation is a function, so one value is not enough. The instruction np.linspace(0, 1, 5) makes a list of 5 evenly spaced numbers from 0 to 1. When a name stores such a list, a calculation with the name is done for each number of the list. The code below calculates y = t² at five times.

Python

The first line of the result shows the times 0, 0.25, 0.5, 0.75, and 1. The second line shows the square of each time. Python prints a list in square brackets, with spaces between the numbers and no commas.

Now change the code so that the times go from 0 to 2. The list should then contain the times 0, 0.5, 1, 1.5, and 2.

Python

Step 4. Check a solution with numbers

Part 2 checked solutions with calculus. Python can make the same check with numbers. The code below stores the function y = e3t at 1001 times between 0 and 1. The instruction np.gradient(y, t) estimates the derivative of y at each time from the values at the neighboring times. The code then compares the derivative with 3y, the right side of the equation y′ = 3y. The instruction abs removes the sign of each difference, and np.max finds the largest one.

Python

The largest difference is about 0.09, while the values of the derivative reach 60. The two sides of the equation agree at each of the 1001 times, apart from the small error of the estimate. The function is a solution.

The code in the next box tests the function y = t² in the same equation. The largest difference is about 1, which is as large as the function itself, so y = t² is not a solution of y′ = 3y. Change the code so that it tests the function y = e−2t in the equation y′ = −2y. Two lines need a change. The largest difference should be less than 0.01.

Python

Step 5. An initial condition

The general solution of y′ = y is y = Cet. An initial condition y(t0) = y0 gives the constant C in two lines.

Cet0 = y0the general solution at the time t0C = y0/et0divide both sides by et0

The code below finds C for the condition y(1) = 5. Its last line calculates the solution at the time t0 again, as a check.

Python

The constant is about 1.839, and the check gives 5. Now find the constant for the initial condition y(2) = 10. The check in the last line should give 10.

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 function is a solution of the equation y′ = 5y?

2. A function satisfies y′ = 4t and y(0) = 3. Find y(2).

3. What are the order and the kind of the equation y″ + 3y′ − y⁴ = 0?

4. Which expression is the general solution of y′ = 3t²?

5. The function y = A cos 2t + B sin 2t satisfies y(0) = 3 and y′(0) = 8. Find A and B.

Next: Topic 1.2, Direction Fields