A Brief Calculus Primer: Derivatives, Integrals, and Differential Equations
Total Page:16
File Type:pdf, Size:1020Kb
A Brief Calculus Primer: Derivatives, Integrals, and Differential Equations Tyler D. Robinson Fall 2019 Copyright © 2019 Tyler D. Robinson. All rights reserved. 1 2 Contents 1 Differentiation3 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 Integration9 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 Figure1, 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, d2f d df = = f 00(x) : (3) dx2 dx dx In general, the nth derivative of a function is written as d nf=dxn, although in physics it is rare to explore beyond a second derivative. 4 1.1 Commonly Used Derivatives In practice, no enterprising physicist uses the limit definition of differentiation to take the derivative of a function. Instead, we all simply commit a handful of derivatives of key functions to memory (or look them up when we forget!). For your convenience, a decent list of useful derivatives is provided here: d cxn = ncxn−1 ; (4) dx 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 ex = ex ; (11) dx d ax = ax ln a ; (12) dx d 1 ln(x) = ; (13) dx x d 1 log (x) = : (14) dx a x ln a 5 1.2 Properties of Derivatives The basic derivatives given above, when paired with a few key rules of differentiation, will (nearly always) enable you to take the derivative of a complicated function. Here, the first important rule of differentiation, is that it is distributive, with, d df dg f(x) + g(x) = + ; (15) dx dx dx where g(x) is simply another function. Second, derivatives obey the product rule, with, 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 g(x) = · = f 0 g(x) · g0(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 − f(x) dg g(x)f 0(x) − f(x)g0(x) = dx dx = : (18) dx g(x) g2(x) g2(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. 1.3 Derivatives and Function Extrema When a function reaches a local minimum or maximum, it ceases to change at the point of the extremum. Or, put another way, the function has no slope. Thus, the zero points of the derivative of a function can be used to find where this function has its maxima and minima. Here, one uses the so-called first derivative test and simply finds the roots of, df = 0 : (19) dx How do we know if a root of the expression above is a local minimum or local maximum? We use the second derivative test, which simply states that, for f 0(x) = 0, the function has a local maximum if f 00(x) < 0 or a local minimum if f 00(x) > 0. How do we know this? Let's first investigate the definition of the second derivative, with, d f 0(x + ∆x) − f 0(x) f 0(x + ∆x) f 0(x) = lim = lim ; (20) dx ∆x!0 ∆x ∆x!0 ∆x where we have used the fact that f 0(x) = 0 in the last step. If f 00(x) > 0, then, for small ∆x, we have, f 0(x + ∆x) > 0 ; (21) ∆x which means that, for ∆x < 0 we have f 0(x+∆x) < 0 and for ∆x > 0 we have f 0(x+∆x) > 0. So, for a negative second derivative, f is decreasing when approached from the left and increasing when approached from the right | a local minimum. A diligent student can repeat this proof for a local maximum when f 00(x) < 0. 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 −z=H τ(z) = µκHρ0e = τ0e , 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 −τ(z) shortwave flux density in this atmosphere is (roughly) given by F (z) = F0e , 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? 1.4 Taylor Series In analysis it is often very useful to linearize the behavior of a function. A Taylor series enables this linearization, and actually extends to whatever higher-order term you desire. For a function that is infinitely differentiable, f(x), the polynomial expansion of this function around some point x0 is given by, df x − x d2f (x − x )2 0 0 f(x0) + + 2 + :::; (22) dx x0 1! dx x0 2! or 1 n n X d f (x − x0) : (23) dxn x n! n=0 0 Exercise What are the first-order and second-order Taylor series expansions of ex around x = 0? 1.5 Partial and Total Derivatives For multi-variate functions we sometimes need to know their derivative with respect to one variable while all other variables are held fixed, and we sometimes need to know their derivative with respect to one variable while including the response of all other variables to these changes. The former case is called a partial derivative and the latter is called a total derivative. As an example, imagine you are purchasing a car from a foreign country. The total cost of this car depends on the price you negotiate for the automobile as well as the cost to ship 8 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.