Calculus in Technical Documentation — Derivatives and Integrals

Master calculus notation in technical docs with KaTeX. Learn derivatives, integrals, limits, and differential equations for software, physics, and engineering documentation.

Introduction

Calculus is the mathematical foundation for describing change and accumulation. Whether you're documenting machine learning algorithms, physics simulations, financial models, or engineering systems, calculus notation appears everywhere in technical documentation.

This guide covers how to express derivatives, integrals, limits, and differential equations using KaTeX in your technical documentation. You'll learn the standard notation conventions and see practical examples from software engineering, physics, and data science.

Prerequisites
This guide assumes familiarity with basic KaTeX syntax. If you're new to KaTeX, start with our KaTeX Syntax Quick Reference first.

Derivatives

Derivatives measure the rate of change of a function. There are several notation styles, each suited to different contexts in technical documentation.

Leibniz Notation

Leibniz notation explicitly shows the variable of differentiation, making it ideal for physics and engineering documentation where multiple variables are involved.

Leibniz Notation

Standard derivative notation showing the variable of differentiation

First derivative:

dydx\frac{dy}{dx}dxdy

Second derivative:

d2ydx2\frac{d^2y}{dx^2}dx2d2y

nth derivative:

dnydxn\frac{d^n y}{dx^n}dxndny

Derivative of a specific function:

ddx(x3+2x)=3x2+2\frac{d}{dx}\left(x^3 + 2x\right) = 3x^2 + 2dxd(x3+2x)=3x2+2

Prime Notation (Lagrange)

Prime notation is compact and commonly used in pure mathematics and algorithm analysis where the independent variable is clear from context.

Prime Notation

Compact notation for derivatives

First derivative: f(x)f'(x)f(x)

Second derivative: f(x)f''(x)f′′(x)

Third derivative: f(x)f'''(x)f′′′(x)

Higher derivatives: f(n)(x)f^{(n)}(x)f(n)(x)

Example - velocity and acceleration:

Position: s(t),Velocity: s(t),Acceleration: s(t)\text{Position: } s(t), \quad \text{Velocity: } s'(t), \quad \text{Acceleration: } s''(t)Position: s(t),Velocity: s(t),Acceleration: s′′(t)

Dot Notation (Newton)

Dot notation is standard in physics for time derivatives, particularly in mechanics and dynamics.

Dot Notation

Time derivatives in physics notation

First time derivative: x˙\dot{x}x˙

Second time derivative: x¨\ddot{x}x¨

Newton's second law:

F=mx¨F = m\ddot{x}F=mx¨

Velocity and acceleration:

v=x˙,a=x¨v = \dot{x}, \quad a = \ddot{x}v=x˙,a=x¨

Operator Notation

The differential operator D is useful when discussing derivatives abstractly or in differential equations.

Operator Notation

Differential operator D

Differential operator:

D=ddxD = \frac{d}{dx}D=dxd

Applied to a function:

Df=dfdx,D2f=d2fdx2Df = \frac{df}{dx}, \quad D^2f = \frac{d^2f}{dx^2}Df=dxdf,D2f=dx2d2f

Linear differential equation:

(D2+3D+2)y=0(D^2 + 3D + 2)y = 0(D2+3D+2)y=0

Partial Derivatives

Partial derivatives are essential for documenting multivariable functions, which appear frequently in machine learning (gradient descent), physics (field equations), and optimization problems.

Partial Derivative Notation

Derivatives with respect to one variable while holding others constant

First partial derivatives:

fx,fy\frac{\partial f}{\partial x}, \quad \frac{\partial f}{\partial y}xf,yf

Second partial derivatives:

2fx2,2fy2\frac{\partial^2 f}{\partial x^2}, \quad \frac{\partial^2 f}{\partial y^2}x22f,y22f

Mixed partial derivatives:

2fxy\frac{\partial^2 f}{\partial x \partial y}xy2f

Example - gradient of a function:

f(x,y)=x2+xy+y2f(x, y) = x^2 + xy + y^2f(x,y)=x2+xy+y2 f=(fx,fy)=(2x+y,x+2y)\nabla f = \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right) = (2x + y, x + 2y)f=(xf,yf)=(2x+y,x+2y)

Subscript Notation

Subscript notation is a compact alternative commonly used in physics and engineering documentation.

Subscript Notation for Partials

Compact notation using subscripts

Partial derivatives:

fx=fx,fy=fyf_x = \frac{\partial f}{\partial x}, \quad f_y = \frac{\partial f}{\partial y}fx=xf,fy=yf

Second partials:

fxx=2fx2,fxy=2fxyf_{xx} = \frac{\partial^2 f}{\partial x^2}, \quad f_{xy} = \frac{\partial^2 f}{\partial x \partial y}fxx=x22f,fxy=xy2f

Heat equation example:

ut=αuxxu_t = \alpha u_{xx}ut=αuxx

Gradient, Divergence, and Curl

Vector calculus operators are fundamental in physics documentation, particularly for electromagnetic fields, fluid dynamics, and machine learning optimization.

Vector Calculus Operators

Gradient, divergence, curl, and Laplacian

Gradient (scalar to vector):

f=(fx,fy,fz)\nabla f = \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right)f=(xf,yf,zf)

Divergence (vector to scalar):

F=Fxx+Fyy+Fzz\nabla \cdot \vec{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}F=xFx+yFy+zFz

Curl (vector to vector):

×F=i^j^k^xyzFxFyFz\nabla \times \vec{F} = \begin{vmatrix} \hat{i} & \hat{j} & \hat{k} \\ \frac{\partial}{\partial x} & \frac{\partial}{\partial y} & \frac{\partial}{\partial z} \\ F_x & F_y & F_z \end{vmatrix}×F=i^xFxj^yFyk^zFz

Laplacian:

2f=2fx2+2fy2+2fz2\nabla^2 f = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} + \frac{\partial^2 f}{\partial z^2}2f=x22f+y22f+z22f

Integrals

Integrals represent accumulation and are used extensively in probability theory, physics, and signal processing documentation.

Indefinite Integrals

Indefinite Integrals

Antiderivatives without bounds

Basic indefinite integral:

f(x)dx\int f(x) \, dxf(x)dx

Power rule:

xndx=xn+1n+1+C(n1)\int x^n \, dx = \frac{x^{n+1}}{n+1} + C \quad (n \neq -1)xndx=n+1xn+1+C(n=1)

Exponential:

exdx=ex+C\int e^x \, dx = e^x + Cexdx=ex+C

Trigonometric:

sin(x)dx=cos(x)+C\int \sin(x) \, dx = -\cos(x) + Csin(x)dx=cos(x)+C
Spacing Tip
Always use \, before dx to add proper spacing: $\int f(x) \, dx$ looks better than $\int f(x) dx$.

Definite Integrals

Definite Integrals

Integrals with bounds

Definite integral:

abf(x)dx\int_{a}^{b} f(x) \, dxabf(x)dx

Fundamental theorem of calculus:

abf(x)dx=f(b)f(a)\int_{a}^{b} f'(x) \, dx = f(b) - f(a)abf(x)dx=f(b)f(a)

Area under a curve:

A=02x2dx=[x33]02=83A = \int_{0}^{2} x^2 \, dx = \left[\frac{x^3}{3}\right]_0^2 = \frac{8}{3}A=02x2dx=[3x3]02=38

Probability density:

P(aXb)=abf(x)dxP(a \leq X \leq b) = \int_{a}^{b} f(x) \, dxP(aXb)=abf(x)dx

Multiple Integrals

Multiple Integrals

Double and triple integrals

Double integral:

Df(x,y)dA\iint_D f(x, y) \, dADf(x,y)dA

Triple integral:

Vf(x,y,z)dV\iiint_V f(x, y, z) \, dVVf(x,y,z)dV

Iterated integral:

010xxydydx\int_{0}^{1} \int_{0}^{x} xy \, dy \, dx010xxydydx

Volume calculation:

V=Rf(x,y)dA=abcdf(x,y)dydxV = \iint_R f(x, y) \, dA = \int_{a}^{b} \int_{c}^{d} f(x, y) \, dy \, dxV=Rf(x,y)dA=abcdf(x,y)dydx

Line and Surface Integrals

Line and Surface Integrals

Integrals over curves and surfaces

Line integral (scalar):

Cfds\int_C f \, dsCfds

Line integral (vector):

CFdr\int_C \vec{F} \cdot d\vec{r}CFdr

Closed line integral:

CFdr\oint_C \vec{F} \cdot d\vec{r}CFdr

Surface integral:

SFdS\iint_S \vec{F} \cdot d\vec{S}SFdS

Closed surface integral:

SFdS\oiint_S \vec{F} \cdot d\vec{S}SFdS

Limits

Limits are foundational to calculus and appear in algorithm complexity analysis, convergence proofs, and asymptotic behavior documentation.

Limit Notation

Various limit expressions

Basic limit:

limxaf(x)\lim_{x \to a} f(x)xalimf(x)

One-sided limits:

limxa+f(x),limxaf(x)\lim_{x \to a^+} f(x), \quad \lim_{x \to a^-} f(x)xa+limf(x),xalimf(x)

Limit at infinity:

limx1x=0\lim_{x \to \infty} \frac{1}{x} = 0xlimx1=0

Limit definition of derivative:

f(x)=limh0f(x+h)f(x)hf'(x) = \lim_{h \to 0} \frac{f(x + h) - f(x)}{h}f(x)=h0limhf(x+h)f(x)

Limit definition of e:

e=limn(1+1n)ne = \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^ne=nlim(1+n1)n

Limits in Series

Series and Sequences

Limits in infinite series

Sequence limit:

limnan=L\lim_{n \to \infty} a_n = Lnliman=L

Infinite series:

n=1an=limNn=1Nan\sum_{n=1}^{\infty} a_n = \lim_{N \to \infty} \sum_{n=1}^{N} a_nn=1an=Nlimn=1Nan

Geometric series:

n=0rn=11r(r<1)\sum_{n=0}^{\infty} r^n = \frac{1}{1-r} \quad (|r| < 1)n=0rn=1r1(r<1)

Taylor series:

f(x)=n=0f(n)(a)n!(xa)nf(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^nf(x)=n=0n!f(n)(a)(xa)n

Differential Equations

Differential equations model dynamic systems and appear throughout physics, engineering, and computational science documentation.

Ordinary Differential Equations

ODEs

Ordinary differential equations

First-order ODE:

dydx=f(x,y)\frac{dy}{dx} = f(x, y)dxdy=f(x,y)

Second-order ODE:

d2ydx2+p(x)dydx+q(x)y=g(x)\frac{d^2y}{dx^2} + p(x)\frac{dy}{dx} + q(x)y = g(x)dx2d2y+p(x)dxdy+q(x)y=g(x)

Simple harmonic oscillator:

d2xdt2+ω2x=0\frac{d^2x}{dt^2} + \omega^2 x = 0dt2d2x+ω2x=0

Solution:

x(t)=Acos(ωt)+Bsin(ωt)x(t) = A\cos(\omega t) + B\sin(\omega t)x(t)=Acos(ωt)+Bsin(ωt)

Partial Differential Equations

PDEs

Partial differential equations

Heat equation:

ut=α2u\frac{\partial u}{\partial t} = \alpha \nabla^2 utu=α2u

Wave equation:

2ut2=c22u\frac{\partial^2 u}{\partial t^2} = c^2 \nabla^2 ut22u=c22u

Laplace equation:

2ϕ=0\nabla^2 \phi = 02ϕ=0

Schrödinger equation:

iΨt=22m2Ψ+VΨi\hbar \frac{\partial \Psi}{\partial t} = -\frac{\hbar^2}{2m}\nabla^2\Psi + V\PsiitΨ=2m22Ψ+VΨ

Applications in Technical Documentation

Here are practical examples of calculus notation in common technical documentation scenarios.

Machine Learning: Gradient Descent

Gradient Descent Algorithm

Optimization in machine learning

Gradient Descent Update Rule

The parameters θ\thetaθ are updated iteratively:

θn+1=θnαJ(θn)\theta_{n+1} = \theta_n - \alpha \nabla J(\theta_n)θn+1=θnαJ(θn)

where:

  • α\alphaα is the learning rate
  • J(θ)\nabla J(\theta)J(θ) is the gradient of the cost function

For a single parameter:

θn+1=θnαJθ\theta_{n+1} = \theta_n - \alpha \frac{\partial J}{\partial \theta}θn+1=θnαθJ

Cost Function Gradient

For mean squared error:

J(θ)=12mi=1m(hθ(x(i))y(i))2J(\theta) = \frac{1}{2m}\sum_{i=1}^{m}(h_\theta(x^{(i)}) - y^{(i)})^2J(θ)=2m1i=1m(hθ(x(i))y(i))2 Jθj=1mi=1m(hθ(x(i))y(i))xj(i)\frac{\partial J}{\partial \theta_j} = \frac{1}{m}\sum_{i=1}^{m}(h_\theta(x^{(i)}) - y^{(i)})x_j^{(i)}θjJ=m1i=1m(hθ(x(i))y(i))xj(i)

Physics: Kinematics

Kinematics Equations

Motion equations in physics

Position, Velocity, and Acceleration

Position as a function of time:

x(t)x(t)x(t)

Velocity (first derivative of position):

v(t)=dxdt=x˙v(t) = \frac{dx}{dt} = \dot{x}v(t)=dtdx=x˙

Acceleration (second derivative of position):

a(t)=dvdt=d2xdt2=x¨a(t) = \frac{dv}{dt} = \frac{d^2x}{dt^2} = \ddot{x}a(t)=dtdv=dt2d2x=x¨

Constant Acceleration

v(t)=v0+atx(t)=x0+v0t+12at2v2=v02+2a(xx0)\begin{aligned} v(t) &= v_0 + at \\ x(t) &= x_0 + v_0 t + \frac{1}{2}at^2 \\ v^2 &= v_0^2 + 2a(x - x_0) \end{aligned}v(t)x(t)v2=v0+at=x0+v0t+21at2=v02+2a(xx0)

Statistics: Probability Distributions

Probability Distributions

Continuous probability with integrals

Probability Density Function

For a continuous random variable XXX:

P(aXb)=abf(x)dxP(a \leq X \leq b) = \int_{a}^{b} f(x) \, dxP(aXb)=abf(x)dx

Normal Distribution

f(x)=1σ2πe(xμ)22σ2f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}f(x)=σ2π1e2σ2(xμ)2

Expected Value

E[X]=xf(x)dxE[X] = \int_{-\infty}^{\infty} x \cdot f(x) \, dxE[X]=xf(x)dx

Variance

Var(X)=E[X2](E[X])2=(xμ)2f(x)dx\text{Var}(X) = E[X^2] - (E[X])^2 = \int_{-\infty}^{\infty} (x - \mu)^2 f(x) \, dxVar(X)=E[X2](E[X])2=(xμ)2f(x)dx

Algorithm Analysis: Big O

Algorithm Complexity

Calculus in complexity analysis

Asymptotic Analysis

Big O notation using limits:

f(n)=O(g(n))    limnf(n)g(n)<f(n) = O(g(n)) \iff \lim_{n \to \infty} \frac{f(n)}{g(n)} < \inftyf(n)=O(g(n))nlimg(n)f(n)<

Summation to Integral Approximation

For large nnn:

i=1nf(i)1nf(x)dx\sum_{i=1}^{n} f(i) \approx \int_{1}^{n} f(x) \, dxi=1nf(i)1nf(x)dx

Example - sum of squares:

i=1ni21nx2dx=n33=O(n3)\sum_{i=1}^{n} i^2 \approx \int_{1}^{n} x^2 \, dx = \frac{n^3}{3} = O(n^3)i=1ni21nx2dx=3n3=O(n3)

Stirling's Approximation

n!2πn(ne)nn! \approx \sqrt{2\pi n}\left(\frac{n}{e}\right)^nn!2πn(en)n ln(n!)nln(n)n\ln(n!) \approx n\ln(n) - nln(n!)nln(n)n

Best Practices

Choose Notation Consistently
Pick one notation style (Leibniz, prime, or dot) and use it consistently throughout your document. Mix only when conventions demand it (e.g., dot notation for time derivatives in physics).
Use Display Math for Complex Expressions
Complex derivatives and integrals are much easier to read in display mode. Reserve inline math for simple expressions like $f'(x)$ or $\int f \, dx$.
Add Context and Definitions
Always define your variables. Write "where $x$ is position and $t$ is time" after introducing equations. This helps readers unfamiliar with your specific domain.
Use Aligned Environments for Multi-Step Derivations
When showing step-by-step calculations, use the aligned environment to align equals signs, making the logic flow clear.
Include Units Where Appropriate
In physics and engineering docs, include units using \text{}: $v = 10 \text{ m/s}$

Common Mistakes

Missing Spacing in Integrals
Always add \, before differentials. Write $\int f(x) \, dx$ not $\int f(x)dx$.
Incorrect Partial Derivative Symbol
Use \partial for partial derivatives, not d. Write $\frac{\partial f}{\partial x}$ not $\frac{df}{dx}$ for multivariable functions.
Forgetting Limits on Operators
Large operators need limits. Write $\lim_x \to 0$ not just $\lim$, and $\sum_i=1^n$ not just $\sum$.
Inconsistent Vector Notation
Choose one style for vectors: $\vec{v}$, $\mathbf{v}$, or bold. Don't mix them in the same document.
Missing Parentheses in Function Arguments
Write $\sin(x)$ not $\sin x$ when the argument is complex. This prevents ambiguity in expressions like $\sin(x+y)$.

Quick Reference

OperationKaTeX SyntaxResult
Derivative (Leibniz)\frac{dy}{dx}$\frac{dy}{dx}$
Derivative (Prime)f'(x)$f'(x)$
Partial Derivative\frac\partial f{\partial x}$\frac\partial f{\partial x}$
Gradient\nabla f$\nabla f$
Indefinite Integral\int f(x) \, dx$\int f(x) \, dx$
Definite Integral\int_{a}^{b} f(x) \, dx$\int_{a}^{b} f(x) \, dx$
Double Integral\iint_D f \, dA$\iint_D f \, dA$
Limit\lim_{x \to a} f(x)$\lim_{x \to a} f(x)$
Time Derivative\dot{x}, \ddot{x}$\dot{x}$, $\ddot{x}$
Laplacian\nabla^2 f$\nabla^2 f$

Related Content

Ready to Start?

Start creating beautiful technical documentation with AutEng.

Get Started with AutEng