Differential Equations for EngineersXYZ Homework Edition

⇩ Download ▾

0.2 Introduction to Differential Equations

Differential Equations

The laws of physics are generally written down as differential equations. Therefore, all of science and engineering use differential equations to some degree. Understanding differential equations is essential to understanding almost anything you will study in your science and engineering classes. You can think of mathematics as the language of science, and differential equations are one of the most important parts of this language as far as science and engineering are concerned. As an analogy, suppose all your classes from now on were given in Swahili. It would be important to first learn Swahili, or you would have a very tough time getting a good grade in your classes.

You saw many differential equations already without perhaps knowing about it. And you even solved simple differential equations when you took calculus. Let us see an example you may not have seen:

dxdt+x=2cost.\label{eq:1} \frac{dx}{dt} + x = 2 \cos t.

(0.2.1)
Here xx is the dependent variable and tt is the independent variable. Equation (0.2.1) is a basic example of a differential equation. It is an example of a first order differential equation, since it involves only the first derivative of the dependent variable. This equation arises from Newton’s law of cooling where the ambient temperature oscillates with time.

Solutions of Differential Equations

Solving the differential equation means finding xx in terms of tt. That is, we want to find a function of tt, which we call xx, such that when we plug xx, tt, and dxdt\frac{dx}{dt} into (0.2.1), the equation holds; that is, the left hand side equals the right hand side. It is the same idea as it would be for a normal (algebraic) equation of just xx and tt. We claim that

x=x(t)=cost+sintx = x(t) = \cos t + \sin t \nonumber

is a solution. How do we check? We simply plug xx into equation (0.2.1)! First we need to compute dxdt\frac{dx}{dt}. We find that dxdt=sint+cost\frac{dx}{dt} = -\sin t + \cos t. Now let us compute the left-hand side of (0.2.1).

dxdt+x=(sint+cost)dxdt+(cost+sint)x=2cost.\frac{dx}{dt} + x = \underbrace{(-\sin t + \cos t)}_{\frac{dx}{dt}} + \underbrace{(\cos t + \sin t)}_{x} = 2\cos t. \nonumber

Yay! We got precisely the right-hand side. But there is more! We claim x=cost+sint+etx = \cos t + \sin t + e^{-t} is also a solution. Let us try,

dxdt=sint+costet.\frac{dx}{dt} = -\sin t + \cos t - e^{-t}. \nonumber

We plug into the left-hand side of (0.2.1)

dxdt+x=(sint+costet)dxdt+(cost+sint+et)x=2cost.\frac{dx}{dt} + x = \underbrace{(-\sin t + \cos t - e^{-t})}_{\frac{dx}{dt}} + \underbrace{(\cos t + \sin t + e^{-t})}_{x} = 2\cos t. \nonumber

And it works yet again!

sin(t)+cos(t)-\sin\left(t\right) + \cos\left(t\right)
Differentiating the claimed solution x = cos t + sin t ✓ Computed · mojocas 0.1.0 ✓ Agrees with the text Differentiating the claimed solution x = cos t + sin t, computed exactly by mojocas 0.1.0, and confirmed to agree with the result stated in the text.Lebl claims x(t) = cos t + sin t solves dx/dt + x = 2 cos t, and checks it by computing dx/dt = -sin t + cos t. That derivative is recomputed here at build time, so the check is re-run on every rebuild rather than trusted once.

So there can be many different solutions. For this equation all solutions can be written in the form

x=cost+sint+Cet,x = \cos t + \sin t + C e^{-t}, \nonumber

for some constant CC. Different constants CC will give different solutions, so there are really infinitely many possible solutions. See Figure 1\PageIndex{1} for the graph of a few of these solutions. We will see how we find these solutions a few lectures from now.

Interactive figureInfinitely many solutions of dx/dt + x = 2 cos tDrag the Constant C slider from -3 to 3.
A solid curve enters at some height on the left, swings through a first dip and rise, and by the right-hand side of the frame has settled onto a dashed wave that repeats without dying away — over that last stretch the two are indistinguishable. Changing the constant moves only the starting height and the size of that opening transient: the curve can begin well above or well below the dashed one, but it always ends up riding along it. Adjustable parameter: Constant C (C) = 1. Viewing window: x from -0.94 to 10.94, y from -3.07 to 4.27.
XYZ Graph · viewer build 5edf91b · plotted curve checked against “The general solution of dx/dt + x = 2 cos t, solved” (mojocas 0.1.0): agrees
Every solution of equation (0.2.1): x = cos t + sin t + C·e^(-t), drawn against time t on the horizontal axis (XYZ Graph names the vertical axis y; here it is Lebl's x). Drag C from -3 to 3 and each curve leaves a different starting height at t = 0 - anywhere from -2 to 4, since x(0) = 1 + C - yet by t = 4 every one of them lies within 0.06 of the dashed C = 0 curve. The constant fixes only the transient; the long-run oscillation cos t + sin t is common to all of them. C = 1, the slider's starting value, is the solution the section checks by substitution.
C·exp(t)+sin(t)+cos(t)C \cdot \exp\left(-t\right) + \sin\left(t\right) + \cos\left(t\right)
The general solution of dx/dt + x = 2 cos t, solved ✓ Computed · mojocas 0.1.0 ✓ Agrees with the text The general solution of dx/dt + x = 2 cos t, solved, computed exactly by mojocas 0.1.0, and confirmed to agree with the result stated in the text.Lebl states that every solution has the form x = cos t + sin t + C·e^(−t). Here the first-order linear equation dx/dt = 2 cos t − x is solved by the computer algebra system from the equation itself, and its solution family — one arbitrary constant, C — is checked against the stated form on every rebuild. The figure above plots that same expression with C on the slider, and the plotted curve is checked against this computed family too.
Three solution curves over x from 0 to 5 starting at 3, 1 and -1. All fall through zero, bottom out near -1.45 around x = 3.95, then turn back up almost indistinguishably.
Figure 1\PageIndex{1}: Few solutions of dxdt+x=2cost\frac{dx}{dt}+x=2\cos t.

Solving differential equations can be quite hard. There is no general method that solves every differential equation. We will generally focus on how to get exact formulas for solutions of certain differential equations, but we will also spend a little bit of time on getting approximate solutions. And we will spend some time on understanding the equations without solving them.

Most of this book is dedicated to ordinary differential equations or ODEs, that is, equations with only one independent variable, where derivatives are only with respect to this one variable. If there are several independent variables, we get partial differential equations or PDEs.

Even for ODEs, which are very well understood, it is not a simple question of turning a crank to get answers. When you can find exact solutions, they are usually preferable to approximate solutions. It is important to understand how such solutions are found. Although in real applications you will leave much of the actual calculations to computers, you need to understand what they are doing. It is often necessary to simplify or transform your equations into something that a computer can understand and solve. You may even need to make certain assumptions and changes in your model to achieve this.

To be a successful engineer or scientist, you will be required to solve problems in your job that you never saw before. It is important to learn problem solving techniques, so that you may apply those techniques to new problems. A common mistake is to expect to learn some prescription for solving all the problems you will encounter in your later career. This course is no exception.

Differential Equations in Practice

Diagram of a three-node cycle: an arrow labelled abstract runs from Real-world problem to Mathematical model, solve to Mathematical solution, and interpret back to the problem.
Figure 2\PageIndex{2}

So how do we use differential equations in science and engineering? First, we have some real-world problem we wish to understand. We make some simplifying assumptions and create a mathematical model. That is, we translate the real-world situation into a set of differential equations. Then we apply mathematics to get some sort of a mathematical solution. There is still something left to do. We have to interpret the results. We have to figure out what the mathematical solution says about the real-world problem we started with.

Learning how to formulate the mathematical model and how to interpret the results is what your physics and engineering classes do. In this course, we will focus mostly on the mathematical analysis. Sometimes we will work with simple real-world examples so that we have some intuition and motivation about what we are doing.

Let us look at an example of this process. One of the most basic differential equations is the standard exponential growth model. Let PP denote the population of some bacteria on a Petri dish. We assume that there is enough food and enough space. Then the rate of growth of bacteria is proportional to the population—a large population grows quicker. Let tt denote time (say in seconds) and PP the population. Our model is

dPdt=kP,\frac{dP}{dt} = kP, \nonumber

for some positive constant k>0k > 0.

Normally, the kk in P=kPP' = kP is known, and we want to solve the equation for different initial conditions. What does that mean? Take k=1k=1 for simplicity. Suppose we want to solve the equation dPdt=P\frac{dP}{dt} = P subject to P(0)=1000P(0) = 1000 (the initial condition). Then the solution turns out to be (exercise)

P(t)=1000et.P(t) = 1000 \, e^t. \nonumber

We call P(t)=CetP(t) = C e^t the general solution, as every solution of the equation can be written in this form for some constant CC. We need an initial condition to find out what CC is, in order to find the particular solution we are looking for. Generally, when we say "particular solution," we just mean some solution.

Fundamental Equations

A few equations appear often and it is useful to just memorize what their solutions are. Let us call them the four fundamental equations. Their solutions are reasonably easy to guess by recalling properties of exponentials, sines, and cosines. They are also simple to check, which is something that you should always do. No need to wonder if you remembered the solution correctly.

Interactive figureThe four fundamental equations under one shared kDrag the Rate / frequency k slider from 0 to 2.
Four curves meet at a single point on the vertical axis: one climbs away to the right, its mirror image climbs away to the left, a dashed curve runs exactly midway between those two and climbs on both sides, and a wave stays trapped in a band about the horizontal axis. Turning the shared rate down to zero collapses all four onto one horizontal line; turning it up drives the three unbounded curves off the top ever sooner while the wave only oscillates faster, never any taller. Adjustable parameter: Rate / frequency k (k) = 1. Viewing window: x from -5.28 to 5.28, y from -2.26 to 4.26.
XYZ Graph · viewer build 5edf91b
The section's four fundamental equations on one set of axes, all driven by a single shared k. The curve rising to the right is e^(kx), solving y′ = ky; its mirror image rising to the left is e^(-kx), solving y′ = -ky; the wave is cos(kx), solving y″ = -k²y; and the dashed curve is cosh(kx) = (e^(kx) + e^(-kx))/2, solving y″ = k²y — which is why it runs exactly halfway between the two exponentials at every x. All four pass through y = 1 at x = 0, whatever k is. Lebl takes k > 0; drag the slider down to the degenerate k = 0 and the four equations become the same equation, so all four curves collapse onto the single line y = 1. Drag k up to 2 and the wave stays trapped between -1 and 1 while the other three leave the top of the frame ever sooner — but they were already unbounded back at k = 0.1, so what separates oscillation from blow-up is the minus sign on k² in y″ = -k²y, not the size of k. The minus in y′ = -ky buys nothing: it only flips which side e^(-kx) blows up on.

First such equation is

dydx=ky,\frac{dy}{dx} = k y, \nonumber

for some constant k>0k > 0. Here yy is the dependent and xx the independent variable. The general solution for this equation is

y(x)=Cekx.y(x) = C e^{kx}. \nonumber

We saw above that this function is a solution, although we used different variable names.

Next,

dydx=ky,\frac{dy}{dx} = -k y, \nonumber

for some constant k>0k > 0. The general solution for this equation is

y(x)=Cekx.y(x) = C e^{-kx}. \nonumber

Next, take the second order differential equation

d2ydx2=k2y,\frac{d^2y}{{dx}^2} = -k^2 y, \nonumber

for some constant k>0k > 0. The general solution for this equation is

y(x)=C1cos(kx)+C2sin(kx).y(x) = C_1 \cos(kx) + C_2 \sin(kx). \nonumber

Since the equation is a second order differential equation, we have two constants in our general solution.

Finally, consider the second order differential equation

d2ydx2=k2y,\frac{d^2y}{{dx}^2} = k^2 y, \nonumber

for some constant k>0k > 0. The general solution for this equation is

y(x)=C1ekx+C2ekx,y(x) = C_1 e^{kx} + C_2 e^{-kx}, \nonumber

or

y(x)=D1cosh(kx)+D2sinh(kx).y(x) = D_1 \cosh(kx) + D_2 \sinh(kx). \nonumber

For those that do not know, cosh\cosh and sinh\sinh are defined by

coshx=ex+ex2,sinhx=exex2.\cosh x = \frac{e^{x} + e^{-x}}{2}, \qquad \sinh x = \frac{e^{x} - e^{-x}}{2}. \nonumber

They are called the hyperbolic cosine and hyperbolic sine. These functions are sometimes easier to work with than exponentials. They have some nice familiar properties such as cosh0=1\cosh 0 = 1, sinh0=0\sinh 0 = 0, and ddxcoshx=sinhx\frac{d}{dx} \cosh x = \sinh x (no that is not a typo) and ddxsinhx=coshx\frac{d}{dx} \sinh x = \cosh x.

An interesting note about cosh\cosh: The graph of cosh\cosh is the exact shape of a hanging chain. This shape is called a catenary. Contrary to popular belief this is not a parabola. If you invert the graph of cosh\cosh, it is also the ideal arch for supporting its weight. For example, the gateway arch in Saint Louis is an inverted graph of cosh\cosh—if it were just a parabola it might fall. The formula used in the design is inscribed inside the arch:

y=127.7ft·cosh(x/127.7ft)+757.7ft.y = -127.7 \; \textrm{ft} \cdot \cosh({x / 127.7 \; \textrm{ft}}) + 757.7 \; \textrm{ft}. \nonumber

Interactive figureGateway Arch: catenary against the matched parabolaDrag the Catenary scale a slider from 60 to 600.
Two arches spring from the same two feet and meet at the same apex, but between those points the solid catenary bows out above the dashed parabola, standing furthest above it around the shoulders of the arch rather than at the crown. Raising the catenary's scale flattens that gap until the two curves lie almost on top of one another — which is how the belief that the arch is a parabola survives — while lowering it pulls the shoulders further apart. Adjustable parameter: Catenary scale a (a) = 127.7 ft. Viewing window: x from -542.86 to 542.86, y from -20.71 to 650.71.
XYZ Graph · viewer build 5edf91b
The arch this section prints, y = 630(cosh(315/a) − cosh(x/a))/(cosh(315/a) − 1), against the parabola through the same two feet (x = ±315 ft) and the same 630 ft apex — so the slider changes nothing but the shape. Lebl's own constants put the arch 630 ft tall over a 630 ft span, and at a = 127.7 ft the catenary rides about 66 ft above the parabola near x = 228 ft, a tenth of the arch's height. Drag a down to 60 and the gap opens past 190 ft; drag it up to 600 and it closes to under 4 ft, since cosh u ≈ 1 + u²/2 once u is small. That last picture is why the popular belief survives — a flat enough catenary is a parabola to the eye. This one is not flat.

Adapted from Differential Equations for Engineers by Jiří Lebl (https://www.jirka.org/diffyqs/), © Jiří Lebl, licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.

These eBooks are a prerelease and are not yet certified conformant with WCAG 2.1 AA or ADA Title II. Every page is built against an automated accessibility gate, and the published editions will meet ADA Title II requirements when they release in late September 2026. If something is unusable, please tell us.