Calculus Essentials Cheat Sheet

Derivatives, integrals, the chain rule, partial derivatives, gradients — the calculus toolkit every data scientist and ML engineer needs.

Last Updated: May 1, 2025

Derivatives

ItemDescription
Derivative: f'(x) = lim h->0 [f(x+h)-f(x)]/hInstantaneous rate of change — slope of tangent line
d/dx[x^n] = n*x^(n-1)Power rule — most common derivative
d/dx[e^x] = e^xExponential is its own derivative
d/dx[ln(x)] = 1/xNatural log derivative
d/dx[sin(x)] = cos(x)Trig derivative
d/dx[f(x)*g(x)] = f'(x)*g(x) + f(x)*g'(x)Product rule
d/dx[f(x)/g(x)] = (f'*g - f*g') / g^2Quotient rule
d/dx[f(g(x))] = f'(g(x)) * g'(x)Chain rule — differentiate outer, multiply by derivative of inner

Partial Derivatives & Gradients

ItemDescription
Partial: df/dx_i = derivative holding others constantFor multivariable functions — treat other variables as constants
Gradient: grad f = [df/dx1, df/dx2, ..., df/dxn]Vector of all partial derivatives — direction of steepest ascent
Gradient in MLThe gradient of loss w.r.t. weights tells us how to update each weight
Hessian = matrix of second partial derivativesCurvature information — used in Newton's method, slower but more precise
Jacobian = matrix of all first partials (m x n)For vector-valued functions — generalizes gradient to multiple outputs

Integrals

ItemDescription
Indefinite: Integral f(x) dx = F(x) + CAntiderivative — function whose derivative is f(x)
Definite: Integral_a^b f(x) dx = F(b) - F(a)Area under curve from a to b — Fundamental Theorem of Calculus
Integral of x^n = x^(n+1)/(n+1) + CPower rule for integration (n != -1)
Integral of 1/x = ln|x| + CNatural log — special case of power rule failure
Integration by Parts: Integral u dv = uv - Integral v duProduct rule reversed — useful for products of different function types
Integral of e^x = e^x + CExponential integrates to itself

ML Applications

ItemDescription
Backpropagation = Chain RuleGradient flows backward through computation graph using chain rule
Gradient Descent Update: w_new = w_old - lr * gradMove parameters opposite gradient direction by learning rate
MLE via derivative = 0Set derivative of log-likelihood to zero to find optimal parameters
KL Divergence involves integralsInformation theory heavily uses integration
Pro Tip: The gradient always points in the direction of steepest ascent. Gradient descent moves in the OPPOSITE direction (negative gradient) to find minima.