Mathematics Cheat Sheet for Population Biology - Stanford University

**Mathematics** **Cheat** **Sheet** **for** **Population** **Biology**James Holland Jones,Department of Anthropological SciencesStan**for**d **University**April 30, 20081 IntroductionIf you fake it long enough, there comes a point where you aren’t faking it any more. Here aresome tips to help you along the way...2 CalculusDerivativeThe definition of a derivative is as follows. For some function f(x),f ′ f(x + h) − f(x)(x) = lim.h→0 h2.1 Differentiation RulesIt is useful to remember the following rules **for** differentiation. Let f(x) and g(x) be two functions2.1.1 Linearity**for** constants a and b.2.1.2 Product rule2.1.3 Chain ruleddx (af(x) + bg(x)) = af ′ (x) + bg ′ (x)ddx (f(x)g(x)) = f ′ (x)g(x) + f(x)g ′ (x)ddx g(f(x)) = g′ (f(x))f ′ (x)1

2.1.4 Quotient Ruled f(x)dx g(x) = f ′ (x)g(x) − f(x)g ′ (x)g(x) 22.1.5 Some Basic Derivativesddx xa = ax a−1d 1dx x a = −ax a+1ddx ex = e xddx ax = a x log addx log |x| = 1 x2.1.6 Convexity and ConcavityIt is very easy to get confused about the convexity and concavity of a function. The technicalmathematical definition is actually somewhat at odds with the colloquial usage. Let f(x) be atwice differentiable function in an interval I. Then:f ′′ (x) ≥ 0 ⇒ f(x) convex (1)f ′′ (x) ≤ 0 ⇒ f(x) concaveIf you think about a profit function as a function of time, a convex function would showincreasing marginal returns, while a concave function would show decreasing marginal returns.This leads into an important theorem (particularly **for** stochastic demography), known asJensen’s Inequality. For a convex function f(x),IE [f(X)] ≥ f(IE [X]).2.2 Taylor SeriesT (x) =∞∑k=0f (k) (a)(x − a) kk!where f (k) (a) denotes the kth derivative of f evaluated at a, and k! = k(k − 1)(k − 2) . . . (1).For example, we can approximate e r at a = 0:2

f(x)E[f(x)]=[f(A)+f(B)]/2f(E[x])=f([A+B]/2)AE[x]=(A+B)/2BxFigure 1: Illustration of Jensen’s Inequality.e r ≈ 1 + r + r22 + r36 . . .Expanding log(1 + x) around a = 0 yields:2.3 Jacobianlog(1 + x) ≈ x − x22 + x33 − . . .For a system of equations, F (x) and G(λ), the Jacobian matrix is( )∂F/∂x ∂F/∂λJ =.∂G/∂x ∂G/∂λThis is very important **for** the analysis of stability of interacting models such as those **for**epidemics and predator-prey systems. The equilibrium of a system is stable if and only if thereal parts of all the eigenvalues of J are negative.2.4 IntegrationLinearity∫∫[af(x) + bg(x)] dx = a∫f(x)dx + bg(x)dxIntegration by Parts∫∫u · v ′ dx = u · v −v · u ′ dx3

Some Useful Facts About Integrals∫ f ′ (x)dx = log |f(x)|f(x)∫x a dx = xa+1a + 1 , a ≠ −1∫e x dx = e x∫ dxx= log |x|2.5 Definite Integrals∫ baf(x)dx = [F (x)] b a= F (b) − F (a)2.5.1 ExpectationFor a continuous random variable X with probability density function f(x), the expected value,or mean, is∫IE(X) = xf(x)dxwhere the integral is taken over the set of all possible outcomes Ω.For example, the average age of mothers of newborns in a stable population:A B =∫ βαΩae −ra l(a)m(a)daSince (from the Euler-Lotka equation) the probability that a mother will be a years old in astable population is f(a) = e −ra l(a)m(a).Some Properties of ExpectationIE[aX] = aIE[X]For two discrete random variables, X and Y ,IE[X + Y ] = IE[X] + IE[Y ]4

2.5.2 VarianceFor a continuous random variable X with probability density function f(x) and expected valueµ, the variance is∫\V(X) = (x − µ) 2 f(x)dxA useful **for**mula **for** calculating variances:\V[X] = IE[X 2 ] − (IE[X]) 22.6 Exponents and LogarithmsΩProperties of Exponentialsx a x b = x a+bx ax b = xa−bx a = e a log xComplex Casee z = e a+bi = e a e bi = e a (cos b + i sin b)(x a ) b = x abx −a = 1 x aThe logarithm to the base e, where e is defined as(e = lim 1 + 1 ) nn→∞ nAssume that log ≡ log e . Logarithms to other bases will be marked as such. For example:log 10 , log 2 , etc.This is an important **for** demography:limn→∞(1 + r ) n= ernProperties of Logarithmslog x a = a log xlog ab = log a + log blog a b= log a − log b5

Imaginary(a,b) = a + birbθaRealFigure 2: Argand diagram representing a complex number z = a + bi.Complex Numbers We encounter complex numbers frequently when we calculate the eigenvaluesof projection matrices, so it is useful to know something about them. Imaginary number:i = √ −1. Complex number: z = a + bi, where a is the real part and b is a coefficient on theimaginary part.It is useful to represent imaginary numbers in their polar **for**m. Define axes where theabscissa represents the real part of a complex number and the ordinate represents the imaginarypart (these axes are known as an Argand diagram). This vector, a + bi can be represented bythe angle θ and the radius of the vector rooted at the origin to point (a, b). Using trigonometricdefinitions, a = r sin θ and b = r cos θ, we see thatz = a + ib = r(cos θ + i sin θ).Believe it or not, this comes in handy when we interpret the transient dynamics of a population.Let z be a complex number with real part a and imaginary part b,Then the complex conjugate of z isz = a + bi¯z = a − biNon-real eigenvalues of demographic projection matrices come in conjugate pairs.3 Linear AlgebraA matrix is a rectangular array of numbersA vector is simply a list of numbersA =[ ]a11 a 12a 21 a 226

⎡n(t) = ⎣⎤n 1n 2⎦n 3A scalar is a single number: λ = 1.05We refer to individual matrix elements by indexing them by their row and column positions.A matrix is typically named by a capital (bold) letter (e.g., A). An element of matrix A isgiven by a lowercase a subscripted with its indices. These indices are subscripted following thethe lowercase letter, first by row, then by column. For example, a 21 is the element of A whichis in the second row and first column.Matrix Multiplication[a11 a 12a 21a 22] [n1n 2]=Multiply each row element-wise by the columnFor Example,[ 2 34 5] [ 67]=[ ]a11 n 1 + a 12 n 2a 21 n 1 + a 22 n 2[ (2 · 6) + (3 · 7)(4 · 6) + (5 · 7)]=[ 3359Matrix Addition or Subtraction[ ] [ ] [ ]a11 a 12 b11 b+12 a11 + b=11 a 12 + b 12a 21 a 22 b 21 b 22 a 21 + b 21 a 22 + b 22[ 1 23 4]+[ 5 67 8]=[ 6 810 12Multiplying a Matrix by a Scalar[ ] [ ]a11 aλ12 λa11 λa=12a 21 a 22 λa 21 λa 224[ 2 34 5]=[ 8 1216 20]]]Systems of Equationseasier.Matrix notation was invented to make solving simultaneous equationsy 1 = ax 1 + bx 2In matrix notation:y 2 = cx 1 + dx 2[ ] [y1 a b=y 2 c d] [x1x 2]7

3.1 Eigenvalues and EigenvectorsA scalar λ is an eigenvalue of a square matrix A and w ≠ 0 is its associated eigenvector ifAw = λw.Eigenvalues of A are calculated as the roots of the characteristic equation,det(A − λI) = 0,where I is the identity matrix, a square matrix with ones along the diagonal and zeros elsewhere.For example, we can calculate the eigenvalues **for** the matrix,A =[f1 f 2p 1 0Solve the characteristic equation det(A − λI) = 0:[ ] [ ] [ ]f1 f(A − λI) = 2 λ 0 f1 − λ f− =2p 1 0 0 λ−λ].p 1det(A − λI) = −(f 1 − λ)λ − f 2 p 1Use the quadratic equation to solve **for** λ:λ 2 − f 1 λ − f 2 p 1 = 0−f 1 ± √ f 2 1 − 4f 2p 12f 1Numerical ExampleDefine:[ ] 1.5 2A =0.5 0[ ]1.5 − λ 2det(A − λI) =0.5 −λλ 2 − 1.5λ − 1 = 0(2)(λ − 2)(λ + 0.5) = 0The roots of this are λ = 2 and λ = −0.5. A k × k matrix will have k eigenvalues. If amatrix is non-negative, irreducible, and primitive, one of these eigenvalues is guaranteed to bereal, positive, and strictly greater than all the others.8

Analytic Formula **for** Eigenvalues: The 2 × 2 Case[ ] a bA =c dThe eigenvalues are:λ ± = T 2 ± √ (T/2) 2 − Dwhere T = a + d is the trace and D = ad − bc is the determinant of matrix A.9