Title: Default for 19.1 Modelling with Differential Equations
Course: HELM Workbooks 2023-2024

Case study: Newton’s law of cooling

When a hot liquid is placed in a cooler environment, experimental observation shows that its temperature decreases to approximately that of its surroundings. A typical graph of the temperature of the liquid plotted against time is shown below.

[Image: plot of temperature against time]

After an initially rapid decrease the temperature changes progressively less rapidly and eventually the curve appears to ‘flatten out’. Newton’s law of cooling states that the rate of cooling of liquid is proportional to the difference between its temperature and the temperature of its environment (the ambient temperature). To convert this into mathematics, let \(t\) be the time elapsed (in seconds, s), \(\theta\) the temperature of the liquid (\(^\circ\)C), and \(\theta_0\) the temperature of the liquid at the start \((t=0)\). The temperature of the surroundings is denoted by \(\theta_\text{s}\).

The general solution of a differential equation

Consider the equation \(y=A \text{e}^{2x}\) where \(A\) is an arbitrary constant. If we differentiate it we obtain \[ {dy\over dx}=2A\text{e}^{2x}\] and so, since \[y=A\text{e}^{2x}\] we obtain \[ {dy\over {dx}}=2y.\] Thus a differential equation satisfied by \(y\) is \[{dy\over dx}=2y.\] Note that we have eliminated the arbitrary constant.

Now consider the equation \[y=A\cos 3x+B\sin 3x\] where \(A\) and \(B\) are arbitrary constants. Differentiating, we obtain \[ {dy\over dx}=-3A\sin 3x+3B\cos 3x.\]

Differentiating a second time gives \[ {d^2y\over dx^2}=-9\,A\cos 3x-9\,B\sin 3x.\] The right-hand side is simply \((-9)\) times the expression for \(y\). Hence \(y\) satisfies the differential equation \[ {d^2y\over dx^2}=-9y.\]

Unique solutions

Consider the simple differential equation \[ {dy\over dx}=2x.\]

On integrating, we obtain the general solution \[ y=x^2+C\] where \(C\) is an arbitrary constant. As \(C\) varies we get different solutions, each of which belongs to the family of solutions. The figure below shows some examples.

[Image: plot of family of solutions]

It can be shown that no two members of this family of graphs ever meet and that through each point in the \(x\)-\(y\) plane passes one, and only one, of these graphs. Hence if we specify the boundary condition \(y=2\) when \(x=0\), written \(y(0)=2\), then using \(y=x^2+c\): \[ 2=0+C\quad \text{so that}\quad C=2\] and \(y=x^2+2\) is the unique solution.

Example

Solve the differential equation \(\displaystyle \frac{\mathrm{d}^2y}{\mathrm{d}x^2}=6x\) subject to the conditions:

1. \(y(0)=2\) and \(y(1)=3\)
2. \(y(0)=2\) and \(y(1)=5\)
3. \(y(0)=2\) and \(\dfrac{dy}{dx}=1\) at \(x=0\).

Solution

1. Integrating the differential equation once produces \[ {dy\over dx}=3x^2+A.\] The general solution is found by integrating a second time to give \(y=x^3+A\,x+B\), where \(A\) and \(B\) are arbitrary constants. Imposing the conditions \(y(0)=2\) and \(y(1)=3\): at \(x=0\) we have \(y=2=0+0+B=B\) so that \(B=2\), and at \(x=1\) we have \(y=3=1+A+B=1+A+2\). Therefore \(A=0\) and the solution is \[ y=x^3+2.\].
2. Here the second condition is \(y(1)=5\) so at \(x=1\) \[ y=5=1+A+2\qquad \text{so that}\quad A=2\] and the solution in this case is \[ y=x^3+2x+2.\]
3. Here the second condition is \[ {dy\over dx}=1\ \text{at}\ x=0\ \quad \text{i.e.}\quad \ y'(0)=1\] then since \(\dfrac{dy}{dx}=3x^2+A\), putting \(x=0\) we get: \[ {dy\over dx}=1=0+A\] so that \(A=1\) and the solution in this case is \[y=x^3+x+2\].

Classifying differential equations

When solving differential equations (either analytically or numerically) it is important to be able to recognise the various kinds that can arise. We therefore need to introduce some terminology which will help us to distinguish one kind of differential equation from another.

1. An ordinary differential equation (ODE) is any relation between a function of a single variable and its derivatives. (All differential equations studied in this workbook are ordinary.)
2. The order of a differential equation is the order of the highest derivative in the equation.
3. A differential equation is linear if the dependent variable and its derivatives occur to the first power only and if there are no products involving the dependent variable or its derivatives.

Example

Classify the differential equations specifying the order and type (linear/non-linear)

1. \(\displaystyle{{d^2y\over dx^2}-{dy\over dx}=x^2}\)
2. \(\displaystyle{{d^2x\over dt^2}=\left({dx\over dt}\right)^3+3x}\)
3. \(\displaystyle{{dx\over dt}-x=t^2}\)
4. \(\displaystyle{{dy\over dt}+\cos y=0}\)
5. \(\displaystyle{{dy\over dt}+y^2=4}\)

Solution

1. Second order, linear
2. Second order, non-linear (because of the cubic term).
3. First order, linear.
4. First order, non-linear (because of the \(\cos y\) term)
5. First order, non-linear (because of the \(y^2\) term).

Note that in (a) the independent variable is \(x\) whereas in the other cases it is \(t\). In (a), (d) and (e) the dependent variable is \(y\) and in (b) and (c) it is \(x\).

Q: Exercise

Which of the following mathematical equations is equivalent to Newton's Law of Cooling? First, find an expression for the rate of cooling, and an expression for the difference between the liquid's temperature and that of the environment. Note that \(k\) is a positive constant.
- \(\dfrac{\mathrm{d} \theta}{\mathrm{d}t} = -k(\theta - \theta_\text{s})\)
- \(\dfrac{\mathrm{d} \theta}{\mathrm{d}t} = k(\theta - \theta_\text{s})\)
- \(\dfrac{\mathrm{d} \theta}{\mathrm{d}t} = k(\theta_\text{s} - \theta)\)
- \(\dfrac{\mathrm{d} \theta}{\mathrm{d}t} = -k(\theta_\text{s} - \theta)\)
A: \(\dfrac{\mathrm{d} \theta}{\mathrm{d}t} = -k(\theta - \theta_\text{s})\)
Feedback: You should obtain \({\mathrm{d}\theta\over \mathrm{d}t}\propto (\theta-\theta_\text{s})\) or, equivalently: \({\mathrm{d}\theta\over \mathrm{d}t}=-k(\theta-\theta_\text{s})\). \(k\) is a positive constant of proportion and the negative sign is present because (\(\theta-\theta_\text{s}\)) is positive, whereas \({\mathrm{d}\theta\over \mathrm{d}t}\) must be negative, since \(\theta\) decreases with time. The units of \(k\) are s\(^{-1}\). The accompanying condition is \(\theta=\theta_0\) at \(t=0\) which simply states the temperature of the liquid when the cooling begins.

In the above question we call \(t\) the independent variable and \(\theta\) the dependent variable. Since the condition is given at \(t=0\) we refer to it as an initial condition. For future reference, the solution of the above differential equation which satisfies the initial condition is \(\theta=\theta_\text{s}+(\theta_0-\theta_\text{s})\text{e}^{-kt}\)

Q: Exercise

Which of the following differential equations is satisfied by \(y=A\cosh 2x+B\sinh 2x\) where \(A\) and \(B\) are arbitrary constants.
- \(\dfrac{d^2y}{dx^2} = 4y\)
- \(\dfrac{d^2y}{dx^2} = 3y\)
- \(\dfrac{d^2y}{dx^2} = 4y^2\)
- \(\dfrac{d^2y}{dx^2} = 2y\)
A: \(\dfrac{d^2y}{dx^2} = 4y\)
Feedback: We are given\(y=A\cosh 2x+B\sinh 2x\) where \(A\) and \(B\) are arbitrary constants. Differentiating once we obtain \[{dy\over dx}=2A\sinh 2x +2B\cosh 2x.\]Differentiating a second time we obtain \[{d^2y\over {dx^2}}=4A\cosh 2x +4B\sinh 2x.\] Hence \[ {d^2y\over {dx^2}}=4y\]

We have seen that an expression including one arbitrary constant required one differentiation to obtain a differential equation which eliminated the arbitrary constant. Where two constants were present, two differentiations were required. Is the converse true? For example, would a differential equation involving \(\dfrac{d^2y}{dx^2}\) as the only derivative have a general solution with one arbitrary constant and would a differential equation which had \(\dfrac{d^2y}{dx^2}\) as the highest derivative produce a general solution with two arbitrary constants? The answer is, usually, yes.

Exercise

Integrate twice the differential equation \[ \dfrac{d^2y}{dx^2}=\dfrac{1}{2}([value]x-[value]x^2),\]

to find a general solution for \(y.\)

\(y = \dfrac{1}{2} \Big( \) \(x^3 - \) \(x^4 \Big) + Ax +B ,\)

where \(A\) and \(B\) are arbitrary constants.
Feedback: We are given the differential equation \[ \dfrac{d^2y}{dx^2}=\dfrac{1}{2}([value]x-[value]x^2)\] Integrating once: \[ {dy\over dx}={1\over 2}\left({[value] x^2\over 2}-{[value]x^3\over 3}\right)+A\] where \(A\) is an arbitrary constant (of integration). Integrating again: \[ y={1\over 2}\left(\dfrac{[value]x^3}{6}-\dfrac{[value]x^4}{12}\right)+Ax+B \]where \(B\) is a second arbitrary constant.

Exercise

Find the unique solution of the differential equation \[\dfrac{dy}{dx}=[value]\] which satisfies the condition \(y(1)=[value]\).

\(y=\) \(x^3 + \)
Feedback: We are given the differential equation \[\dfrac{dy}{dx}=[value]\] which satisfies the condition \(y(1)=[value]\). By a single integration we have: \[y=[value]x^3+C,\] where \(C\) is an arbitrary constant. Now when \(x=1,\ y=[value]\) so that \([value]=[value]+C\). Hence \(C=[value]\) and the unique solution is: \[y=[value]x^3+[value]\]

Q: Exercise

 Classify the differential equation \[ \dfrac{d^2x}{ dt^2}+3 \dfrac{dx}{dt}=x.\]
- Second order, linear
- Second order, non-linear
- First order, linear
- First order, non-linear
A: Second order, linear
Feedback: The highest order of the derivatives is two and there is no non-linear term.

Q: Exercise

Classify the differential equation \[\dfrac{d^3y}{dx^3}=\left(\dfrac{dy}{dx}\right)^2+\dfrac{dy}{dx}.\]
- Third order, non-linear
- Second order, non-linear
- Third order, linear
- First order, non-linear
A: Third order, non-linear
Feedback: The highest derivative is of order three, and the squared term is non-linear.

(a) State the order of the following differential equation: \[ \left(\frac{d^2[value]}{dt^2}\right)^[value] + [value] [value] = 0 \]

(b) Is it an linear equation?
Feedback: (a) The order of a differential equation is the degree of the highest derivative that occurs in the equation. The order of the equation is not effected by any power to which the derivatives may be raised. In our case we have the equation \[ \left(\frac{d^2[value]}{dt^2}\right)^[value] + [value] [value] = 0 \] which is a second order differential equation. (b) In a linear differential equation the dependent variable and its derivatives do not occur as products, raised to powers or in nonlinear functions. So our differential equation is a non linear one since the second order derivative is raised on a power.

(a) State the order of the following differential equation: \[ e^{[value]'''}+t^[value] (\cos[value])^[value] = 0 \]

(b) Is it a linear equation?
Feedback: (a) The order of a differential equation is the degree of the highest derivative that occurs in the equation. The order of the equation is not effected by any power to which the derivatives may be raised. In our case we have the equation \[e^{[value]'''}+t^[value] (\cos[value])^[value] = 0\] which has order \(3\). (b) In a linear differential equation the dependent variable and its derivatives do not occur as products, raised to powers or in nonlinear functions. So, our differential equation is a non linear one since the depend variable is in nonlinear functions, \( e, \cos x \).

Decide whether or not the following differential equations are linear:

\[ \sin ([value]t) \frac{d[value]}{dt}+[value] = [value] t \]

\[ \sin ([value][value]) \frac{d[value]}{dt}+[value] = [value] t \]
Feedback: Linear equations are those in which the dependent variable, [value], and it's derivative does not occur as products, reaised to powers on in nonlinear functions. The equation \( \displaystyle \sin ([value]t) \frac{d[value]}{dt}+[value] = [value] t \) is [value]. The equation \( \displaystyle \sin ([value][value]) \frac{d[value]}{dt}+[value] = [value] t\) is [value]

Decide whether or not the following differential equations are linear:

\[ \frac{d^2[value]}{dt^2} = -[value] [value]^2 \]

\[ \frac{d[value]}{dt}+[value][value] = [value]t^3 \]
Feedback: Linear equations are those in which the dependent variable, [value], and it's derivative does not occur as products, reaised to powers on in nonlinear functions. The equation \( \displaystyle \frac{d^2[value]}{dt^2} = -[value] [value]^2 \) is [value]. The equation \( \displaystyle \frac{d[value]}{dt}+[value][value] = [value]t^3 \) is [value]

Classify the differential equation \[ \dfrac{d^2x}{ dt^2}+[value] \dfrac{dx}{dt}= [value].\]
Feedback: We are given the differential equation \[ \dfrac{d^2x}{ dt^2}+[value] \dfrac{dx}{dt}= [value].\] The highest order of the derivatives is two and there is no non-linear term. So the differential equation is second order and non-linear.

Exercise

Which of the following is a differential equation satisfied by \(y = [value]\), where \(A\) and \(B\) are arbitrary constants.

\(\displaystyle \frac{\mathrm{d}^2y}{\mathrm{d}x^2} =\)
Feedback: Differentiating once, we obtain: \[ \frac{\mathrm{d}y}{\mathrm{d}x} = [value] \] Differentiating a second time, we obtain: \[ \frac{\mathrm{d}^2y}{\mathrm{d}x^2} = [value] \] Substituting using the original formula \(y = [value]\), we get the differential equation: \[ \frac{\mathrm{d}^2y}{\mathrm{d}x^2} = [value] = [value] \]

Exercise

Find differential equations satisfied by each of the following functions. Write your equations in terms of the dependent variable (\(y\) or \(x\) in each case).

1. \(y = [value]\)
\(\displaystyle \frac{\mathrm{d}^2 y}{\mathrm{d} x^2} = \)
2. \(x = [value]\)
\(\displaystyle \frac{\mathrm{d} x}{\mathrm{d} t} = \)
3. \(y = [value]\)
\(\displaystyle \frac{\mathrm{d}^4 y}{\mathrm{d} x^4} = \)
Feedback: 1. We are asked to find a differential equation satisfied by \[y = [value].\] We begin by finding the first and second derivatives of \(y\) with respect to \(x\). \[\begin{aligned} \frac{\mathrm{d} y}{\mathrm{d} x} &= [value] \\ \frac{\mathrm{d}^2 y}{\mathrm{d} x^2} &= [value] \end{aligned}\] Using the original equation, we see that \(y\) satisfies the equation: \[\frac{\mathrm{d}^2 y}{\mathrm{d} x^2} = [value] = [value]\] 2. We are asked to find a differential equation satisfied by \[x = [value].\] We begin by finding the first derivative of \(x\) with respect to \(t\). \[\frac{\mathrm{d} x}{\mathrm{d} t} = [value]\] Using the original equation, we see that \(x\) satisfies the equation: \[\frac{\mathrm{d} x}{\mathrm{d} t} = [value]\] 3. We are asked to find a differential equation satisfied by \[y = [value].\] We begin by finding up to the fourth derivative of \(y\) with respect to \(x\). \[\begin{aligned} \frac{\mathrm{d} y}{\mathrm{d} x} &= [value] \\ \frac{\mathrm{d}^2 y}{\mathrm{d} x^2} &= [value] \\ \frac{\mathrm{d}^3 y}{\mathrm{d} x^3} &= [value] \\ \frac{\mathrm{d}^4 y}{\mathrm{d} x^4} &= [value] \end{aligned}\] Using the original equation, we see that \(y\) satisfies the equation: \[\frac{\mathrm{d}^4 y}{\mathrm{d} x^4} = [value] = [value]\]

Exercise

Find the family of solutions of the differential equation

\[\frac{\mathrm{d}y}{\mathrm{d}x} = [value].\]

Make sure to include the arbitrary constant in your solution.

\(y = \)

Now find the unique solution such that \(y([value]) = [value]\).

\(y = \)
Feedback: We are asked for the general solution of the differential equation \[\frac{\mathrm{d}y}{\mathrm{d}x} = [value].\] We begin by integrating the equation with respect to \(x\). This gives the family of solutions: \[y = \int [value] \,\mathrm{d}x = [value]\] Next, we are asked to find the unique solution such that \(y([value]) = [value]\). In order to do this, we must find the corresponding value of \(c\). \[y([value]) = [value] \implies [value] = [value] \implies c = [value]\] Therefore, the particular solution we seek is: \[y = [value]\]

Exercise

1. Find the general solution of the differential equation
\[y'' = [value].\]
\(y = \) \(+ Ax + B\)
2. Find the solution which satisfies \(y(0) = [value]\) and \(y(1) = [value]\).
\(y = \)
3. Find the solution which satisfies \(y(0) = [value]\) and \(y'(0) = [value]\).
\(y = \)
Feedback: 1. We are asked for the general solution of the differential equation \[y'' = \frac{\mathrm{d}^2 y}{\mathrm{d} x^2} = [value].\] We begin by integrating the equation with respect to \(x\). This gives \[y' = \frac{\mathrm{d} y}{\mathrm{d} x} = \int [value] \,\mathrm{d}x = [value] + A,\] where \(A\) is the constant of integration. We integrate a second time to find \(y\). \[y = \int \left([value] + A\right) \,\mathrm{d}x = [value] + Ax + B\] 2. Next, we are asked to find the unique solution which satisfies \(y(0) = [value]\) and \(y(1) = [value]\). First, we find the value of \(B\). \[y(0) = [value] \implies B = [value]\] And then the value of \(A\). \[y(1) = [value] \implies [value] = [value] \implies A = [value]\] Therefore, the solution we seek is: \[y = [value]\] 3. Lastly, we are asked to find the unique solution which satisfies \(y(0) = [value]\) and \(y'(0) = [value]\). First, we find the value of \(B\). \[y(0) = [value] \implies B = [value]\] And then the value of \(A\). For this, we will need an expression for \(y'\). This is given by \[y' = \frac{\mathrm{d}y}{\mathrm{d}x} = [value] + A.\] Then \[y'(0) = [value] \implies [value] + A = [value] \implies A = [value]\] Therefore, the solution we seek is: \[y = [value]\]

1. In this RL circuit the switch is closed at \(t = 0\) and a constant voltage \(E\) is applied.
[Image: Image of an RL circuit which has a constant voltage E]
The voltage across the resistor is \(iR\) where \(i\) is the current owing in the circuit and \(R\) is the (constant) resistance. The voltage across the inductance is \(L \dfrac{\textrm{d}i}{\textrm{d}t}\) where \(L\) is the constant inductance.
Kirchhoff's law of voltages states that the applied voltage is the sum of the other voltages in the circuit.
The differential equation for the current \(i\) is \( L \dfrac{\textrm{d}i}{\textrm{d}t} + Ri = E.\)
Which is the initial condition for the current at \(t=0\)?
\( i = \)
2. In the LCR circuit below the voltage across the capacitor is \(q=C\) where \(q\) is the charge on the capacitor, and \(C\) is the capacitance. Note that \( \dfrac{dq}{dt} = i.\)
[Image: Image of an RLC circuit with constant voltage E]
The differential equation for \(i\) is \[L \dfrac{\textrm{d}^2t}{\textrm{d}t^2} + R \dfrac{\textrm{d}^q}{\textrm{d}t} + \dfrac{q}{C} = E\]
Write down the initial conditions if the initial charge is zero and the switch is closed at t = 0.
\( q = \)
\( i = \)