Newton's Cooling Law lecture 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

4 Solving first order linear ODE.

Newton’s law of cooling


Linear equations and systems will take a significant part of our course. Here we start with the simplest
linear problem:

Definition 1. The first order ODE of the form

y ′ + p(x)y = q(x) (1)

is called linear.

Here p(x) and q(x) are given functions of the independent variable x. Equation (1) is called
homogeneous if q(x) ≡ 0, and nonhomogeneous (or, sometimes, inhomogeneous) in the opposite case.
There are several methods of solving (1) (of finding the general solution to (1)). We will consider the
method of integrating factor and the variation of the constant method.

4.1 The method of the integrating factor


( )′
Fist, recall from Calculus that for any two differentiable functions u(x)v(x) = u′ (x)v(x)+u(x)v ′ (x).
Using the last formula, we can try to find such function µ(x), which is called an integrating factor,
that turns the left-hand side of the equation (1) into the derivative of the product of two functions:

µ(x)y ′ + µ(x)p(x)y = µ(x)q(x),

which means that one should have

u(x) = µ(x), u′ (x) = µ(x)p(x),

from where we get that ∫


µ′ (x) = µ(x)p(x) =⇒ µ(x) = e p(x) dx
.
In the last expression we can take any antiderivative for p(x) because we are interested in an integrating
factor (in words, you do not need to worry about the arbitrary constant). Therefore, to solve the
linear ODE (1), you need first to find an integrating factor µ(x), which will simplify the following
steps. According to the reasoning above, after the multiplication of the both sides of the equation by
µ(x), it follows that ( )′
µ(x)y(x) = µ(x)q(x).
Hence, ∫ ∫
1
µ(x)y(x) = µ(x)q(x) dx =⇒ y(x) = µ(x)q(x) dx,
µ(x)
which gives the general solution to (1).
Here are a few examples.

Example 2.
y ′ − y = 4ex .
MATH266: Intro to ODE by Artem Novozhilov, e-mail: [email protected]. Spring 2024

1
This is obviously a linear equation with p(x) = −1 (note the minus sign!) and q(x) = 4ex . The
integrating factor is (using the notation exp(x) := ex for the exponential function)
(∫ )
µ(x) = exp (−1) dx = exp(−x) = e−x .

Hence, ∫
e−x y = 4e−x ex dx = 4x + C.

The final answer is


y(x) = 4xex + Cex .

Example 3.
(2x + 1)y ′ = 4x + 2y.
First, we rewrite this equation as
2 4x
y′ − y= ,
2x + 1 2x + 1
assuming that 2x + 1 ̸= 0. Here, obviously, p(x) = − 2x+1
2 4x
and q(x) = 2x+1 . An integrating factor can
be found as ( ∫ )
2 1
µ(x) = exp − dx = exp(− ln |2x + 1|) = ,
2x + 1 |2x + 1|
and since we assume that 2x + 1 ̸= 0 and our integrating factor can be always multiplied by −1, we
can drop the absolute value here. Finally,
1
µ(x) = .
2x + 1
This implies that
( )′ ∫ ∫
y 4x y 4x dx 2(2x + 1) − 2 1
= 2
=⇒ = 2
= 2
dx = ln |2x + 1| + + C.
2x + 1 (2x + 1) 2x + 1 (2x + 1) (2x + 1) 2x + 1

Finally,
y(x) = (2x + 1)(C + ln |2x + 1|) + 1,
which is the general solution to our equation.

Example 4.
(x + y 2 )y ′ = y.
First look tells us that this equation is not linear. And this is indeed true if we say that this equation
is not linear with respect to the dependent variable y. However, sometimes it is useful to perform
the following trick: Exchange the rôle of the variables x and y in the equation. To accomplish this
formally, we can use the Leibnitz notation:
dy dx
(x + y 2 ) = y =⇒ x + y 2 = y ,
dx dy

2
hence
1
x′ (y) − x = y,
y
which is a linear ODE with respect to the unknown function x(y). We also have p(y) = − y1 and
q(y) = y.
dy
You may recall that in Lecture 2 I already stated that it is not correct to treat dx as a fraction,
however, as in the case of separable equations, we will not get a wrong answer by performing the steps
outlined above. A rigorous justification of the considered approach would rely on the inverse function
theorem from your Calculus course.
The integrating factor here is given by
1
µ(y) = ,
y
and the general solution is (fill in the omitted steps)

x(y) = y 2 + Cy.

4.2 The variation of the constant method


There is another method that also works in more general situations. Therefore, I will briefly describe
it here.
The first step in this method is to solve the homogeneous linear equation

y ′ = −p(x)y,

which is a separable equation. The general solution is given by



y(x) = Ce− p(x) dx
.

Now the crucial step is to assume that the arbitrary constant in the solution above is not a constant
but an unknown function depending on x:

y(x) = C(x)e− p(x) dx
,

and plug this expression into the original non-homogeneous equation y ′ + p(x)y = q(x):
( ∫ )′ ∫
C(x)e− p(x) dx + p(x)C(x)e− p(x) dx = q(x) =⇒
∫ ∫ ∫
C ′ (x)e− p(x) dx
− p(x)C(x)e− p(x) dx
+ p(x)C(x)e− p(x) dx
= q(x).
Note that two terms cancel, this should be always true for this method: Something must be canceled.
Now we obtain,
∫ ∫ ∫ ∫
′ − p(x) dx ′ p(x) dx
C (x)e = q(x) =⇒ C (x) = q(x)e =⇒ C(x) = q(x)e p(x) dx dx + C1 .

Finally, putting everything together:


(∫ ∫
) ∫
y(x) = q(x)e p(x) dx
dx + C1 e− p(x) dx ,

3
and this gives the general solution to the linear ODE (1).
Consider again the equation
y ′ − y = 4ex .
Using the variation of the constant method, we first solve

y ′ − y = 0 =⇒ y(x) = Cex .

Now assume that C = C(x) and plug C(x)ex into the original non-homogeneous equation

C ′ (x)ex + C(x)ex − C(x)ex = 4ex =⇒ C ′ (x) = 4 =⇒ C(x) = 4x + C1 .

Hence we get the solution


y(x) = C(x)ex = 4xex + C1 ex ,
which, as expected, coincides with the solution found earlier by the method of the integrating factor.
You should practice this method on the rest of the examples in this lecture.

4.3 Newton’s law of cooling


To illustrate applications of the technique I have just described, consider a system when an object
of the initial temperature T0 is placed in the surrounding media which has prescribed temperature
Tout (t), where t denotes time, thus we allow that Tout (t) can change with time, however, we have
full information about this temperature, i.e., we know Tout (t). For a more concrete example think
about a cup of tea, which is put inside a refrigerator. Common sense tells us that sooner or later the
temperature of the object should approach the temperature of the surrounding media, but how long
does it usually take? To answer this question, we recall Newton’s law of cooling that states that

the rate of change of the temperature of an object is proportional to the difference between
its own temperature and the ambient temperature (i.e. the temperature of its surroundings).

Since the instantaneous rate of change mathematically is given by the derivative, we end up with the
IVP
Ṫ = −k(T − Tout (t)), T (0) = T0 .
Here, again, T (t) is the temperature of the object that we would like to determine (unknown function),
T0 is the initial temperature of the object, Tout (t) is the prescribed ambient temperature, which we
know, k is the constant of proportionality that characterizes the ability of the object to exchange the
heat energy, and which depends on the material. The sign minus is taken so that, if k > 0, our object
would decrease its temperature if Tout < T0 and increase if Tout > T0 .
Note that if we had Tout constant, then the resulting ODE would be separable.
I rewrite the equation in the standard form

Ṫ + kT = kTout (t).

First solve the homogeneous equation Ṫ + kT = 0, which has the solution T (t) = Ce−kt . Now assume
that C = C(t) (I am using the variation of the constant method),

′ −kt
C (t)e = kTout (t) =⇒ C(t) = kTout (t)ekt dt.

4
The general solution is ∫
−kt
T (t) = e kTout (t)ekt dt,

where the integral includes the arbitrary constant C1 , which has to be determined from the initial
condition.
As an important particular case consider Tout (t) = constant = Tout . In this case the formula for
the general solutions simplifies to (check this)

T (t) = Tout + (T0 − Tout )e−kt ,

which shows, as expected, that


lim T (t) = Tout .
t→∞

Example 5. A dead body is found at 12 pm in a room that is maintained at 72◦ F. If the body is
82◦ F when it is found, and has cooled to 80◦ F at 1 pm, estimate the time of death. (Assume a living
body maintains a temperature of 98.6◦ F.) To solve this problem, we first use our notations, to identify

T (0) = T0 = 82, T (1) = 80, Tout = 72.

This is enough to find that


5
80 = 72 + 10e−k =⇒ k = log .
4
Now we need to find the time such that

98.6 = 72 + 10e−kt ,

where k we already know. After some rearrangement, we have

t = −4.38,

which means that the death occurred around 7:37am.

4.4 First glimpse of an electric circuit


Linear ODE find a lot of applications when dealing with electric circuits. Here is our first example.
It is well known (an experimental fact), that in a circuit with resistance R (measured in ohms) and
inductance L (in henrys) the dependence of the voltage E(t) (in volts) and the current I(t) (in amps)
is given by
dI
E(t) = RI + L ,
dt
which is a first order linear equation. In general of course E = E(t) is a function of time. Consider
an example when E = E0 = const and I(0) = I0 .
The solution of this linear equation (you should fill in the details) is
( )
E0 E0
I(t) = + I0 − e−(R/L)t .
R R
We can see from this solution that when t → ∞ the current approaches the steady state E0 /R. It is
a good exercise to find the current in the case when E(t) = E0 sin 2πnt for some constant n ∈ N.

5
Another equation is obtained for a circuit with a capacitor, with capacitance C (in farads), resis-
tance R and voltage E(t). In this case the empirical law says that

dQ Q
R = E(t) − ,
dt C
where Q(t) is the charge on the capacitor measured in coulombs. Note for future lectures that there
is a connection between the current and the charge
dQ
I= .
dt

4.5 Problems for a mathematically inclined student
1. Show that the linear equation (1) stays linear for any change of the independent variable x =
ϕ(t), ϕ ∈ C (1) .

2. Assume that we are given the family of the integral curves of (1). Fix point x and consider
tangent lines to different integral curves at x. Show that they all cross at the same point S and
find its coordinates.

You might also like