A Primer On Calculus
A Primer On Calculus
Fall 2019
1
2
Contents
1 Differentiation 3
1.1 Commonly Used Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Properties of Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Derivatives and Function Extrema . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Taylor Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Partial and Total Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.6 Generalization to Higher Dimensions . . . . . . . . . . . . . . . . . . . . . . 8
2 Integration 9
2.1 Commonly Used Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Properties of Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Techniques for Solving Integrals . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 Multi-Dimensional Integrals . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Differential Equations 12
3.1 Ordinary Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2 First-Order Linear Ordinary Differential Equations . . . . . . . . . . . . . . 15
3.3 Partial Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 A Practicality 16
3
Why calculus? Well, for a lot of reasons to be honest. Differentiation provides an approach to
determine maxima and minima of functions. Gradients, or rates of change as determined via
differentiation, can describe how physical quantities (e.g., energy) build up or are depleted
in systems. Integration can be used to determine the net effect of a physical process (via,
e.g., taking an integral over time), and is often used in statistical analysis to “average out”
the impact of some nuisance parameter (in a process known as marginalization). Finally,
differential equations are fundamental to how we describe systems. While many people claim
that differential equations are the language of the Universe, it is likely more proper to say
that differential equations are the language we use to describe the Universe.
1 Differentiation
The formal definition of the derivative of a single-parameter function relies on investigating
the behavior of this function at two nearby points as the distance between these two points
is allowed to shrink to zero. Let f (x) be our one-dimensional function, and then the (first)
derivative of this function (at location x) is defined by,
df f (x + ∆x) − f (x)
= lim , (1)
dx ∆x→0 ∆x
where it is common to see the simplified notation of,
df
f 0 (x) = . (2)
dx
What this formalism is actually doing is best described graphically. As shown in Figure 1,
the limit definition above describes the steepness (slope) of a line drawn from [x, f (x)] to
[x + ∆x, f (x + ∆x)]. So, as ∆x shrinks to zero, the derivative is measuring the local slope
of f (x) at location x.
Exercise
Use the limit definition of differentiation to evaluate the derivative of the exponential
function, ex , at x.
If the derivative of a function is another well-behaved function, then you can apply the
derivative operator a second time, thereby determining the second derivative. Here, one
writes,
d2 f d df
= = f 00 (x) . (3)
dx2 dx dx
In general, the nth derivative of a function is written as d n f /dxn , although in physics it is
rare to explore beyond a second derivative.
4
d
sin x = cos x , (5)
dx
d
cos x = − sin x , (6)
dx
d
tan x = sec2 x , (7)
dx
d
sec x = sec x tan x , (8)
dx
d
csc x = − csc x cot x , (9)
dx
d
cot x = − csc2 x , (10)
dx
d x
e = ex , (11)
dx
d x
a = ax ln a , (12)
dx
d 1
ln(x) = , (13)
dx x
d 1
loga (x) = . (14)
dx x ln a
5
d dg df
f (x) · g(x) = f (x) · + g(x) · . (16)
dx dx dx
For the product rule, it is often useful to remember, “first times the derivative of the second
plus second times the derivative of the first.”
The chain rule enables us to take derivatives of functions of functions, and is given by,
d df dg
= f 0 g(x) · g 0 (x) .
f g(x) = · (17)
dx dx g(x) dx
Finally, the quotient rule, which actually just follows from the product rule, states,
d f (x) g(x) df
dx
dg
− f (x) dx g(x)f 0 (x) − f (x)g 0 (x)
= = . (18)
dx g(x) g 2 (x) g 2 (x)
Regarding the quotient rule, it is often helpful to remember the phrase, “bottom times the
derivative of the top minus top times the derivative of the bottom all over bottom squared.”
Exercise
Investigate the derivative of ln x + ln a using two approaches. First, apply the distributive
property of differentiation. Second, use the additive properties of logarithms and then
apply the derivative.
Exercise
Investigate the derivative of ex · ea using two approaches. First, apply the product rule.
Second, use the multiplicative properties of exponentials and then apply the derivative.
6
Exercise
Investigate the derivative of ln ex using two approaches. First, apply the chain rule for
differentiation. Second, simplify the function and then apply the derivative.
Exercise
Investigate the derivative of sin x/ cos x using the quotient rule.
Exercise
Where are the local extrema of sin x? Which are minima and which are maxima?
7
Exercise
Take a chemical species in an atmosphere to have an opacity κ and a mass mixing ratio
µ. Assume the atmosphere is isothermal with constant pressure scale height H. Here,
then, the vertical optical depth (measured from the top of the atmosphere) is given by
τ (z) = µκHρ0 e−z/H = τ0 e−z/H , where z is altitude and ρ0 is the atmospheric mass density
at the surface. Given a source of flux at the top of the atmosphere (e.g., solar flux), the
shortwave flux density in this atmosphere is (roughly) given by F (z) = F0 e−τ (z) , where
F0 is the flux density at the top of the atmosphere. The heating rate (in terms of photon
energy deposited per unit volume per unit time) is then given by Q = dF/dz. Determine
the optical depth where the heating rate reaches a maximum. Can you give a physical
explanation for your finding?
df x − x0 d2 f (x − x0 )2
f (x0 ) + + 2 + ... , (22)
dx x0 1! dx x0 2!
or ∞
X dn f (x − x0 )n
. (23)
dxn x0 n!
n=0
Exercise
What are the first-order and second-order Taylor series expansions of ex around x = 0?
the automobile. Naively, you might expect that if the negotiated price increases by ∆c, then
the total cost of the car also increases by ∆c — this is the partial derivative. However, in
reality you might find that the cost to ship the car also depends on the negotiated price of
the car (e.g., maybe through additional insurance costs). The total derivative with respect
to negotiated car cost would incorporate both how the negotiated cost directly impacts your
total cost as well as how it indirectly impacts your total cost through shipping expenses.
Partial and total derivatives are related to one another in a somewhat simple way. For
a two-dimensional function f (x, y), the partial derivative with respect to x is written as ∂∂xf .
If y has some dependence on x, then the total derivative with respect to x is given by,
df ∂f ∂f dy
= + · . (24)
dx ∂x ∂y dx
Exercise
The gravitational potential for a point mass M is given by V (r) = −GM/r, where G is
the Universal gravitational constant. (Recall that gravitational potentials are negative to
indicate that orbiting bodies are bound — energy must be added to escape the gravitational
potential well.) Use the definition of the gradient in 3-D cartesian coordinates to explore
∇V . In what direction does the gradient point, and what is its magnitude?
9
2 Integration
Evaluating an integral is often described as “finding the area under a curve,” but what does
this mean? Take a single-variate function, f (x), and imagine a rectangle that extends from
x to x + δx along the horizontal, and from the horizontal axis (i.e., f = 0) to f (x) in the
vertical direction. The area of this rectangle is given simply by the length of its base along
the horizontal multiplied by its height, or f (x)δx, as depicted in Figure 2. The purpose of
an integral is to simply sum these infinitesimal areas across a range of x-values (for a definite
integral) or across an undefined range (for a indefinite integral).
Exercise
Consider Rthe function f (x) = x. Using the “area under the curve” definition of an integral,
x
evaluate 0 f (x) dx.
Integrals are also the opposite counterpart to a derivative. Specifically, integrals have the
property, Z b
df
dx = f (b) − f (a) , (27)
a dx
and Z
df
dx = f (x) + C , (28)
dx
where C is a constant. Why the constant? You will see this whenever an indefinite integral
is presented. Imagine taking the derivative of the equation above. The left-hand side yields
f 0 (x), and the right-hand side yields dxd
[f (x) + C] = f 0 (x) + 0. So, the two sides of the
original equation are identical to within a factor that is independent of x.
Z
cos x dx = sin x + C , (32)
Z
tan x dx = ln|sec x| + C , (33)
Z
cot x dx = ln|sin x| + C , (34)
Z
sec x dx = ln|sec x + tan x| + C , (35)
Z
ex = ex + C , (36)
ax
Z
ax = +C , (37)
ln a
Z
ln x = x ln x − 1 + C , (38)
Z
xex = (x − 1)ex + C . (39)
(Note that this rule works identically for indefinite integrals.) Put another way, if you notice
Rb
an integral happens to have the form a f g(x) g 0 (x) dx, for some arbitrary g(x), then the
Exercise
R
Use substitution to evaluate e2x dx.
Exercise
R
Evaluate dx/ a2 − x2 . Hint: Consider the substitution u = (x + a)/(x − a).
Exercise
R
Use integration by parts to evaluate tan x/ cos x dx. Hint: Consider using f = sin x and
take advantage of the useful derivatives provided above.
and Z Z Z Z
f dV = dcos θ dφ f (r, φ, θ)r2 dr . (52)
V
Here, for example, on a globe the angle φ would correspond to a measure of longitude (i.e.,
the azimuthal angle) while θ corresponds to a measure of latitude (i.e., the polar angle).
Exercise
Imagine a world whose atmospheric mass density follows ρ(r) = ρ0 exp −(r − Rp )/H ,
where ρ0 is the density at the surface, where r = Rp , and H is a scale height. What is the
total mass of the atmosphere?
3 Differential Equations
A differential equation, in short, relates some function to its derivatives. (An integro-
differential equations relates some function to its derivatives and integrals.) Differential
equations are ubiquitous across physics, astronomy, and planetary science. Do you want
solutions to motions in a gravitational potential? Well, Newton’s laws of motion will relate
13
how the momentum of a mass will change in time to its location within the potential —
so, the second derivative of position is related to position. Are you interested in how heat
diffuses or convects through a body or atmosphere? These physics can be described with a
differential equation.
Below, we emphasize two broad categories of differential equations: ordinary and par-
tial. For both categories, note that differential equations have an order which refers to the
highest-ordered derivative that appears within the expression. So, a differential equation
that contains a second derivative of an unknown function is called “second order.” Dif-
ferential equations (either ordinary or partial) are linear as long as the unknown function
and its derivatives are not raised to any power above unity (i.e., are linear in these quan-
tities). Finally, and in most practices, solutions to differential equations include (at least)
one unknown constant. Here, boundary conditions (or initial values) are used to determine
this/these constant(s).
Exercise
Solve dy/dt = t, which is an integration equation.
Exercise
The radiative transfer equation in an absorbing, non-scattering, non-emitting medium is
an “autonomous” ordinary differential equation given by dI/dτ = −I, where I is the beam
intensity and τ is optical depth. Solve this differential equation, and comment on what
the constant represents in the solution.
Separable ordinary differential equations can have the dependent and independent vari-
ables separated onto either side of the expression. These generally have the form,
dy
= f (t)g(y) . (58)
dt
Solutions are relatively straightforward, as we can simply re-arrange to find,
Z Z
1
dy = f (t) dt . (59)
g(y)
Note that both integration and autonomous differential equations are sub-sets of separable
equations. In my experience (at least), most differential equations in astronomy and plane-
tary science are not so conveniently structured as to be separable. Nevertheless, separable
equations provide an avenue to study the asymptotic behavior of systems (e.g., as t → ∞).
15
Exercise
Explore the solution of dy/dt = t/ (t0 + t) cos y at large times.
This gives,
dy
v + vP (t)y = vQ(t) , (62)
dt
where the left-hand side is simply equal to dvy/dt. We then have,
dvy
= vQ(t) , (63)
dt
which has the solution, Z
vy = v(t0 )Q(t0 ) dt0 + C , (64)
or, Z
1 C
y(t) = v(t0 )Q(t0 ) dt0 + , (65)
v(t) v(t)
where the prime symbol is meant to indicate the difference between the independent variable
(t) and the integration variable (t0 ).
Exercise
Show that dvy/dt = v dy
R
dt
+ vP (t)y, where v(t) = exp P (t) dt .
16
Exercise
The radiative transfer equation in an absorbing, non-scattering, emitting medium has the
form, dI/dτ = −I + B(τ ), where B(τ ) is the Planck function at location τ along the path.
Solve this first-order linear ordinary differential equation. Again, comment on the role of
the integration constant.
∂ ∂ 2T
T (x, t) = α 2 , (66)
∂t ∂x
where α is the thermal diffusivity of the medium (which can, in general, depend on both
position and temperature).
Real physical systems are complicated and, as a result, the partial differential equations
that describe the evolution of these systems are also quite complicated. Thus, and except-
ing cases where systems have been highly idealized (as is often the case in, e.g., textbook
demonstrations and homework questions), analytic solutions for the dependent quantities
seldom exist. In practice, then, solutions to partial differential equations are most often ex-
plored via numerical analysis. Boundary and initial conditions are specified, and numerical
applications of the partial differential equations that describe the system then enable us to
study time evolution.
Exercise
Qualitatively describe how you would numerically investigate the time-evolution of a one-
dimensional system undergoing heat diffusion.
4 A Practicality
One extremely useful (and powerful) tool for finding derivatives, performing integrals, and
solving differential equations is Wolfram Alpha. Many people — myself included! — turn
to this tool when stumped. That said, please do not take everything given to you by Wol-
fram Alpha as truth. Check the results from Wolfram Alpha by comparing against online
17
derivative or integral tables, or use the techniques described above to check the results. I
have had Wolfram Alpha tell me functions are not integrable when they actual are (through
a substitution trick) and I have also had Wolfram Alpha return useless answers to me when
it fails to interpret my input correctly. You don’t want to be the person who has to retract
a paper because you blindly trusted a website!