# MST210/Unit 1/Book A/First-Order Differential Equations

# Book A

## Unit 1: First- and Second-Order Differential Equations

### First-order Differential Equations

This section looks at finding *analytical* solutions to *first-order differential* equations. These are solutions expressed in terms of exact formulas in the cases:

- \(\frac{dy}{dx} = f(x)\), which can be solved by
*direct integration*, - \(\frac{dy}{dx} = g(x)h(x)\), which can be solved by
*separation of variables*, and - \(\frac{dy}{dx} + g(x)y = h(x)\), which can be solved by finding an
*integrating factor*.

The analytical approach is in contrast to the *numerical methods* approach.

#### Example: Population Size over Time

In this example, we are interested in measuring how the size of a population varies over time. Even though populations are discrete, differentiation - a process for *continuous* functions on \(\mathbb{R}\) - can still be applied, as changes by one or two units is relatively small. Our task is to show how \(P(t)\) - the population size as a function of time - may be described by a differential equation.

The population size will vary based on two factors (in our simplified model):

- \(b\): people
*joining*, measured as a proportionate birth rate, and - \(c\): people
*leaving*, measured as a proportionate death rate.

These rates are proportionate to the size of the population.

In a short interval of time, \(\delta t\), we would expect the number of births to be measured as \(b P(T) t\). That is, the amount of births as proportion of the population size, over a period of time. Likewise for deaths.

We seek a way to express a relationship between these numbers, so we can apply the *input-output principle*, which states:

\[\text{Accumulation} = \text{Input} - \text{Output}\]

The accumulation \(\delta P\) of a population over time \(\delta t\) is the final population less the initial population:

\[\delta P = P(t + \delta t) - P(t)\]

The input-output principle allows us to express the accumulation \(\delta P\) over time \(\delta t\) as:

\[\begin{array}{lcl} \delta P &=& b P(t) \delta t - c P(t) \delta t \\ &=& (b - c) P(t) \delta t \end{array}\]

So, \(\frac{\delta P}{\delta t} = (b - c) P(t)\), and therefore \(\frac{dP}{dt} = (b - c) P(t)\).

We can simplify this equation by using the *proportionate growth rate* \(r = b - c\), If \(r\) is constant, then \(\frac{dP}{dt} = rP\) leads to exponential growth (\(r > 0\)) or decay (\(r < 0\)). In reality, neither exponential growth nor decay can be sustained, so the population growth rate often varies. It is usually the case that we model this change as being dependent on the population size - so \(r\) itself is a function of the population size.

One useful model here is, \(r(P) = k(1 - \frac{P}{M})\), with \(k, M > 0\) This leads to a linear change in \(r\) from \(k\) to \(0\) as \(P\) approaches \(M\). Thus the differential equation for population change becomes:

\[\frac{dP}{dt} = kP(1 - \frac{P}{M})\]

This equation is known as the *logistic equation*.

- Exercise 1
We have \(k( 1 - \frac{10}{M}) = 1\) and \(k(1 - \frac{10000}{M}) = 0\). By the latter equation, we know \(M = 10000\) (as \(k > 0\)). Substituting this into the first equation, we have \(\frac{1}{k} = 1 - \frac{10}{10000}\) and thus \(k = \frac{1000}{999}\).

#### Solutions of Differential Equations

In the expression \(\frac{dy}{dx}\), we say that \(y\) is the *dependent variable* and \(x\) is the *independent variable*. A *differential equation* is an equation that relates the independent variable, the dependent variable, and one or more derivatives of the dependent variable. The *solution* to a differential equation is a function \(y = y(x)\) that *satisfies* the differential equation. The differential equation is satisfied by the function when the function is substituted into the equation, the left- and right-hand sides of the equation give identical expressions.

- Exercise 2 (a)
\[\begin{array}{lcl} \frac{d}{dx} 2e^x - (x^2 + 2x + 2) & = & 2e^x - (2x + 2) \\ &=& 2e^x - (x^2 + 2x + 2) + x^2 \end{array}\]

So the given function satisfies this equation.

- Exercise 2 (b)
\[\begin{array}{lcl} \frac{dy}{dx} &=& \frac{d tan(x) + sec(x)}{dx} \\ &=& sec(x)(tan(x) + sec(x)) \end{array}\]

and

\[\begin{array}{lcl} y tan(x) + 1 &=& (tan(x) + sec(x))(tan(x)) + 1 \\ &=& sec(x)(tan(x) + sec(x)) \end{array}\]

so the given function satisfies the equation.

- Exercise 2 (c)
\[\begin{array}{lcl} \frac{dy}{dx} &=& \frac{d}{dx} (t + Ce^{-t}) \\ &=& 1 - C e^{-t} \end{array}\]

and

\[\begin{array}{lcl} -y + t + 1 &=& -(t + C e^{-t}) + t + 1 \\ &=& -t - C e^{-t} + t + 1 \\ &=& 1 - C e^{-t} \end{array}\]

so the given function satisfies the equation.

We notice that in the answer to 2c, there is a constant \(C\) appearing in the solution to the differential equation. Thus there are *multiple* possible solutions - one for each choice of \(C\). The *general solution* to a differential equation is the family of all possible solutions, whereas a *particular solution* is a single solution in this family.

- Exercise 3 (a)
\[\frac{dy}{dx} = \frac{d}{dx} (C - \frac{1}{3}e^{-3x}) = e^{-3x}\]

- Exercise 3 (b)
We have \(\frac{d}{dt}CMe^{kt} = CMke^{kt}\) and \(\frac{d}{dt} (1 + Ce^{kt}) = Cke^{kt}\).

Therefore,

\[\begin{array}{lcl} \frac{dP}{dt} &=& \frac{ (CMke^{kt})(1 + Ce^{kt}) - (CMe^{kt})(Cke^{kt})}{(1 + Ce^{kt})^2} \\ &=& k \frac{CMe^{kt}}{1 + Ce^{kt}} \frac{1 + Ce^{kt} - Ce^{kt}}{1 + Ce^{kt}} \\ &=& k P (1 - \frac{P}{M}) \end{array}\]

as required.

Even though there are often many possible solutions, we are usually interested in one specific particular solution. One way to specify the extra information needed to obtain this particular solution is by specifying an *initial condition*.

An initial condition associated with a differential equation specifies that the dependent variable \(y\) takes some value \(y_0\) when the independent variable \(x\) takes some value \(x_0\). We write this as:

\[y = y_0 \text{ when } x = x_0\]

or,

\[y(x_0) = y_0\]

We call \(x_0\) and \(y_0\) *initial values*. The combination of a first-order differential equation and an initial condition is called an *initial-value problem*. It is usally required that an initial-value problem has a *unique* solution.

- Exercise 4a
In Exercise 2b, we saw the general solution

\[P = \frac{CMe^{kt}}{1 + Ce^{kt}}\]

The initial condition states \(P(0) = 1\), so substituting this into the general solution, we have

\[\begin{array}{rcl} 1 &=& \frac{10C}{1 + C} \\ 1 + C &=& 10C \\ \frac{1}{C} &=& 9\\ \frac{1}{9} &=& C \end{array}\]

Hence \(C = \frac{1}{9}\) and the particular solution of the differential equation solves the initial value problem is

\[\begin{array}{lcl} P &=& \frac{\frac{10}{9} e^{0.15t}}{1 + \frac{1}{9}e^{0.15t}} \\ &=& \frac{10e^{0.15t}}{9 + e^{0.15t}} \end{array}\]

- Exercise 4b
We take the limit of the general solution as \(t\) approaches \(\infty\). Dividing the numerator and denomanitor by the dominant term \(e^{0.15t}\), we have

\[P = \frac{10}{9e^{-0.15t} + 1}\]

\(\lim_{t \to \infty} e^{-0.15t} = 0\), it follows that the long behaviour of the population size will settle to 10.

#### Direct Integration

Equations of the form

\[\frac{dy}{dx} = f(x)\]

can be solved by taking the indefinite integral of *both sides* of the equation.

- Exercise 5a
On applying direct integration, we obtain the general solution

\[\begin{array}{rcl} y &=& \int 6x dx \\ &=& 3x^2 + C \end{array}\]

In order to satisfy the initial condition, \(y(1) = 5\), we must have

\[5 = 3 \cdot 1^2 + C\]

Therefore, \(C = 2\), and the particular solution is

\[y = 3x^2 + 2\]

- Exercise 5b
On applying direct integration, we obtain the general solution

\[\begin{array}{rcl} v &=& \int e^{4u} du \\ &=& \frac{1}{4}e^{4u} + C \end{array}\]

In order to satisfy the initial condition \(v(0) = 2\), we must have

\[2 = \frac{1}{4} + C\]

Therefore, \(C = \frac{7}{4}\), and the particular solution is

\[v = \frac{1}{4}e^{4u} + \frac{7}{4}\]

- Exercise 5c
On applying direct integration, we obtain the general solution

\[\begin{array}{rcl} y &=& \int \frac{t}{1 + t^2} dt \end{array}\]

This integral can be solved by taking the substitution \(u = 1 + t^2\).

We have \(\frac{du}{dt} = 2t\), so \(du = 2t dt\). Therefore,

\[\begin{array}{rcl} y &=& \int \frac{t}{1 + t^2} dt \\ &=& \frac{1}{2} \int \frac{1}{u} du \\ &=& \frac{1}{2} \ln u + C \\ &=& \frac{\ln (1 + t^2)}{2} + C \end{array}\]

In order to satisfy the initial condition \(y(0) = 2\), we must have

\[2 = \frac{\ln 1}{2} + C = C\]

Thus, the particular solution is

\[y = \frac{\ln (1 + t^2)}{2} + 2\]

The answer to exercise 5c points to a generalisation. Any differential equation of the form

\[\frac{dy}{dx} = k \frac{f'(x)}{f(x)} (f(x) \neq 0)\]

where \(k\) is a constant, can be integrated to give the general solution

\[y = k \ln | f(x) | + C\]

- Exercise 6a
We notice that this is of the form \(\frac{dy}{du} = k \frac{f'(u)}{f(u)}\), with \(f(u) = u - a\), \(f'(u) = 1\), \(k = 1\). Therefore the general solution is

\[y = \ln | u - a | + C\]

- Exercise 6b
First, we follow the hint and note that:

\[\frac{1}{x} + \frac{a}{1 - ax} = \frac{1 - ax + ax}{x(a-x)} = \frac{1}{1 - ax}\]

Next, we note that \(\frac{a}{1 - ax}\) is of the form \(x \frac{f'(x)}{f(x)}\), with \(f(x) = 1 - ax\), \(f'(x) = -a\), \(k = -1\). Therefore, by the sum rule for integrals, the general solution is

\[\begin{array}{rcl} y &=& \ln |x| - \ln |1 - ax| + C \\ &=& ln | \frac{x}{1 - ax} | + C \end{array}\]

#### Separation of Variables

Equations of the form

\[\frac{dy}{dx} = g(x)h(y)\]

can be solved by dividing both sides by \(h(y)\) to give

\[\frac{1}{h(y)}\frac{dy}{dx} = g(x)\]

at which point indefinite integrals of both sides can be taken. Finally, the result - an *implicit* general solution - is rearranged to obtain an *explicit* general solution in the form \(y = f(x)\).

- Exercise 7a
This is an equation of the form \(\frac{dm}{dt} = g(t)h(m)\), where \(g(t) = -\lambda\) and \(h(m) = m\). We follow the process of separation of variables, so

\[\frac{1}{m} \frac{dm}{dt} = - \lambda\]

Taking indefinite integrals with respect to \(t\), we have the implicit general solution

\[\begin{array}{rcll} \int \frac{1}{m} dm &=& \int - \lambda dt & \\ \ln m &=& -\lambda t + C & (m > 0) \end{array}\]

Rearranging this result, the explicit general solution is

\[m = e^{-\lambda t + C} = Be^{-\lambda t}\]

where \(B = e^C\) is a positive but otherwise arbitrary constant.

- Exercise 7b
In order to satisfy the initial condition \(m(0) = m_0\), we must have \(m_0 = B\).

Thus the particular solution that satisfies the initial condition is

\[m = m_0 e^{-\lambda t}\]

- Exercise 8a
This is an equation of the \(\frac{dy}{dx} = g(x)h(y)\) with \(g(x) = \frac{1}{x} (x > 0)\) and \(h(y) = y - 1\). We follow the process of separation of variables, so

\[\frac{1}{y - 1} \frac{dy}{dx} = \frac{1}{x}\]

This excludes the case that \(y = 1\).

Taking indefinite integrals with respect to \(x\), we have the implicit general solution

\[\begin{array}{rcll} \int \frac{1}{y - 1} dy &=& \int \frac{1}{x} dx \\ \ln |y - 1| &=& \ln |x| + C \\ \ln |y - 1| &=& \ln x + C && x > 0 \end{array}\]

This can be re-arranged into the explicit general solution, as

\[\begin{array}{lcl} |y - 1| &=& e^{\ln x + C} \\ &=& e^{\ln x} e^C \\ &=& x e^C \\ &=& Bx \end{array}\]

where \(B\) is positive arbitrary constant. Now \(y - 1 > 0\) for \(y > 1\) and \(y - 1 < 0\) for \(y < 1\). Therefore, we have

\[y = 1 + Ax\]

where the change in sign has been absorbed into the constant \(A\) - an arbitrary non-zero constant.

Finally, if \(y = 1\), we have \(\frac{dy}{dx} = 0\), and \(y = 1 + Ax\) satisfies this equation with \(A = 0\).

Therefore, the general solution is \(y = 1 + Ax\).

- Exercise 8b
This is an equation of the form \(\frac{dy}{dx} = g(x)h(y)\) with \(g(x) = \frac{1}{x^2 + 1}\), \(h(y) = 2y\). Following the process of separation of variables, we have

\[\frac{1}{2y} \frac{dy}{dx} = \frac{1}{x^2 + 1}\]

excluding \(y = 0\). Taking indefinite integrals, we have the implicit general solution

\[\begin{array}{rcl} \int \frac{1}{2y} \frac{dy}{dx} &=& \int \frac{1}{x^2 + 1} dx \\ \frac{1}{2} \ln |y| &=& \tan ^{-1}(x) + C \\ \ln|y| &=& 2\tan ^{-1} (x) + D \\ y &=& Be^{2\tan ^{-1} (x)} \end{array}\]

where \(B\) is a non-zero but otherwise arbitrary constant.

When \(B = 0\), we have \(y = 0\). This is the constant function, and also satisfies the differential equation.

Thus the general solution is \(y = Be^{2 \tan^{-1} (x)}\).

- Exercise 9a
We begin by following the hint, allowing us to separate the variables

\[\begin{array}{rcl} \frac{dP}{dt} &=& kP(1 - \frac{P}{M}) \\ \frac{1}{P(1 - \frac{1}{M}P)} \frac{dP}{dt} &=& k \\ (\frac{1}{P} + \frac{\frac{1}{M}}{1 - \frac{1}{M}P}) \frac{dP}{dt} &=& k \\ \end{array}\]

This excludes the case where \(P = \frac{1}{M}\). Taking indefinite integrals, and the result of exercise 6b, we have the general implicit solution

\[\begin{array}{rcl} \int \frac{1}{P} + \frac{\frac{1}{M}}{1 - \frac{1}{M}P} dP &=& \int k dt \\ \ln | \frac{P}{1 - \frac{1}{M}P} | &=& kt + C \\ \ln | \frac{1}{P} - \frac{1}{M} | &=& -kt + C \\ \frac{1}{P} - \frac{1}{M} &=& Be^{-kt} \end{array}\]

where \(B\) is a non-zero but otherwise arbitrary constant. Rearranging this, we have the general explicit solution

\[P = \frac{1}{\frac{1}{M} + Be^{-kt}}\]

To satisfy the initial condition \(P(0) = P_0\), we must have

\[P_0 = \frac{1}{\frac{1}{M} + B}\]

That is, \(B = \frac{1}{P_0} - \frac{1}{M}\). Therefore, the particular solution to the initial value problem is

\[\begin{array}{lcl} P &=& \frac{1}{ \frac{1}{M} + (\frac{1}{P_0} - \frac{1}{M})e^{-kt} } \\ &=& \frac{M}{M (\frac{1}{M} + (\frac{1}{P_0} - \frac{1}{M})e^{-kt})} \\ &=& \frac{M}{1 + M(\frac{1}{P_0} - \frac{1}{M})e^{-kt}} \\ &=& \frac{M}{1 + (\frac{M}{P_0} - 1)e^{-kt}} \\ \end{array}\]

- Exercise 9b
To find out what happens to \(P(t)\) as \(t\) becomes large, we take the limit of \(P\) as \(t \to \infty\). In this case, \(-kt\) tends to \(-\infty\), and so \(e^{-kt}\) tends to 0. Thus

\[\lim_{t \to \infty} P = M\]

#### Linear First-Order Differential Equations

This section presents an analytical solution to *linear* first-order differential equations. A first order differential equation for \(y = y(x)\) is linear if it can be expressed in the form

\[\frac{dy}{dx} + g(x)y = h(x)\]

A linear first-order differential equation is said to *homogeneous* if \(\forall x. h(x) = 0\), and *inhomogeneous* otherwise.

Crucially, the linear property can be seen easily be looking at the expression involving the variable \(y\) - this expression can only include \(y\), but not \(y^2\), etc.

- Exercise 10
- This equation is linear, with \(g(x) = 0\), \(h(x) = x \sin x\).
- This equation is
*not*linear, due to the presence of the non-linear term \(y^2\). - This equation is
*not*linear, again due to the presence of the non-linear term \(y^2\). - We have

\[\begin{array}{rcl} (1 + x^2) \frac{dy}{dx} + 2xy &=& 3x^2 \\ \frac{dy}{dx} + \frac{2x}{1 + x^2} y &=& \frac{3x^2}{1 + x^2} \end{array}\]

Thus this is a linear equation, with \(g(x) = \frac{2x}{1 + x^2}\) and \(h(x) = \frac{3x^2}{1 + x^2}\).

**Theorem 1**If the functions \(g(x)\) and \(h(x)\) are continuous througout an interval \((a, b)\), and \(x \in (a, b)\), then the initial value problem

\[\frac{dy}{dx} + g(x) y = h(x)\]

has a unique solution throughout the interval.

#### Integrating Factor Method

##### Worked Example

We begin by considering the linear first-order differential equation shown in exercise 10d:

\[(1 + x^2) \frac{dy}{dx} + 2xy = 3x^2\]

We notice that \(\frac{d}{dx} (1 + x^2) = 2x\), and we can use the product rule to rewrite this equation. To recap, the product rule for differentiation states

`$$\frac{d}{dx} (h(x)g(x)) = h(x)g'(x) + h'(x)g(x)$$`

So we have

\[\frac{d}{dx} (1+x^2)y = (1 + x^2)\frac{dy}{dx} + 2xy\]

allowing us to rewrite the initial equation as

\[\frac{d}{dx} (1+x^2)y = 3x^2\]

This allows us to easily apply direct integration to reach the implicit general solution

\[(1 + x^2) y = \int 3x^2 dx = x^3 + C\]

which can now trivially be re-arranged to reach the explicit general solution

\[y = \frac{x^3 + C}{1 + x^2}\]

##### Process

Solving first-order linear differential equations by integrating factor requires us to perform a little rewriting in order to make direct integration applicable. Recall that a first-order linear differential equation has the form

\[\frac{dy}{dx} + g(x)y = h(x)\]

However, above we needed the left-hand side of the equation to be in the form

\[p \frac{dy}{dx} + \frac{dp}{dx} y\]

We can rewrite the initial equation to the form of the latter by finding \(p\), the integrating factor. To find \(p\), we solve the differential equation \(\frac{dp}{dx} = g(x)p\) by separation of variables,

\[p = \exp ( \int g(x) dx )\]

The process for obtaining solutions to differential equations of the form

\[\frac{dy}{dx} + g(x) y = h(x)\]

with the integrating factor method is:

Determine the integrating factor

\[p(x) = \exp ( \int g(x) dx )\]

Multiply the original equation by \(p(x)\)

Rewrite the differential equation as

\[\frac{d}{dx} (p(x) y) = p(x)h(x)\]

Integrate this equation to obtain

\[p(x) y = \int p(x) h(x) dx\]

Divide through by \(p(x)\) to rearrange the equation into an explicit general solution.

- Exercise 11a
We are to solve \[\frac{dy}{dx} - y = e^x \sin x\].

This is a linear differential equation of the form \[\frac{dy}{dx} + g(x)y = h(x)\]

with \(g(x) = -1\) and \(h(x) = e^x \sin x\). We begin by finding the integrating factor

\[p(x) = \exp (\int -1 dx) = e^{-x}\]

Multiplying the original equation by \(p(x)\), we have

\[e^{-x} \frac{dy}{dx} - e^{-x} y = \sin x\]

And so

\[\frac{d}{dx} (e^{-x}y) = \sin x\].

Applying direct integration, we have

\[e^{-x} y = - \cos x + C\]

Thus the explicit general solution is

\[y = - \frac{\cos x + C}{e^{-x}} = e^x(C - \cos x)\]

- Exercise 11b
We are to solve \[\frac{dy}{dx} = \frac{y - 1}{x} (x > 0)\].

With a little rearranging, we have

\[\frac{dy}{dx} - \frac{y}{x} = - \frac{1}{x}\]

This is a differential equation of the form \[\frac{dy}{dx} + g(x)y = h(x)\] with \(g(x) = -\frac{1}{x}\) and \(h(x) = -\frac{1}{x}\).

We follow the process of solving by an finding an integrating factor:

\[\begin{array}{lcl} p(x) &=& \exp (- \int \frac{1}{x} dx)\\ &=& \frac{1}{x} \end{array}\]

Multiplying the original equation by \(p(x)\) we have

\[\frac{1}{x}\frac{dy}{dx} - \frac{y}{x^2} = \frac{-1}{x}\]

That is,

\[\frac{d}{dx} (\frac{y}{x}) = -1\]

Applying direct integration, we have

\[\frac{y}{x} = \int \frac{-1}{x^2} dx = \frac{1}{x} + C\]

Thus the explicit general solution is

\[y = -1 + Cx\]

#### Direction Fields and Euler’s Method

In this section we look at a solution that is a *numerical* rather than analytical method. To begin with, we look at *direction fields*, which will allow us to obtain *qualitative* information about the graphs of solutions without needing to do any integration, and this will provide us with a suitable starting point for *Euler’s method*.

The obversation stems from the intuition that the equation

\[\frac{dy}{dx} = f(x,y)\]

describes the *direction* in which the graph of the particular solution through the point \((x, y)\) is heading. A direction field associates a unique direction to each point within a specific region of the \((x, y)\)-plane.

Understanding that the direction field assigns a direction on a solution to every \((x, y)\) pair, we can begin to find the solution to an initial value problem. To do so, we begin at the point corresponding to the initial values \(x\) and \(y\), and we move from \((x_0, y_0)\) to \((x_0 + h, y_0 + h f (x_0, y_0))\). The small distance \(h\) is the *step size*. Thus by repeatedly finding approximations, we can reach a series of values that approximate points on the particular solution to the initial value problem. This process is known as *Euler’s method*.

- Euler’s method
To apply Euler’s method to the initial value problem

\[\frac{dy}{dx} = f(x, y), y(x_0) = y_0\]

Take \(x_0\) and \(Y_0\) as starting values, choose a step size \(h\) and set \(i = 0\)

Calculate the \(x\)-coordinate \(x_{i+1}\) as \[x_{i+1} = x_i + h\]

Calculate a corresponding

*approximation*\(Y_{i+1}\) using the formula \[Y_{i+1} = Y_i + h f (x_i, Y_i)\]If further approximations are required, increase \(i\) and repeat.

- Exercise 13
From the problem, we have \(x_0 = 0\), \(Y_0 = y_0 = 1\) and \(h = 0.2\). Taking a single step via Euler’s method, we have

\[x_1 = x_0 + h = 0.2\]

and

\[Y_1 = Y_0 + hf(x_0, Y_0) = 1 + 0.2 * Y_0 = 1.2\]

For the second step, we have

\[x_2 = x_1 + h = 0.4\]

and

\[Y_2 = Y_1 + 0.2 Y_1 = 1.44\]

Repeating the process and tabulating the results, we have

\(i\) \(x_i\) \(y_i\) 0 0 1 1 0.2 1.2 2 0.4 1.44 3 0.6 1.728 4 0.8 2.0736 5 1.0 2.48832 Therefore, at \(x = 1\), using a step size of \(h = 0.2\), Euler’s method yields the approximation \(y(1) \approx 2.248832\).

We briefly reflect on the accuracy of this method, comparing it against the closed-form of the exact solution. In turns out that the *absolute error* is proportional to the step size. We can reach better and better approximations to the solution, by taking smaller step sizes. As \(h\) approaches 0, so does the absolute error.

- Exercise 14
From the last row of Table 2, we have

\[0.000136 = 0.0001k\]

where \(k\) is the constant of proportionality. Thus \(k = \frac{0.000136}{0.0001} = 1.36\).

Now \(kg = 5 \times 10^-6\) when \(g = 3.67647 \times 10^{-6}\), so the absolute error approximating \(y(1)\) is correct to 5 decimal places when the step size \(h < 3.67647 \times^{-6} \approx 3.7 \times 10^{-6}\). Hence a suitable step size would be \(10^{-6}\).

We conclude our exposure to Euler’s method by understanding that high accuracy comes with a significant *cost*. Here, cost is interpreted to mean the computational cost to reach a sufficiently accurate answer. While the absolute error is proportional to step the step size, so is the amount of steps required to take until an approximation is reached.

- Exercise 15
- As \(x\) increases to \(\pm \infty\) this term dominates \(y\), and so the gradient of the solution increases as the graph extends along the x-axis.

At \(x = 0\), the gradient is the same as the value of the solution.

At \(y = -x^2\), the gradient of the solution is 0.

- For solutions that cut the y-axis above the origin, their slope is positive at all points.

- For solutions that cut the y-axis at the origin, their slope is 0 only at that point, but positive otherwise.

- \[x_{i+1} = x_i + 0.1 \text{where} x_0 = -1\]

\[y_{i+1} = y_i + 0.1 (y_i + x^2) \text{where} y_0 = -0.2\]