International Baccalaureate · DP 2: Analysis and Approaches HL
Differential Equations
I
Differential Equations and Their Solutions
I.1
Fundamentals of Differential Equations
Many of the most important laws of nature, from the motion of planets to the growth of populations, are described not by simple formulas but by equations that relate a function to its rates of change. These are known as differential equations. They form the language of modern science and engineering.
Differential equations come with several fundamental techniques for finding their solutions. We will begin with analytical methods for exact solutions, such as separation of variables and the integrating factor method. We will then investigate numerical methods, like Euler's method, which allow us to approximate solutions when exact ones are out of reach. Along the way, we will see how these equations are applied to model real-world phenomena like logistic growth and Newton's law of cooling.
Differential equations come with several fundamental techniques for finding their solutions. We will begin with analytical methods for exact solutions, such as separation of variables and the integrating factor method. We will then investigate numerical methods, like Euler's method, which allow us to approximate solutions when exact ones are out of reach. Along the way, we will see how these equations are applied to model real-world phenomena like logistic growth and Newton's law of cooling.
Definition — Differential Equation
A differential equation is an equation that contains an unknown function and one or more of its derivatives. - The order of a differential equation is the order of the highest derivative it contains.
- A general solution is a family of functions that satisfies the equation, typically involving one or more arbitrary constants.
- An initial condition is a specified value of the function or its derivatives at a particular point.
- A particular solution is a specific solution. It can be obtained by using one or more initial conditions (one per arbitrary constant) to determine the values of the arbitrary constants in the general solution.
Definition — Solution of a Differential Equation
A solution of a differential equation on an interval \(I\) is any function, differentiable on \(I\) as many times as the equation requires, that satisfies the equality for every \(x\) in \(I\).The order of a differential equation is the order of the highest derivative of the unknown function appearing in it (\(1\) for \(y'\), \(2\) for the second derivative \(y''\)): \(y' = 2y - 6\) is a first-order equation, \(y'' - y = 0\) a second-order equation.
Solving a differential equation means finding all the solution functions that satisfy the equality.
Example
The function \(x \mapsto e^{-x}\) is a solution of the equation \(y'' - y = 0\) because, for \(y(x) = e^{-x}\), we have \(y'(x) = -e^{-x}\) and \(y''(x) = e^{-x}\). Thus, \(y''(x) - y(x) = e^{-x} - e^{-x} = 0\).
Definition — Understanding Notations
It is crucial to understand that in a differential equation, \(y\) is a function, not a fixed number. Depending on the context (Mathematics, Physics, or Engineering), we use different notations for the unknown function and its derivative: - Lagrange notation: Uses a "prime" symbol (\(y'\)). This is the most common shorthand in Math.
- Leibniz notation: Uses a differential ratio (\(\dfrac{\mathrm{d}y}{\mathrm{d}t}\) or \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\)). This explicitly shows which variable we are differentiating with respect to (usually time \(t\) or position \(x\)).
- Functional notation: Explicitly writes \(y(t)\) or \(y(x)\) to remind us that the value depends on the variable.
Example
The following three equations represent exactly the same relationship where \(y\) is a function of time \(t\): - Shorthand style: \(2y' + 3y = t\)
- Functional style: \(2y'(t) + 3y(t) = t\)
- Differential style (Leibniz): \(2\dfrac{\mathrm{d}y}{\mathrm{d}t} + 3y(t) = t\)
Example
An apple is dropped from rest at a height of 10 meters. Its vertical position, \(y(t)\), is governed by the second-order differential equation: $$\frac{d^2 y}{\mathrm{d}t^2}=-g$$ where \(g\) is the constant of gravitational acceleration. 
- State the initial conditions for position \(y(0)\) and velocity \(y'(0)\).
- Verify that the general solution to this equation is \(y(t) = -\frac{1}{2}gt^2 + At + B\).
- Use the initial conditions to find the particular solution for the apple's motion.
- Initial Conditions:
- The initial height is 10 meters, so \(y(0)=10\).
- The apple is dropped “from rest,” so its initial velocity is zero. Thus, \(y'(0)=0\).
- Verifying the General Solution: We need to show that the second derivative of \(y(t) = -\frac{1}{2}gt^2 + At + B\) is equal to \(-g\).
- First derivative (velocity): \(y'(t) = \dfrac{d}{\mathrm{d}t}\left(-\frac{1}{2}gt^2 + At + B\right) = -gt + A\).
- Second derivative (acceleration): \(y''(t) = \dfrac{d}{\mathrm{d}t}(-gt + A) = -g\).
- Finding the Particular Solution: We apply the initial conditions to the general solution and its first derivative.
- Using \(y(0)=10\): $$ y(0) = -\frac{1}{2}g(0)^2 + A(0) + B \implies 10 = B $$
- Using \(y'(0)=0\): $$ y'(0) = -g(0) + A \implies 0 = A $$
Skills to practice
- Defining and Verifying Differential Equations
- Checking Solutions of Differential Equations
- Modeling with Differential Equations
II
Exact Solutions
II.1
Solving by Direct Integration
Method — Solving for \(\frac{dy}{dx} \equal f(x)\)
When the derivative of a function depends only on \(x\), we can find the general solution by rearranging the equation and integrating directly. $$ \begin{aligned} \frac{\mathrm{d}y}{\mathrm{d}x} &= f(x)\\
\mathrm{d}y &= f(x)\, \mathrm{d}x \\
\int \mathrm{d}y &= \int f(x) \, \mathrm{d}x \\
y &= \int f(x) \, \mathrm{d}x + C \end{aligned} $$ Example
Find the general solution to \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 3x^2 \) and the particular solution with initial condition \(y(0)=4\).
We rearrange and integrate both sides: $$ \begin{aligned} \dfrac{\mathrm{d}y}{\mathrm{d}x} &= 3x^2 \\
\mathrm{d}y &= 3x^2 \, \mathrm{d}x \\
\int \mathrm{d}y &= \int 3x^2\, \mathrm{d}x \\
y & = x^3 + C \end{aligned} $$ This is the general solution. Now we use the initial condition \(y(0)=4\): $$ 4 = (0)^3 + C \implies C=4 $$ The particular solution is \(y = x^3 + 4\).
Skills to practice
- Solving by Direct Integration
- Finding Particular Solutions by Integration
II.2
Solving by Separation of Variables
A separable differential equation is one that can be expressed in the form \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = g(x)h(y)\). These equations can be solved by algebraically separating the variables before integrating.
Method — Solving Separable Equations \(\frac{dy}{dx} \equal g(x)h(y)\)
This method applies when the equation can be rearranged so that all terms involving \(y\) are on one side and all terms involving \(x\) are on the other. - Separate: Rearrange the equation into the form \(\dfrac{1}{h(y)}\, \mathrm{d}y = g(x)\, \mathrm{d}x\).
- Integrate: Integrate both sides of the equation with respect to their respective variables: $$ \int \dfrac{1}{h(y)} \, \mathrm{d}y = \int g(x) \, \mathrm{d}x $$
- Solve for \(y\): If possible, solve the resulting equation for \(y\) to get an explicit solution.
Example
Solve \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -2xy^2\) with the initial condition \(y(1)=1\).
We rearrange and integrate both sides: $$ \begin{aligned} \dfrac{\mathrm{d}y}{\mathrm{d}x} &= -2xy^2 \\
\frac{1}{y^2} \, \mathrm{d}y &= -2x \, \mathrm{d}x \\
\int \frac{1}{y^2} \, \mathrm{d}y &= \int -2x \, \mathrm{d}x \\
\int y^{-2} \, \mathrm{d}y &= \int -2x \, \mathrm{d}x \\
-y^{-1} &= -x^2 + C \\
-\frac{1}{y} &= -x^2 + C \end{aligned} $$ This is the general solution in implicit form. Using the initial condition \(y(1)=1\): $$ -\dfrac{1}{1} = -(1)^2 + C \implies -1 = -1 + C \implies C = 0 $$ Substituting \(C=0\) gives the particular solution: $$ -\dfrac{1}{y} = -x^2 \implies y = \dfrac{1}{x^2} $$ This solution is defined on \((0, +\infty)\), the interval containing the initial point \(x = 1\). Note that the constant function \(y = 0\) (lost when dividing by \(y^2\)) is also a solution of the equation, but it does not satisfy the initial condition.
Skills to practice
- Solving Separable Equations
- Finding Particular Solutions by Separation
- Separating Variables: Partial Fractions and Models
II.3
Logistic Growth
Exponential growth \(\frac{\mathrm{d}P}{\mathrm{d}t} = kP\) assumes unlimited resources: the population grows without bound. Real populations live in environments that can only support a limited number of individuals. The logistic model refines the exponential model by making the growth rate shrink as the population approaches this limit.
Definition — The Logistic Equation
A population \(P(t)\) follows logistic growth when it satisfies$$ \frac{\mathrm{d}P}{\mathrm{d}t} = kP\left(1 - \frac{P}{A}\right), $$ where \(k > 0\) is the growth rate and \(A > 0\) is the carrying capacity — the largest population the environment can sustain. Proposition — Solution of the Logistic Equation
For an initial population \(P(0) = P_0\) with \(0 < P_0 < A\), the solution of the logistic equation is$$ P(t) = \frac{A}{1 + Ce^{-kt}}, \qquad C = \frac{A - P_0}{P_0}. $$ Moreover: - \(P(t) \to A\) as \(t \to \infty\): the population approaches the carrying capacity.
- The growth rate \(\frac{\mathrm{d}P}{\mathrm{d}t}\), viewed as a function of \(P\), is greatest at \(P = \frac{A}{2}\).
The equation is separable. For \(0 < P < A\), writing \(\frac{\mathrm{d}P}{\mathrm{d}t} = \frac{k}{A}P(A-P)\) and using the partial-fraction identity$$ \frac{A}{P(A-P)} = \frac{1}{P} + \frac{1}{A-P}, $$ we separate and integrate:$$\begin{aligned}\int \left(\frac{1}{P} + \frac{1}{A-P}\right) \mathrm{d}P &= \int k \, \mathrm{d}t \\
\ln P - \ln(A-P) &= kt + c \\
\frac{P}{A-P} &= Be^{kt} &&\text{(with } B = e^{c})\end{aligned}$$ Solving for \(P\) gives \(P = \dfrac{ABe^{kt}}{1 + Be^{kt}} = \dfrac{A}{1 + \frac{1}{B}e^{-kt}}\), so \(P(t) = \dfrac{A}{1 + Ce^{-kt}}\) with \(C = \frac{1}{B}\). The initial condition gives \(\frac{P_0}{A - P_0} = B\), hence \(C = \frac{A - P_0}{P_0}\).
As \(t \to \infty\), \(e^{-kt} \to 0\), so \(P(t) \to A\). Finally, \(\frac{\mathrm{d}P}{\mathrm{d}t} = kP - \frac{k}{A}P^2\) is a quadratic in \(P\) opening downwards, whose maximum is at \(P = \frac{A}{2}\).
As \(t \to \infty\), \(e^{-kt} \to 0\), so \(P(t) \to A\). Finally, \(\frac{\mathrm{d}P}{\mathrm{d}t} = kP - \frac{k}{A}P^2\) is a quadratic in \(P\) opening downwards, whose maximum is at \(P = \frac{A}{2}\).
Example
An island can sustain at most \(1000\) rabbits. The rabbit population, with \(t\) in years, follows the logistic equation$$ \frac{\mathrm{d}P}{\mathrm{d}t} = 0.2P\left(1 - \frac{P}{1000}\right), \qquad P(0) = 100. $$ - Find \(P(t)\).
- What is the limiting population?
- After how long does the population reach \(500\) rabbits, and why is the growth fastest at that moment?
- Here \(k = 0.2\), \(A = 1000\) and \(P_0 = 100\), so$$ C = \frac{A - P_0}{P_0} = \frac{1000 - 100}{100} = 9 \qquad\text{and}\qquad P(t) = \frac{1000}{1 + 9e^{-0.2t}}. $$
- As \(t \to \infty\), \(e^{-0.2t} \to 0\), so \(P(t) \to 1000\): the limiting population is the carrying capacity, \(1000\) rabbits.
- We solve \(P(t) = 500\):$$\begin{aligned}\frac{1000}{1 + 9e^{-0.2t}} &= 500 \\ 1 + 9e^{-0.2t} &= 2 \\ e^{-0.2t} &= \frac{1}{9} \\ t &= \frac{\ln 9}{0.2} = 5\ln 9 \approx 11.0 \text{ years.}\end{aligned}$$ The growth is fastest there because \(500 = \frac{A}{2}\), where the rate \(\frac{\mathrm{d}P}{\mathrm{d}t} = kP\left(1-\frac{P}{A}\right)\) reaches its maximum.

Skills to practice
- Computing with a Logistic Model
- Solving and Interpreting Logistic Models
II.4
Solving Homogeneous Equations
A special class of first-order differential equations are those that can be expressed as a function of the ratio \(y/x\). These are known as homogeneous differential equations: $$ \dfrac{\mathrm{d}y}{\mathrm{d}x} = F\left(\frac{y}{x}\right). $$
Method — Solving Homogeneous Equations
To solve a homogeneous differential equation: - Confirm homogeneity: Rewrite the equation to show it is of the form \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = F(y/x)\).
- Substitute: Let \(y=vx\). Replace all instances of \(y/x\) with \(v\) and replace \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) with \(v + x\dfrac{\mathrm{d}v}{\mathrm{d}x}\).
- Solve the separable equation: The resulting equation will be separable in terms of \(v\) and \(x\). Solve it for \(v\).
- Back-substitute: Replace \(v\) with \(y/x\) to express the final solution in terms of \(x\) and \(y\).
Example
Find the general solution to the differential equation \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{x+y}{x}\). - Confirm homogeneity: We rewrite the right-hand side: $$ \dfrac{\mathrm{d}y}{\mathrm{d}x} = \frac{x}{x} + \frac{y}{x} = 1 + \frac{y}{x}. $$ This is of the form \(F(y/x)\), so it is homogeneous.
- Substitute: Let \(y=vx\). Then \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = v + x\dfrac{\mathrm{d}v}{\mathrm{d}x}\). The equation becomes: $$ v + x\dfrac{\mathrm{d}v}{\mathrm{d}x} = 1 + v. $$
- Solve the separable equation: Now, we solve the new equation for \(v\): $$ x\dfrac{\mathrm{d}v}{\mathrm{d}x} = 1. $$ This is a simple separable equation: $$ \mathrm{d}v = \frac{1}{x} \, \mathrm{d}x. $$ Integrate both sides: $$ \int \mathrm{d}v = \int \frac{1}{x} \, \mathrm{d}x \implies v = \ln|x| + C. $$
- Back-substitute: Replace \(v\) with \(y/x\) to get the final solution: $$ \frac{y}{x} = \ln|x| + C. $$ The explicit general solution is: $$ y = x(\ln|x| + C). $$ This family is valid on an interval with \(x > 0\), or on one with \(x < 0\) (the equation is undefined at \(x = 0\)).
Skills to practice
- Solving Homogeneous Equations with Initial Conditions
- Finding General Solutions of Homogeneous Equations
II.5
Solving with the Integrating Factor
Separable equations are not the only type of first-order differential equation. Consider an equation in the linear form \(\dfrac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = Q(x)\). In general, the variables cannot be separated here.
The goal is to transform the left side, \(\dfrac{\mathrm{d}y}{\mathrm{d}x} + P(x)y\), into the result of the product rule for differentiation, \(\dfrac{d}{\mathrm{d}x}(I(x)y)\). Recall that the product rule gives: $$ \dfrac{d}{\mathrm{d}x}(I(x)y) = I(x)\dfrac{\mathrm{d}y}{\mathrm{d}x} + I'(x)y. $$ Let's try to achieve this by multiplying our original equation by some (currently unknown) function \(I(x)\), which we call the integrating factor: $$ \underbrace{I(x)\dfrac{\mathrm{d}y}{\mathrm{d}x} + I(x)P(x)y}_{\text{Our transformed left side}} = I(x)Q(x). $$ Now, compare the left side to the product rule expansion. For them to be equal, we need: $$ I'(x)y = I(x)P(x)y \implies I'(x) = I(x)P(x). $$ This is a separable differential equation for \(I(x)\): $$ \dfrac{I'(x)}{I(x)} = P(x) \implies \int \dfrac{1}{I} \, \mathrm{d}I = \int P(x) \, \mathrm{d}x \implies \ln|I| = \int P(x) \, \mathrm{d}x. $$ Solving for \(I(x)\) gives us the formula for the integrating factor: \(I(x) = e^{\int P(x)\, \mathrm{d}x}\). By multiplying our original equation by this specific function, we force the left side to become a simple derivative, which we can then easily integrate.
The goal is to transform the left side, \(\dfrac{\mathrm{d}y}{\mathrm{d}x} + P(x)y\), into the result of the product rule for differentiation, \(\dfrac{d}{\mathrm{d}x}(I(x)y)\). Recall that the product rule gives: $$ \dfrac{d}{\mathrm{d}x}(I(x)y) = I(x)\dfrac{\mathrm{d}y}{\mathrm{d}x} + I'(x)y. $$ Let's try to achieve this by multiplying our original equation by some (currently unknown) function \(I(x)\), which we call the integrating factor: $$ \underbrace{I(x)\dfrac{\mathrm{d}y}{\mathrm{d}x} + I(x)P(x)y}_{\text{Our transformed left side}} = I(x)Q(x). $$ Now, compare the left side to the product rule expansion. For them to be equal, we need: $$ I'(x)y = I(x)P(x)y \implies I'(x) = I(x)P(x). $$ This is a separable differential equation for \(I(x)\): $$ \dfrac{I'(x)}{I(x)} = P(x) \implies \int \dfrac{1}{I} \, \mathrm{d}I = \int P(x) \, \mathrm{d}x \implies \ln|I| = \int P(x) \, \mathrm{d}x. $$ Solving for \(I(x)\) gives us the formula for the integrating factor: \(I(x) = e^{\int P(x)\, \mathrm{d}x}\). By multiplying our original equation by this specific function, we force the left side to become a simple derivative, which we can then easily integrate.
Method — The Integrating Factor Method
This method solves first-order linear differential equations. - Standard form: Ensure the equation is in the form \(\dfrac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = Q(x)\).
- Find the integrating factor (I.F.): Calculate \(I(x) = e^{\int P(x)\, \mathrm{d}x}\). (No constant of integration is needed here.)
- Multiply: Multiply the entire standard-form equation by \(I(x)\). The left side will now simplify to \(\dfrac{d}{\mathrm{d}x}(I(x)y)\): $$ \dfrac{d}{\mathrm{d}x}(I(x)y) = I(x)Q(x). $$
- Integrate and solve: Integrate both sides with respect to \(x\) and solve for \(y\): $$ I(x)y = \int I(x)Q(x) \, \mathrm{d}x. $$
Example
Solve \(\dfrac{\mathrm{d}y}{\mathrm{d}x} + 2y = 6\).
The equation is in standard form with \(P(x) = 2\) and \(Q(x) = 6\).
- Find the integrating factor: $$ I(x) = e^{\int 2 \, \mathrm{d}x} = e^{2x}. $$
- Multiply by I.F.: $$ e^{2x}\dfrac{\mathrm{d}y}{\mathrm{d}x} + 2e^{2x}y = 6e^{2x}. $$ The left side now equals \(\dfrac{d}{\mathrm{d}x}(e^{2x}y)\): $$ \dfrac{d}{\mathrm{d}x}(e^{2x}y) = 6e^{2x}. $$
- Integrate and solve: $$ e^{2x}y = \int 6e^{2x} \, \mathrm{d}x = \frac{6e^{2x}}{2} + C = 3e^{2x} + C. $$ Finally, divide by \(e^{2x}\) to solve for \(y\): $$ y = \frac{3e^{2x} + C}{e^{2x}} = 3 + Ce^{-2x}. $$
Skills to practice
- Finding the Integrating Factor
- Finding Particular Solutions with the Integrating Factor
- Solving with the Integrating Factor Method
III
Approximate Solutions
III.1
Finding Series Solutions of Differential Equations
It is possible to generate the terms of a Maclaurin series for the solution of a differential equation directly from the equation itself, without first finding the solution.
Method — Finding a Maclaurin Series from a Differential Equation
Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x,y)\) and an initial condition \(y(0)=y_0\): - Iterative derivation: Find expressions for the higher derivatives by repeatedly differentiating the equation from the previous step with respect to \(x\). This often requires implicit differentiation. $$ \begin{aligned} y' &= f(x,y)\\ y'' &= \frac{d}{\mathrm{d}x}f(x,y)\\ y''' &= \frac{d}{\mathrm{d}x}\left(\frac{d}{\mathrm{d}x}f(x,y)\right)\\ &\vdots \end{aligned} $$
- Iterative substitution: Use the initial condition \((0,y_0)\) and previously found derivative values to find the numerical values of \(y'(0), y''(0), y'''(0), \dots\) in sequence.
- Construct the series: Substitute these values into the Maclaurin series formula: $$ y(x) = y(0) + y'(0)x + \dfrac{y''(0)}{2!}x^2 + \dfrac{y'''(0)}{3!}x^3 + \dots $$
Example
Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x - 2y\) and \(y(0) = 1\), find the Maclaurin series for \(y(x)\) up to the term in \(x^3\).
We are given \(y(0)=1\).
- Iterative derivation: $$ \begin{aligned} y' &= x - 2y\\ y'' &= \frac{d}{\mathrm{d}x}(x - 2y) = 1 - 2y'\\ y''' &= \frac{d}{\mathrm{d}x}(1 - 2y') = -2y'' \end{aligned} $$
- Iterative substitution: $$ \begin{aligned} y'(0) &= 0 - 2y(0) = -2(1) = -2,\\ y''(0) &= 1 - 2y'(0) = 1 - 2(-2) = 5,\\ y'''(0) &= -2y''(0) = -2(5) = -10. \end{aligned} $$
- Construct the series: $$ \begin{aligned} y(x) &= y(0) + y'(0)x + \dfrac{y''(0)}{2!}x^2 + \dfrac{y'''(0)}{3!}x^3 + \dots \\ &= 1 + (-2)x + \dfrac{5}{2!}x^2 + \dfrac{-10}{3!}x^3 + \dots\\ &= 1 - 2x + \dfrac{5}{2}x^2 - \dfrac{5}{3}x^3 + \dots \end{aligned} $$
Skills to practice
- Finding Maclaurin Terms from a Differential Equation
- Comparing Approximate and Exact Solutions
III.2
Approximating Solutions with Euler's Method
When a differential equation cannot be solved analytically, we can approximate its solution using numerical methods. Euler's method is the simplest of these, using linear approximation to step along the solution curve.
The method begins with an initial condition \((x_0, y_0)\) and proceeds in steps. Let's define a small, constant step size, \(h\). The \(x\)-coordinate of each subsequent point is found by adding this step size: \(x_{n+1} = x_n + h\).
The core of the method is to approximate the derivative \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) using the gradient of the line segment connecting two consecutive points, \((x_n, y_n)\) and \((x_{n+1}, y_{n+1})\): $$ \dfrac{\mathrm{d}y}{\mathrm{d}x} \text{ at } (x_n, y_n) \approx \dfrac{y_{n+1} - y_n}{x_{n+1} - x_n} = \dfrac{y_{n+1} - y_n}{h}. $$ Since the differential equation gives us the exact value of the derivative, \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x_n, y_n)\), we can set these equal: $$ \dfrac{y_{n+1} - y_n}{h}\approx f(x_n, y_n). $$ Rearranging this formula to find the next \(y\)-value, \(y_{n+1}\), gives the iterative step: $$ y_{n+1} \approx y_n + h \cdot f(x_n, y_n). $$ The collection of line segments created by this iterative procedure forms a polygonal approximation to the true solution curve. 
The method begins with an initial condition \((x_0, y_0)\) and proceeds in steps. Let's define a small, constant step size, \(h\). The \(x\)-coordinate of each subsequent point is found by adding this step size: \(x_{n+1} = x_n + h\).
The core of the method is to approximate the derivative \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) using the gradient of the line segment connecting two consecutive points, \((x_n, y_n)\) and \((x_{n+1}, y_{n+1})\): $$ \dfrac{\mathrm{d}y}{\mathrm{d}x} \text{ at } (x_n, y_n) \approx \dfrac{y_{n+1} - y_n}{x_{n+1} - x_n} = \dfrac{y_{n+1} - y_n}{h}. $$ Since the differential equation gives us the exact value of the derivative, \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x_n, y_n)\), we can set these equal: $$ \dfrac{y_{n+1} - y_n}{h}\approx f(x_n, y_n). $$ Rearranging this formula to find the next \(y\)-value, \(y_{n+1}\), gives the iterative step: $$ y_{n+1} \approx y_n + h \cdot f(x_n, y_n). $$ The collection of line segments created by this iterative procedure forms a polygonal approximation to the true solution curve.

Method — Euler's Method
To approximate the solution to \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x,y)\) with initial condition \((x_0, y_0)\) and a step size \(h\), the coordinates of the next point \((x_{n+1}, y_{n+1})\) are found from the previous point \((x_n, y_n)\) using the iterative formulas: $$ \begin{cases} x_{n+1} = x_n + h, \\
y_{n+1} = y_n + h \cdot f(x_n, y_n). \end{cases} $$ Proposition — Accuracy and Error
Euler's method is an approximation. The accuracy of this approximation depends on two main factors: - Step size (\(h\)): A smaller step size \(h\) generally leads to a more accurate approximation. As \(h \to 0\), the polygonal path of the approximation gets closer to the true solution curve. However, this comes at the cost of requiring more computational steps.
- Concavity of the solution curve: Each step follows the tangent line at its starting point, so the concavity of the solution curve through that point decides the direction of the error of the step. When the solutions keep a fixed concavity on the interval considered and the step \(h\) is small enough, the accumulated error keeps this direction, and the concavity determines whether the approximation is an overestimate or an underestimate.
- If the curve is concave up (\(\frac{d^2y}{\mathrm{d}x^2} > 0\)), the tangent line at the start of each step lies below the curve. With a small enough step, Euler's method produces an underestimate.

- If the curve is concave down (\(\frac{d^2y}{\mathrm{d}x^2} < 0\)), the tangent line lies above the curve: with a small enough step, the result is an overestimate.

- If the curve is concave up (\(\frac{d^2y}{\mathrm{d}x^2} > 0\)), the tangent line at the start of each step lies below the curve. With a small enough step, Euler's method produces an underestimate.
Example
Consider the differential equation \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -2xy\) with the initial condition \(y(0)=1\). - Use Euler's method with a step size of \(h=0.1\) to find an approximate value for \(y(0.2)\).
- By solving the differential equation, show that the particular solution is \(y(x) = e^{-x^2}\).
- Calculate the percentage error in your approximation from part 1.
- By considering the sign of \(\dfrac{d^2y}{\mathrm{d}x^2}\) in the interval \(0 \le x \le 0.2\), explain whether your approximation in part 1 is an overestimate or an underestimate of the true value.
- We start at \((x_0, y_0)=(0,1)\) with \(h=0.1\) and \(f(x,y)=-2xy\).
- Step 1: \(y_1 = y_0 + h \cdot (-2x_0y_0) = 1 + 0.1(-2\cdot 0 \cdot 1) = 1\). So, \(y(0.1) \approx 1\).
- Step 2: \(y_2 = y_1 + h \cdot (-2x_1y_1) = 1 + 0.1(-2\cdot 0.1 \cdot 1) = 1 - 0.02 = 0.98\).
- We solve by separating variables: $$ \frac{\mathrm{d}y}{\mathrm{d}x} = -2xy \implies \int \frac{1}{y} \, \mathrm{d}y = \int -2x \, \mathrm{d}x. $$ Thus $$ \ln|y| = -x^2 + C. $$ Using the initial condition \(y(0)=1\): $$ \ln|1| = -0^2 + C \implies C=0. $$ So, \(\ln y = -x^2\) (since \(y(0)=1>0\)), which gives the particular solution \(y(x) = e^{-x^2}\).
- The exact value is \(y_{\text{exact}} = e^{-(0.2)^2} = e^{-0.04} \approx 0.960789\ldots\) The approximate value is \(y_{\text{approx}} = 0.98\). The percentage error is $$ \text{Error} = \left|\frac{0.960789\ldots - 0.98}{0.960789\ldots}\right| \times 100\pourcent \approx 2.00\pourcent. $$
- To determine the nature of the error, we check the concavity by finding the second derivative: $$ \begin{aligned} \frac{d^2y}{\mathrm{d}x^2} &= \frac{d}{\mathrm{d}x}(-2xy) \\ &= -2\left(1 \cdot y + x \cdot \frac{\mathrm{d}y}{\mathrm{d}x}\right) \\ &= -2\bigl(y + x(-2xy)\bigr) \\ &= -2y(1-2x^2). \end{aligned} $$ At the start of the approximation, for \(x\) in \([0, 0.2]\), \(x^2\) is small, so \((1-2x^2)\) is positive. Since \(y\) is also positive in this region, the sign of the second derivative is $$ \frac{d^2y}{\mathrm{d}x^2} = (\text{negative})\times(\text{positive})\times(\text{positive}) < 0. $$ Since the second derivative is negative, the solution curve is concave down. Each step of Euler's method follows a tangent line, which lies above a concave down curve, so each step lands above the solution curve through its starting point. The step \(h = 0.1\) is small, so by the Proposition « Accuracy and Error » the errors keep this direction: the approximation is an overestimate (indeed \(0.98 > 0.9608\)).
Method — Euler's Method with Technology
Euler's method repeats the same two updates. A smaller step \(h\) generally gives a better approximation but needs more steps, and each step starts from the full value produced by the previous one. A spreadsheet or a graphing calculator performs the repetition and keeps every digit. - Set up the scheme on paper: the starting point \((x_0, y_0)\), the step \(h\), the number of steps \(n = \dfrac{b - x_0}{h}\) needed to reach \(x = b\) (\(h\) is chosen so that \(n\) is a whole number), and the formulas \(x_{k+1} = x_k + h\), \(y_{k+1} = y_k + h \cdot f(x_k, y_k)\).
- With a spreadsheet: one row per step. The first row holds \(k = 0\), \(x_0\) and \(y_0\). In the next row, \(x\) is the previous \(x\) plus \(h\), and \(y\) is the previous \(y\) plus \(h\) times \(f\) evaluated with the previous \(x\) and \(y\). These two formulas are filled down until \(x = b\).
- With a graphing calculator: store \(x_0\) in \(X\) and \(y_0\) in \(Y\), then type the double command \(Y + h \cdot f(X, Y) \to Y : X + h \to X\). Each press of the execution key performs one step and displays the new value of \(X\). The value of \(Y\) is updated first, while \(X\) still holds the previous value.
- Report the last value of \(y\) to the accuracy asked, rounding only at the end. Written work shows the formulas and the first rows of the table, then the final value.
| A | B | C | |
| 1 | \(k\) | \(x\) | \(y\) |
| 2 | 0 | 0 | 1 |
| 3 | =A2+1 | =B2+0.1 | =C2+0.1*(B2-C2\^{}2) |
| 4 | 2 | 0.2 | 0.829 |
| \(\vdots\) | \(\vdots\) | \(\vdots\) | \(\vdots\) |
| 12 | 10 | 1 | 0.8053535 |
Example
The differential equation \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x - y^2\), with \(y(0) = 1\), cannot be solved by the methods of this chapter. - Use Euler's method with \(h = 0.1\) to estimate \(y(1)\), writing the first two steps and the number of steps.
- Use Euler's method with \(h = 0.05\) to estimate \(y(1)\).
- Explain which estimate is the more reliable.
- Here \(f(x, y) = x - y^2\), \(x_0 = 0\), \(y_0 = 1\), and \(n = \dfrac{1 - 0}{0.1} = 10\) steps reach \(x = 1\). The first two steps are $$\begin{aligned}[t] y_1 &= y_0 + h\,(x_0 - y_0^2) = 1 + 0.1\,(0 - 1) = 0.9, \\
y_2 &= y_1 + h\,(x_1 - y_1^2) = 0.9 + 0.1\,(0.1 - 0.81) = 0.829. \end{aligned}$$ The spreadsheet (or the calculator) continues to \(k = 10\):
so \(y(1) \approx 0.8054\).\(k\) \(0\) \(1\) \(2\) \(3\) \(\cdots\) \(10\) \(x_k\) \(0\) \(0.1\) \(0.2\) \(0.3\) \(\cdots\) \(1\) \(y_k\) \(1\) \(0.9\) \(0.829\) \(0.780276\) \(\cdots\) \(0.805354\) - With \(h = 0.05\), \(n = \dfrac{1}{0.05} = 20\) steps: the same formulas, with \(0.05\) in place of \(0.1\), give \(y(1) \approx 0.8198\).
- By the Proposition « Accuracy and Error », a smaller step \(h\) generally gives a more accurate approximation: the estimate \(0.8198\), with \(h = 0.05\), is the more reliable. The two estimates differ by about \(0.014\): they do not agree to two decimal places, so the estimate with \(h = 0.1\) cannot be trusted to that accuracy.
Skills to practice
- Applying Euler's Method
- Applying Euler's Method with Technology
- Comparing Numerical and Analytical Solutions
IV
Going further
Skills to practice
- Solving Problems without Technology
- Solving Problems with Technology
- Quiz
Jump to section