calculus_derivatives.txt (6496B)
1 CALCULUS NOTES: DERIVATIVES, NOTATION, AND GRADIENTS 2 ====================================================== 3 4 5 1. WHAT IS A DERIVATIVE? 6 ------------------------- 7 The derivative f'(x) describes the rate of change (the slope) of a 8 function f(x) at every point. If f'(x) = 5, the function is changing 9 by 5 units for every 1 unit that x changes. 10 11 12 2. THE d/dx NOTATION 13 --------------------- 14 d/dx is NOT multiplication. It is an operator -- an instruction 15 waiting for a function to act on, the same way sin( ) is an 16 instruction waiting for a number. 17 18 d/dx { f(x) } reads as: "take the derivative of f(x) with 19 respect to x" 20 21 Other equivalent notations for the same thing: 22 f'(x) Df(x) df/dx f-dot (for derivatives w.r.t. time) 23 24 d/dx(x) = 1 (plain x is x^1, so the power rule gives 1*x^0 = 1) 25 26 27 3. RISE-OVER-RUN -> THE FORMAL DEFINITION OF A DERIVATIVE 28 ----------------------------------------------------------- 29 Slope requires two points. Rise-over-run between two points on f(x): 30 31 m = (f(x + delta_x) - f(x)) / delta_x 32 33 This line through two points on the curve is called a SECANT line. 34 It is only an approximation of the true slope at a single point, 35 because it averages the slope across the whole gap. 36 37 To get the EXACT slope at one point, shrink the gap (delta_x) toward 38 zero. The secant line rotates into the TANGENT line -- the line that 39 touches the curve at exactly one point and matches its slope there. 40 (Note: a tangent line is not "perpendicular" to anything in general -- 41 that property is specific to circles, where a tangent is perpendicular 42 to the radius. For a general curve, tangent just means "matches the 43 curve's direction at that single point.") 44 45 This limiting process is the formal definition of the derivative: 46 47 f'(x) = lim (delta_x -> 0) of [f(x + delta_x) - f(x)] / delta_x 48 49 Every derivative rule (power rule, trig derivatives, etc.) is just 50 this limit, worked out once in advance for a given function so you 51 never have to redo it by hand. 52 53 54 4. THE POWER RULE (derived from rise-over-run) 55 ------------------------------------------------ 56 General rule: 57 d/dx (x^n) = n * x^(n-1) 58 59 Worked example for f(x) = x^2: 60 f'(x) = lim [(x+dx)^2 - x^2] / dx 61 = lim [x^2 + 2x*dx + dx^2 - x^2] / dx 62 = lim [2x*dx + dx^2] / dx 63 = lim (2x + dx) 64 = 2x (as dx -> 0, the leftover dx vanishes) 65 66 Same process for f(x) = x^3 gives f'(x) = 3x^2, matching the shortcut 67 3*x^(3-1) = 3x^2. 68 69 More examples: 70 d/dx(x^3) = 3x^2 71 d/dx(x^5) = 5x^4 72 d/dx(x^8) = 8x^7 73 d/dx(x^100) = 100x^99 74 75 76 5. RULES FOR COMBINING FUNCTIONS 77 ----------------------------------- 78 Sum rule: 79 d/dx(x^3 + x^2) = 3x^2 + 2x 80 81 Product rule (f times g): 82 d/dx[f(x)g(x)] = f'(x)g(x) + f(x)g'(x) 83 Example: d/dx[x^2 sin(x)] = 2x sin(x) + x^2 cos(x) 84 85 Quotient rule (f over g): 86 d/dx[f(x)/g(x)] = [f'(x)g(x) - f(x)g'(x)] / g(x)^2 87 Example: d/dx[x^2/(x+1)] = (x^2 + 2x) / (x+1)^2 88 89 Chain rule (a function inside another function): 90 d/dx[f(g(x))] = f'(g(x)) * g'(x) 91 Example: d/dx[(x^2+1)^5] = 5(x^2+1)^4 * 2x = 10x(x^2+1)^4 92 93 Combined example -- f(x) = x^2 * e^(3x) (product rule + chain rule): 94 d/dx(e^(3x)) = 3e^(3x) [chain rule on the inside] 95 d/dx[x^2 e^(3x)] = 2x*e^(3x) + x^2*3e^(3x) 96 = e^(3x)(2x + 3x^2) [product rule] 97 98 99 6. KNOWN DERIVATIVES TO MEMORIZE 100 ------------------------------------ 101 sin(x) -> cos(x) 102 cos(x) -> -sin(x) 103 e^x -> e^x (its own derivative) 104 ln(x) -> 1/x 105 106 WHY d/dx[sin(x)] = cos(x): 107 Using the angle-addition identity sin(x+dx) = sin(x)cos(dx) + cos(x)sin(dx), 108 the rise-over-run limit splits into two well-known limits: 109 lim (cos(dx)-1)/dx = 0 and lim sin(dx)/dx = 1 110 which leaves exactly cos(x). 111 112 Intuition: cos(x) is not a picture of a tangent line sitting on top of 113 sin(x) -- it is a completely separate curve. Its HEIGHT at each x 114 records the SLOPE of sin(x) at that same x. Wherever sin(x) is flat 115 (a peak/trough), cos(x) crosses zero. Wherever sin(x) is rising or 116 falling fastest, cos(x) is at its max or min. Every point on cos(x) 117 is the result of running the two-points-collapsing-into-a-tangent 118 process (section 3) at that x -- the full curve is just that 119 snapshot taken continuously across all x. 120 121 122 7. PARTIAL DERIVATIVES 123 -------------------------- 124 Once a function has more than one input, like f(x, y), "the slope" 125 is ambiguous -- it depends on which direction you move. A partial 126 derivative freezes every variable except one and differentiates 127 normally with respect to that one: 128 129 df/dx -- slope moving along x only, y held constant 130 df/dy -- slope moving along y only, x held constant 131 132 Example: f(x,y) = x^2 + y^2 133 df/dx = 2x 134 df/dy = 2y 135 136 137 8. THE GRADIENT 138 -------------------- 139 The gradient bundles ALL of a function's partial derivatives into a 140 single vector: 141 142 grad f = ( df/dx , df/dy ) 143 144 It is not a new calculation -- it is a packaging step. Geometrically, 145 the gradient vector points in the direction of steepest increase of 146 the function, and its length tells you how steep that climb is. 147 Visually, it is built by joining the df/dx component and the df/dy 148 component tip-to-tail (vector addition). 149 150 Partial derivatives = the ingredients (one number each). 151 Gradient = the finished vector made from all of them together. 152 153 154 9. NOTATION / PRONUNCIATION GUIDE 155 -------------------------------------- 156 d/dx "d, d x" -- ordinary derivative operator 157 partial (d/dx symbol looks like a rounded d) 158 "partial f, partial x" (read df/dx as "partial f partial x") 159 Symbol: the partial derivative sign. NOT a Greek letter -- 160 it's a stylized cursive "d". Easy to confuse with delta 161 because of the rounded shape, but it's a distinct symbol. 162 163 delta (Δ / δ) "delta" -- "a change in" something (e.g. Δx) 164 lambda (λ) "lambda" -- unrelated shape (angled/forked), 165 doesn't resemble partial or delta 166 167 nabla (∇) "NAH-blah" (also called "del") 168 Named after an ancient harp of similar shape. 169 Operator form: nabla = (d/dx, d/dy) -- attach it to a 170 function to get the gradient: nabla f = grad f. 171 Same symbol also appears (later topics) as: 172 nabla . F (divergence, a scalar) 173 nabla x F (curl, a vector)