Differential Equations | Scoins.net | DJS

Differential Equations

I found these pages when clearing up (throwing away) a load of old paper. Subsequently hunting for electronic copies I found that I needed to retype some before throwing the lot. Dated 20051129 or thereabouts.

Edit 2020:  Be aware that indexes tend to drop their superscripts. In places I have used e^ index to work around this.

This is a powerful tool in the arsenal for mathematicians. I work through the various techniques here, graduating them from ordinary A-level through to the hard end of Further Maths.

A differential equation is an equation with some differentials in it. If I write y’ for dy/dx and y” for d²y/dx², then ay” + by’ +cy = 0 is a linear, second order differential equation: ay” + by’ +c(y’)² + dy = 0  is non-linear and second order, ay’ + by = 0 is a linear first order one.

I shall write f(x) and sometimes just f; g(y) and sometimes just g. F(x) may be the integral of f(x) or just another function with x as variable. Textbooks can be confusing if there is an assumption that all problems use functions in x and y. Many problems use x and t instead and the well-prepared student experiences a mix sufficient to avoid such assumptions. You should assume that t represents time, so if x represents displacement then dx/dt, “x dot”, represents velocity and the second differential, “x double dot” is acceleration.

0th type: Exact solution

Thanks to the product rule, some problems, especially those set in exams, can be solved directly by recognising the differentiated terms as the result of applying the product rule: vu’+uv’ = (uv)’. The clue that this is the case (in exams) is that the problem appears to be outside the syllabus. The experienced candidate includes this possibility in their reading of the question.

The most common example is

  x dy/dx + y = f(x) where one might recognise the LHS as d/dx (xy).

Thus, by integrating both sides, [xy] =  f(x) dx = F(x) + c

So y = F(x)/x + c/x. when these happen, don’t lose the constant of integration!

1st type: Variables separable:

This is on most A-level syllabi: in general, some combination of functions f(x) and g(y) gives an equivalence to y’.g(y) = f(x)

We can multiply both sides by dx and hence g(y) dy = f(x) dx, so provided we can do the integrations we will have G(y) = F(x) + c and the implicit function may give an explicit solution.


  dy/dx = xy    =>  y-1dy = xdx     =>  ln |y| = ½ x² + c

so y = e^xx/2 + c = e^c.e^xx/2 = Ae^xx/2 for some constant A, writing xx/2 for ½ x².

The reason for the name is obvious; the variables can be separated.

There is an extension of this class of problems where a substitution is used to reduce the complexity of the problem. Finding these is more art than science and under exam conditions they will usually be provided. In real situations, one experiments with successively more complicated substitutions, looking for hints as to the class that might work. Typical cases using x and y as variables would be u=dy/dx; u=xdy/dx; u =xy. It is tempting to class the ways of reducing differential equations (to ones of a lesser difficulty) as a class of method in itself.

Exercise: Solve where appropriate.

1  Why did I write [xy] =  f(x) dx = F(x) + c ? What is the meaning of [xy]?

2  dy/dx  = ex / y

3  x dy/dx + y = 0

4  dy/dx  = sin x / cos y

5  dy/dx  = y e-x

6   dy/dx  = (1+y²) x²

7  x dy/dx + y  = ex + e-x.

8   sinx dy/dx + y cosx = Ae-x

2nd type: Integrating factor

Suppose  y’ + y L(x) = R(x)

Multiply through by the magic ingredient      M(x),     so My’ + y ML = MR.

Now, it is possible that M can be found so that the differential of   My  is helpful: you could say that we may assume this to now be an exact differential.
Therefore, using the Chain rule, 
d/dx (My) = y M’ + M y‘     

Now, we want y M’ + M y’ to equal My’ + y ML,   =>   we want M’ = ML.

Look at this: M’ = dM/dx = ML;   hence dM/M = L dx and we can integrate that to give ln M = ML dx.

Hence we might write this as M = e ∫L dxM is (therefore) called an integrating factor. These are common in the handling of first order differential equations and can be found used in techniques for higher order problems. The wonderful idea is to insert the factor first and then to find out how it must behave, which why I use M, for Magic ingredient.

Exercise to write  – 



3rd type: second order differential equations

I cover those of the form ay” + by’ +cy = f(x)

Assume for now that there is a solution of the form y=Aekx where many textbooks prefer to use lambda for k. Consider the reduced problem ay” + by’ +cy = 0: the LHS above becomes

Aekx (ak² + bk + c)       you should do this for yourself.

Since the external factor Aekx is never zero, only the quadratic factor can be zero, so the roots of this, the auxiliary equation, provide the first ideas towards a solution, the complementary function. A-level students are assumed to be perfect at handling quadratics, so already you recognise that there are three cases to consider based on the discriminant, b² – 4ac being positive, negative or zero. It always amazed me how many students disovered that they really hadn’t perfected quadratics when we reached this position; something of a disaster.

b² – 4ac >0 gives two real roots, so if the auxiliary equation results in roots of  α and β, 

then y = Ae αx + Be βx

b² – 4ac <0 gives two complex roots, so if the auxiliary equation results in roots of ±i, then y = ex (Aeix + Be-ix), which is usually more helpfully expressed as y = ex (C cosx + D sinx). We do already know about the relationship between A,B and C,D and sometimes will use that knowledge.

b² – 4ac = 0, giving two equal roots, which gives the less obvious solution (A+Bx)ex

I will write more on this if someone asks. This originally from 2005.

Applications of Differential Equations.

The expressions x” and y” mean the second differential, usually with respect to time. I use y`` for differentiation with respect to (w.r.t.) x. Word can manage the double dot but iWeb cannot. Oddly, alt-u y gives ÿ but alt-u x gives ¨x. Also possible are öëïüä. I have assumed that displacement is generally represented by s rather than x.


1  Falling body with air resistance. Imagine something falling from a plane; terminal velocity maybe 60m/sec (human).  Model:  m dv/dt = mg – mkv.  Develop expressions for v(t) and s(t). Good modelling reworks dv/dt as v dv/ds and checks the solution of v(s) against the result of eliminating t from v(t) and s(t)

2  Repeat this but with an initial upward velocity of U.

3  Repeat with a different model for air resistance          m dv/dt = mg – mkv²  Find v(t) and v(s) and the useful formula of the form As + Bv + Ct = 0 on the way to checking your version of s(t).

4  Throw this last particle vertically upwards at U and show the time to greatest height is given by (gk)-1/2 tan-1(u √(k/g))

5  Bouncing spring.  A particle mass m hangs on the end of a spring natural length l and stiffness k. It is held with the string only just taught and dropped. Prove SHM by measuring the displacement from the equilibrium position. Proof is when ÿ = -w²y, so you need to show the displacement. For CIE students, state the period.

Physics & Engineering

6  Newton’s Law of Cooling says the temperature, ø drops in proportion to the difference between the body and its surroundings,  dø/dt = -k (ø – ø0). Establish a general solution. A cup of coffee is made at 91º C in a good quality cup on a warm day cools from 91º to 80º and from 85º to 75º in 3 minutes. When does it reach 42º?

7  Given an electrical circuit including an alternating source V cos wt , a inductance L in series with a resistor R, its current varies according to the equation Ldi/dt + Ri = V cos wt.
(i) Solve the general position.
(ii) Simplify this for large t when w = 50 Hertz, R = 9 ohms, L = 0.24 henrys and tan ß = ¾.

8  A radioactive substance P decays without loss of mass into Q which decays in similar fashion to become substance R.
(i)  Initially there is one gramme of P and if dp/dt = -3p find an expression for the mass of P.
(ii)  Given also that dr/dt = 2q, write an expression for dq/dt
(iii)  Find suitable expressions for the mass of Q and R.
(iii)  Find the maximum amount of Q formed.

Exercises on Diff Eqns:

First Order Separable Variables

First Order with Integrating Factor

First Order with auxiliary equation

Second Order: auxiliary

Second Order: with transform

Second Order: Harder

1The deceleration of a body is directly proportional to the velocity.

(i) Write the equation and solve to show v=Ae-kt.

(ii) Extend this to generate displacement at time t.

2In rapidly growing culture of yeast rate of change of the number of cells present is in proportion to the number already formed.

(i) Show this is exponential growth.

(ii) If initially there were 1x103 cells and this doubles in the first 30 seconds, how long before there are 5x104 cells?

3Two chemicals of weights A & B are mixed. The total weight, W, remains constant. B is converted to A at a rate given by dB/dt = kA2/B.

(i) Eliminate A from this equation and find the general solution for B as a function of time.

(ii) If initially B is 95% of W and a minute later it is 90%, how long will it take for B to be 50% of the whole?

4The makers of my favourite gadget have become aware that sales have not changed. So they launch an advertising campaign which makes the number of customers, n, rise at a rate proportional to √n. Write equations expressing the sales before and after the advertising campaign.

Even More on DEs  20051129

Given that, working in x and y, the general second order differential equation y’’ + by’ + cy =0 has a solution of the type y = A e^λx, then it follows rapidly that y’ = Aλ e λx, y” = Aλ²e^λx, and that therefore, substituting for the versions of y, λ² + bλ + c = 0, which has roots λ= (-b ± √(b²-4ac))/2


When these roots are complex and if b²-4ac = μ2 then the two roots are -(b ± jμ)/2.

Thus the Complementary Function is y = e -bx/2 ( A e^ jμx /2  +  e^ -jμx /2).

Using Euler’s Theorem,   e^= cos θ + j sin θ  and e^-jθ = cos θ - j sin θ, so

y = e^ -bx/2   ( A cos μx /2 + Aj sin μx /2  + B cos μx /2 - Bj  sin μx /2  )

   = e^ -bx/2   ( ( A + B) cos μx /2 + j (A_B) sin μx /2  )

If we then decide that y is a real, then the RHS of this last equation is made of reals, so we have that A & B are each complex, since both A+B and j(A-B) are real. The imaginary parts of And B must cancel to make A+B real and the real parts must be equal to make (A-B)j real. This can only happen if A and B are a conjugate pair, say of the form (p ± jq)/2.

In this way A+B = p and (A-B)j = q and so y  = e -bx/2   ( ( A + B) cos μx /2 + j (A_B) sin μx /2  )

becomes  y = e -bx/2   ( p cos μx /2 + q sin μx /2  )

We could easily lose the twos by starting with different values for the constants, such as starting with y” + 2by’ +cy = 0, hence roots λ = -b ± √(b2-ac)  = -(b+jμ),

leading to     y = e -bx/2   ( p cos μx  + q sin μx  )

Euler’s Rule says that    e = cos θ + j sin θ  and  e-jθ = cos θ - j sin θ,

so cos θ = 1/2 (e  + e-jθ)    and  sin θ = 1/2 (e  - e-jθ).

de Moivre’s theorem uses that   ejnθ = (e)n to give directly a route that shows expansions of cos nθ in terms of cos θ, Like this: ejnθ = (e)n = cos nθ + j sin nθ   = (cos θ + j sin θ) n  .

Moving on to systems of DEs, where dx/dt is written x‘

then any pair of equations  y‘ = px + qy                                                                                     ......1

                                and     x’  = rx + sy                                                                                      ......2

allows from 1: x” = rx’ = sy‘   and from 2:  sy = x’-rx   so

                x” = rx’ + sy’  = rx’ + s(px+qy) = rx’ + spx + sqy = rx’ + spx + q(x’ - rx)

so x” - (q-r) x’ - (ps-qr) x = 0                                                                                                       ......3

Note that ps-qr is the determinant of the square matrix formed by the coefficients.

Similarly, y’ - (q-r)y’ - (ps-qr) y = 0 (which is, oddly, the same).

However, if one was to start with the equations 4 and 5 instead

                                       y‘ = px + qy + a                                                                                    ......4

                            and     x’  = rx + sy + b                                                                                   ......5

then you (will when you have done it for yourself) find that

               x” - (q-r)x’ -  ps - qr) x = sa - qb                                                                                  ......6

       and  y” - (q+r) y’ - (ps-qr) y = pb - ra                                                                                   ......7

You ought to write this as a matrix equation to see advantages to using such methods.

There is much mileage to be had in exploring tangent fields for solutions to DEs, particularly for non-linear functions. However, it is not necessary to develop a rigid technique for this: some intelligent use of mathemnatics can help enormously.

Given x’ and y’, dy/dx is esily written down. An asymptotic version of the general solution occurs when dy/dx is constant, say m.. From equations 4 7 5,

y‘ = px + qy + a      gives   dy = px + qy + a   = m                                                                                         

x’  = rx + sy + b                  dx     rx + sy + b                                   

      px + qy + a   = m(rx + sy + b)  =>  y = (mr - p ) x   + mb - a

                                                                   q - ms           q-ms

the gradient of this (which may not display properly on your browser) is m which implies that

    qm - m2s  = (mr-p) x, hence m2s - (q+r+b)m - p = 0  and  m = {q+r  ±  √((q+r)2 + 4sp) } / 2s.

If the discriminant is negative then there are no asymptotes (expect a spiral or concentric rings in the tangent field). If the discriminant is zero, there is one  , so .... (you fathom it out)

if the roots are different and real then one can expect one line to be ingress and one egress.

It is worthwhile finding and using the particular lines for which dy/dx is 0, -1, +1 and what happens along the two axes, etc.  It is also worthwhile looking to see if there is an equilibrium point, where x’=y’=0.   i.e. y = - (px+a) / q  = -  (rx+b) / s   => spx = as = qrx + bq  => x = (bq-as) / (ps - qr)

Similarly (you do it)  y = (bp-ar) / (ps-qr)

DJS 20160909

Related pages are Growing Up and Dying Away, in Sixth Pure.

  Email: David@Scoins.net      © David Scoins 2020