Mathematics · Calculus · Autodiff
Calculus: Integrals, Derivatives and Tensor Operators
A detailed reference to integration, differentiation, Einstein notation, automatic differentiation, and integral operators, with assumptions and worked derivations.
On this page
Part of Immortal Machine · Mathematical Foundations
Composition produces chain rules. Products produce integration-by-parts identities. Pairings produce adjoints. These relationships organise much of the calculus behind learning systems, from elementary functions to tensor contractions and continuous operators.
This reference collects the formulas together with their assumptions, derivations, and failure cases. Start with the standard integration and differentiation methods, then follow the index notation into tensor derivatives, forward and reverse accumulation, and their integral-operator counterparts.
Contents
- Foundations and essential limits — Notation, limits, identities, series convergence and interchange rules.
- Integral calculus — Antiderivatives, substitution, integration by parts, partial fractions, trigonometric techniques, improper integrals, special integrals, tensor-valued integration, kernel operators, adjoints, functional Hessians and quadrature.
- Differential calculus — Derivative tables, implicit and logarithmic methods, higher derivatives, curves, extrema, Taylor expansions, Einstein notation, tensor derivatives, forward and reverse autodiff, mixed-mode derivatives and numerical differentiation.
- Multivariable vector and matrix calculus — Gradients, Hessians, constraints, multiple integrals, vector theorems, matrix derivatives and expectation gradients.
- Advanced connections — Differential equations, variational calculus, transforms, generalized derivatives, complex integration and Monte Carlo.
- Revision checklist and self test — Memorization map, error checklist, twenty-six revision problems, answers and references.
Foundations and essential limits
- F.1 Scope, notation and how to use the sheet
- F.2 Limits and continuity
- F.3 Algebra and trigonometry that make calculus easier
- F.4 Sequences, series and convergence
- F.5 When operations may be interchanged
F.1 Scope, notation and how to use the sheet
This is a broad revision reference for standard university calculus: single-variable integration and differentiation, limits and series, multivariable and vector calculus, and selected matrix, probability and variational extensions. It groups formulas with their hypotheses, recognition patterns and worked examples. Individual special-function tables, full differential-equation theory, complex analysis and measure theory each require their own references; the advanced appendix identifies their most useful connections.
For a fast revision pass: read the method-selection tables, the elementary derivative and antiderivative tables, the fundamental theorem, substitution, integration by parts, Taylor’s theorem, and the final error checklist. Then revise the worked examples without looking at their solutions.
For a deeper pass: derive substitution from the chain rule and integration by parts from the product rule; then extend them to tensor derivative maps, integral kernels, adjoints and boundary-integral identities. Sections I.16–I.22 and D.22–D.29 develop the continuous and discrete operator viewpoints using arbitrary index blocks before specializing to familiar arrays.
Conventions:
- Variables are real unless a complex transform is explicitly introduced.
- Trigonometric arguments are in radians. If is measured in degrees, differentiating introduces .
- denotes natural logarithm; has base , .
- is an arbitrary integration constant. On a disconnected domain, different connected intervals may have different constants.
- . A definite integral has a value, not an added arbitrary constant.
- is the th derivative, not the th power.
- means an inverse function; means a reciprocal. Avoid ambiguous notation.
- means the derivatives through order are continuous; means smooth of every order. Smoothness alone does not imply equality with a Taylor series.
- An identity is used on an interval where all its expressions are defined. Do not continue an antiderivative across a singularity without separately checking the integral.
- Gradients are column vectors. For , the Jacobian has shape .
- “Sufficient conditions” are convenient assumptions guaranteeing a result; they need not be the weakest possible assumptions.
The major correspondences
| Differentiation operation | Integration counterpart | Central identity |
|---|---|---|
| Linearity | Linearity | |
| Chain rule | Substitution | |
| Product rule | Integration by parts | |
| Derivative of accumulation | Fundamental theorem | |
| Multivariable chain rule | Change of variables | |
| Gradient, curl and divergence | Boundary integral theorems | Interior derivatives become boundary contributions |
| Differentiating a function | Varying a functional | Integration by parts produces the Euler–Lagrange equation |
F.2 Limits and continuity
Definitions
The statement means:
The value at may be undefined or different from . A two-sided limit exists exactly when the two one-sided limits exist and agree.
Continuity at requires all three:
At an endpoint, use continuity relative to the domain. Differentiability at an interior point implies continuity there; the reverse implication fails, for example for at .
If finite limits exist, sums and products pass through the limit. Quotients do so if the limiting denominator is nonzero. Continuous functions preserve limits.
Core limit tools
| Situation | First useful tool |
|---|---|
| Polynomial or continuous composition | Direct substitution |
| Rational | Factor, cancel on a punctured neighbourhood, then take the limit |
| Difference of radicals | Multiply by a conjugate |
| Oscillation multiplied by a vanishing factor | Squeeze theorem |
| Leading growth at infinity | Divide by the dominant term |
| or after inspection | Taylor expansion or L’Hôpital with its hypotheses |
| Variable power | Take logarithms on a positive domain |
| Several variables | Prove a uniform bound; paths can disprove a limit but a few agreeing paths cannot prove one |
Squeeze theorem: if near and both outer functions approach , then .
Standard limits and equivalent infinitesimals
As :
where is fixed and the real expression is defined.
Useful exponential limits:
For :
and as .
Equivalent infinitesimals may be substituted safely in products and quotients when the ratio argument is valid. Cancellation in sums or differences needs more terms. For example does not determine ; in fact
Big O, little o and asymptotic equivalence
As :
with ratios taken where defined. For example:
Two existence theorems to remember
Intermediate value theorem: a continuous function on takes every value between and .
Extreme value theorem: a continuous function on a compact interval attains a global maximum and minimum. An open interval or a discontinuous function does not automatically have this property.
F.3 Algebra and trigonometry that make calculus easier
These identities often do more work than a new integration technique.
Completing the square:
A square root of a square is an absolute value:
Logarithmic rules apply with their real domains:
Hyperbolic definitions and identities:
F.4 Sequences, series and convergence
A sequence converges if . A series converges if its partial sums converge. These are different questions.
Necessary condition: if converges, then . The converse fails: the harmonic series diverges.
| Test or series | Statement and conditions |
|---|---|
| Geometric | for |
| series | converges iff |
| Telescoping | Expand partial sums and keep the uncancelled endpoint terms |
| Direct comparison | : convergence of implies that of ; divergence of the smaller implies divergence of the larger |
| Limit comparison | and : both have the same convergence behaviour |
| Ratio | If , then gives absolute convergence, gives divergence, and is inconclusive |
| Root | With , gives absolute convergence, gives divergence, and is inconclusive |
| Integral test | If is positive, continuous and eventually decreasing and , then and have the same convergence behaviour |
| Alternating | If , then converges; the remainder magnitude is at most the first omitted |
| Dirichlet | If partial sums of are bounded and , then converges |
| Abel | If converges and is monotone and bounded, then converges |
| Cauchy condensation | For nonnegative decreasing , and converge or diverge together |
For a decreasing positive , the integral-test remainder after terms satisfies:
Absolute convergence means and implies convergence. A convergent series that is not absolutely convergent is conditionally convergent. Rearrangements of a conditionally convergent series need not preserve its sum.
Power series
For , the radius of convergence is
with the usual conventions and . Inside the series converges absolutely; outside it diverges. Check the endpoints separately.
Termwise differentiation and integration are valid strictly inside the radius:
The derived series have the same radius; endpoint convergence may change. Taylor coefficients and core Maclaurin series appear in the differential-calculus chapter.
F.5 When operations may be interchanged
Moving a limit, derivative, infinite sum or integral through another operation is a theorem application, not a purely algebraic move.
| Desired step | A useful sufficient hypothesis |
|---|---|
| Uniform convergence on with integrable | |
| on a measure space | Dominated convergence: almost everywhere and with |
| allowing | Monotone convergence: measurable |
| For example , or nonnegative terms using Tonelli | |
| On a compact interval, , converges at one point, and converges uniformly | |
| Differentiate an integral over a fixed domain | Measurability, integrability at a reference parameter, differentiability in the parameter, and a locally uniform integrable bound on its parameter derivative |
| Reverse the order of integration | Absolute integrability, or nonnegativity with extended values allowed |
| Swap mixed partial derivatives | Continuous second partial derivatives in a neighbourhood are sufficient |
Counterexample to an unchecked limit swap. Let for and otherwise on . Then at every point, but
Uniform convergence of functions alone does not permit differentiation. On , uniformly, while for every , differing from the derivative of the limit.
Integral inequalities worth remembering
Whenever the displayed integrals exist:
Cauchy–Schwarz:
Hölder, for with :
Minkowski, for :
Jensen, for convex and an integrable random variable for which the expectation is meaningful:
On with , this becomes
Integral calculus
- I.1 What an integral means
- I.2 Algebraic properties, bounds, and symmetry
- I.3 Standard antiderivative tables
- I.4 Substitution: reverse the chain rule
- I.5 Integration by parts: reverse the product rule
- I.6 Rational functions and partial fractions
- I.7 Trigonometric powers and products
- I.8 Radical substitutions and universal rationalization
- I.9 Reduction formulas
- I.10 Improper integrals and convergence
- I.11 Special functions and important definite integrals
- I.12 Differentiation under the integral sign
- I.13 Geometric and physical applications
- I.14 Numerical integration
- I.15 A method-selection checklist
- I.16 Tensor-valued integration and continuous contraction
- I.17 Integral operators: kernels, derivatives, and forward tangents
- I.18 Adjoint integral operators and reverse cotangents
- I.19 Nonlinear integrands, changing measures, and moving boundaries
- I.20 First variations, second variations, and functional Hessians
- I.21 Quadrature as a tensor contraction
- I.22 Integration by parts as an adjoint rule
I.1 What an integral means
An antiderivative of on an interval is a function satisfying . An indefinite integral denotes the entire family of antiderivatives:
The constant is essential: differentiation erases constants. On a disconnected domain, the constant may differ between connected components. For example, antiderivatives of on and can have different constants.
A definite integral is a number representing signed accumulation:
when this Riemann limit exists. A continuous function on a closed, bounded interval is Riemann integrable; bounded piecewise continuous functions are also integrable. Integrability does not require differentiability or even continuity everywhere.
For , the integral is area under the graph. For a sign-changing function, positive and negative contributions cancel:
Definite integration is more general than finding an elementary antiderivative. A function may have an integral and an antiderivative even when neither can be expressed using elementary functions.
Fundamental theorem of calculus
FTC, accumulation form. If is continuous on and
then for . At a discontinuity, the derivative need not equal the chosen point value of .
FTC, evaluation form. If is continuous on and , then
The basic cancellation identities are
under the preceding hypotheses. More generally, the second identity holds when is absolutely continuous, with interpreted almost everywhere; differentiability alone is not sufficient for every generalized version of the theorem.
Variable integration limits
For continuous and differentiable ,
Examples:
When the integrand also depends on , use the full Leibniz rule in §I.12.
I.2 Algebraic properties, bounds, and symmetry
Assume all displayed integrals exist; for inequalities take .
| Property | Formula |
|---|---|
| Linearity | |
| Reversed limits | |
| Zero interval | |
| Interval splitting | |
| Order preservation | |
| Constant bounds | |
| Integral triangle inequality | |
| Cauchy–Schwarz | |
| Average value |
Integral mean value theorem. If is continuous, some satisfies
Weighted version: if is continuous and is integrable with , then
for some . If the weight integral is zero, both sides are zero.
Symmetry shortcuts
For an integrable function on :
Reflection about the midpoint, sometimes called King’s property, gives
The name is informal; the identity itself is just the substitution .
Therefore
Useful consequences:
Another frequently useful reflection identity is
Require that the denominator is nonzero and the integrand is integrable throughout the interval, or that any exceptional points are removable and are handled appropriately. The reflected integrands add to .
On , reflection swaps sine and cosine:
For instance,
For a -periodic integrable function, ,
for a positive integer .
Warning: symmetry does not establish existence. The ordinary improper integral of over diverges, despite oddness.
I.3 Standard antiderivative tables
Every indefinite integral below has an additional . Arguments must lie in an interval on which the real-valued integrand is defined. Trigonometric arguments are in radians.
Powers, exponentials, logarithms
| Integrand | Antiderivative without | Conditions |
|---|---|---|
| , on a real differentiable branch | ||
The power law fails at because division by is undefined; the answer is logarithmic.
Trigonometric functions
| Integrand | Antiderivative without |
|---|---|
For , an antiderivative is when and . This scaling rule applies to every applicable table entry.
Hyperbolic functions
| Integrand | Antiderivative without |
|---|---|
Quadratics and inverse-function patterns
Take .
| Integrand | Antiderivative without | Real-domain note |
|---|---|---|
| All | ||
| All | ||
| All | ||
| Where the denominator is real and nonzero | ||
| All | ||
| All |
The absolute value in the inverse-secant-type formula prevents a common sign error on .
On , the logarithmic primitive of can also be written as . On , the primitive of can be written as . These inverse-hyperbolic forms have narrower real domains than the corresponding logarithmic forms.
Square-root primitives
For , on appropriate real intervals:
Integrals of inverse functions themselves
These follow by integration by parts with .
Reverse-chain-rule patterns: recognize these first
| Integrand | Antiderivative without |
|---|---|
| , | |
Each formula inherits the real-domain restrictions of its components.
I.4 Substitution: reverse the chain rule
If , then :
After integrating, replace by for an indefinite answer.
For a definite integral,
provided is continuously differentiable and is continuous on an interval containing the image of . This direct chain-rule identity does not require to be one-to-one. In contrast, when solving for as a function of , one must choose appropriate branches and split the interval if necessary.
Worked example — substitution and changed bounds
Worked example — a hidden derivative
Here and .
Useful substitutions beyond obvious inner functions:
| Structure | Candidate substitution |
|---|---|
| Rational function of | , |
| Rational function of divided by | |
| Fractional powers of | , with a common denominator |
| Homogeneous ratios involving and a quadratic radical | or a radical substitution |
| Symmetric interval expressions |
Common traps: changing but not every occurrence of ; retaining old bounds with a new variable; forgetting a chain-rule factor; treating as instead of .
I.5 Integration by parts: reverse the product rule
The product rule says
Integrating and rearranging gives
The definite version is
Continuous differentiability of is a simple sufficient condition. For improper endpoints, apply the identity on truncated proper intervals, then justify the limits; divergent terms cannot be canceled casually.
How to choose and
Choose so that differentiation simplifies it, and choose so that it can be integrated.
LIATE is a useful heuristic for choosing :
- Logarithmic functions.
- Inverse trigonometric functions.
- Algebraic functions.
- Trigonometric functions.
- Exponential functions.
It is not a theorem or a universal priority rule. The real criterion is whether the new integral is easier.
Worked example — algebraic times exponential
Therefore
Worked example — a function without an obvious product
Write :
The same trick handles inverse trigonometric functions.
Integrating an inverse function
If is invertible and differentiable on an interval, with , and , then
This follows by parts and the substitution . Here means the inverse function, not . An equivalent definite identity, with oriented limits, is
Repeated integration by parts and the tabular method
For , repeatedly differentiate and integrate . If and , then after steps,
When is a polynomial of degree , choosing eliminates the remainder.
For example,
The tabular method records the alternating signs , derivatives of the polynomial, and successive antiderivatives of the other factor.
Cyclic integration by parts
Some integrals return to themselves after two applications. Let
Integration by parts twice gives
Thus
The general formulas, for real with , are
Worked example — definite integral with an improper endpoint
For ,
because . The endpoint limit is part of the calculation.
I.6 Rational functions and partial fractions
A rational function is , where are polynomials.
Step 1: polynomial division. If , first write
Step 2: factor the denominator over the reals. Its factors are linear or irreducible quadratic.
Step 3: include every required term.
| Denominator factor | Partial-fraction terms |
|---|---|
| , irreducible | |
| , irreducible quadratic |
Multiply by the denominator and compare coefficients or substitute convenient values.
Worked example — repeated linear factor
Hence
Quadratic numerators: separate a derivative
For , , write
Then
Completing the square
This turns a quadratic denominator into an arctangent, logarithmic, or repeated-pole form.
Let :
These are valid on intervals avoiding denominator zeros.
Worked example
Every rational function has an elementary antiderivative consisting of a rational part, logarithms, and inverse tangents over the reals.
I.7 Trigonometric powers and products
Identities to keep ready
: nonnegative integer powers
| Case | Procedure |
|---|---|
| odd | Save one ; convert remaining sine powers using ; set |
| odd | Save one ; convert remaining cosine powers using ; set |
| Both even | Apply half-angle identities repeatedly |
| Both odd | Either substitution works; choose the shorter expansion |
Worked example
: nonnegative integer powers
| Case | Procedure |
|---|---|
| even and | Save , replace other by , set |
| odd and | Save , replace remaining by , set |
| Other cases | Rewrite with sine/cosine, use reduction, or integrate pure secant powers by parts |
Analogous rules apply to cotangent/cosecant, with
I.8 Radical substitutions and universal rationalization
For , these substitutions simplify quadratic radicals:
| Radical | Trigonometric substitution | Hyperbolic alternative |
|---|---|---|
| Usually use the trigonometric form | ||
| , |
Choose a range for the new variable that fixes signs. For example, with and , . For use a suitable negative branch; do not assume without checking the sign.
Worked example
Tangent half-angle substitution
For a rational function of and , set
Then
The integral becomes rational in . This is also called the Weierstrass substitution. It is a systematic fallback, though it may be longer than a tailored identity. Split definite intervals at singularities of the substitution; finite points of the original integrand can map to infinite .
Euler substitutions for a general quadratic radical
An expression rational in and can often be rationalized:
- If , set .
- If , set .
- If the quadratic has a real root , set on a suitable branch.
Squaring and canceling yields a rational expression for in . Retain the branch restrictions from the original unsquared equation; squaring alone can introduce invalid signs.
I.9 Reduction formulas
A reduction formula lowers an exponent or other parameter. The following indefinite recurrences are understood up to an additive constant.
Powers of sine and cosine
For integers ,
Base cases: , , .
Powers of tangent and secant
Base cases: , , , .
The corresponding cotangent and cosecant recurrences are
Hyperbolic powers
For integer ,
Polynomial times exponential
For integer and ,
Powers of logarithms
For and integer ,
More generally, for ,
Repeated quadratic denominators
For and integer ,
Wallis integrals
Let
Then
Thus, for ,
with . The double factorial multiplies integers with the same parity: .
I.10 Improper integrals and convergence
Improper integrals arise from infinite intervals or unbounded integrands. They are defined by limits of proper integrals.
Infinite endpoints
For a two-sided infinite interval, choose a finite and require both pieces to converge:
Singular endpoints and interior singularities
for a singularity at . If a singularity occurs at , split at and require both one-sided integrals to converge independently.
Essential -tests
Logarithmic refinements:
When with near a finite endpoint, compare with the finite-endpoint -test. When at infinity, use the infinity test.
Comparison tests
For eventually nonnegative functions:
- If and converges, then converges.
- If and diverges, then diverges.
- If near the improper endpoint, their integrals have the same convergence behavior.
Absolute versus conditional convergence
If is finite, then converges absolutely. If converges but diverges, convergence is conditional.
For example,
converges conditionally. Oscillation creates cancellation.
Dirichlet test. If remains bounded and is monotone with , then converges, under ordinary local integrability assumptions. A common sufficient formulation assumes is continuously differentiable.
Consequently, converges for every , and converges absolutely precisely for .
Cauchy principal value is a different notion
The ordinary improper integral diverges because its two one-sided pieces diverge. Principal value ties the cutoffs together; ordinary convergence does not.
I.11 Special functions and important definite integrals
Some elementary integrands have no elementary antiderivative. Standard examples include , , , and for generic . This is a statement about the permitted class of closed-form expressions, not about existence of the integral.
Gaussian integral
Completing the square yields
The error function records its antiderivative:
Gamma function
For real ,
Integration by parts gives
Rescaling gives the useful family
and more generally,
Beta function
For real ,
Equivalent forms:
A compact definite-integral bank
where the last is conditionally convergent.
For ,
This is a convergent cancellation within one integrand; the two separate integrals and diverge.
Other standard definitions:
At , is interpreted by its continuous extension, with value .
I.12 Differentiation under the integral sign
Let
Under conditions that justify exchanging differentiation and integration,
A convenient sufficient condition on a compact domain is continuity of and . For an improper integral, a standard sufficient condition is an integrable bound
uniformly for in a neighborhood, together with suitable existence and differentiability assumptions. Convergence at a single parameter value alone does not justify the exchange.
Leibniz rule with moving endpoints
For differentiable endpoints and a sufficiently regular integrand,
There are two boundary terms and one interior term.
Worked example — Feynman’s parameter method
Define, for ,
Differentiate:
Since as ,
Passing to gives the Dirichlet integral , with an additional convergence argument such as Abel’s theorem; simple dominated convergence by does not work.
I.13 Geometric and physical applications
Translate the geometry or physical law into a differential element first. The most reliable question is: what small amount am I summing?
Area
For on ,
If their order changes, split at intersections or use . Horizontal slices use right boundary minus left boundary:
For a polar region swept once, with suitable nonnegative radial bounds,
or .
Volume
Cross sections:
Disks/washers about a horizontal axis:
Cylindrical shells about a vertical axis:
where is distance to the axis and is shell height. Choose a slicing interval that does not count overlapping shells twice; a region crossing the axis often needs decomposition.
Arc length
For a continuously differentiable graph ,
For a regular parametrized curve,
For a polar curve,
These formulas count traversal length; retracing contributes again.
Surface area of revolution
For a sufficiently regular generating curve,
Rotating about the -axis gives
Geometric area without multiplicity requires checking that the parametrization does not cover the same surface repeatedly.
Motion, work, mass, and centroids
for a signed force along a one-dimensional displacement.
For a rod with linear density ,
For a uniform planar region between and with , area ,
For moment of inertia about a specified axis, integrate squared perpendicular distance:
Probability
For a probability density with ,
when the expectation is well-defined. A finite real expectation of a signed quantity requires absolute integrability.
For , integration by parts or Tonelli’s theorem yields the tail formula
allowing either side to be .
I.14 Numerical integration
Let , , and . For the stated midpoint/trapezoidal error bounds, assume ; for the Simpson bound, assume .
Riemann sums
If is increasing, ; reverse the inequalities if is decreasing.
Composite midpoint rule
If on ,
Composite trapezoidal rule
Under the same second-derivative bound,
It is exact for linear functions. Convex functions have and .
Composite Simpson rule
For even ,
If ,
It is exact for polynomials of degree at most . Without the required smoothness, these error bounds do not apply.
Gauss–Legendre quadrature
An -point Gauss–Legendre rule on chooses special nodes and weights :
and is exact for every polynomial of degree at most .
The two-point rule is
For , use
Practical choice: adaptive quadrature refines intervals according to estimated error. Singularities, discontinuities, and rapid oscillations should be exposed to the numerical method through splitting, transformations, or a specialized rule.
I.15 A method-selection checklist
| What you see | First method to try |
|---|---|
| A sum or constant multiple | Linearity; simplify algebra first |
| An inner function and its derivative | Substitution |
| A numerator proportional to a denominator’s derivative | Logarithmic substitution |
| Polynomial times exponential/trig | Repeated integration by parts |
| Logarithm or inverse trig by itself | Integration by parts with |
| or | Cyclic integration by parts or the standard formula |
| A rational function | Long division, then partial fractions |
| A quadratic denominator/radical | Complete the square |
| Integer powers of trig functions | Parity rules and identities |
| Rational function of | A tailored trig substitution; half-angle substitution as fallback |
| , , | Trigonometric or hyperbolic substitution |
| An exponent or parameter that can be lowered | Reduction formula |
| A symmetric definite interval | Check parity/reflection before integrating |
| A parameter inside an awkward definite integral | Differentiate under the integral sign |
| Infinite limits or a singularity | Establish convergence, then calculate |
| No useful elementary primitive | Special function, series, or numerical quadrature |
Final integration checks
- Differentiate the candidate antiderivative. This is the fastest correctness test.
- Restore for an indefinite integral.
- Check chain-rule factors and the sign from reversed limits.
- Retain where needed.
- Check real domains, singularities, and square-root branches.
- Split sign changes for area or distance.
- Split improper interior singularities and test both sides.
- Justify every exchange of a limit, derivative, infinite sum, or integral.
- Check units and positivity when the result represents a physical nonnegative quantity.
- Remember: a correct antiderivative on separate intervals does not make an integral across a pole converge.
I.16 Tensor-valued integration and continuous contraction
An integral can accumulate a scalar, a vector, a matrix, or a tensor with any finite collection of axes. The tensor shape does not change the definition: integrate its components and retain every axis that has not been contracted.
Index blocks and conventions
Let and denote finite index blocks. For example, might mean without repeatedly writing its three axes.
In these sections:
- A component label occurring twice in a product is summed over its complete block. A label occurring once is free and must match the output.
- Continuous variables such as are integrated only when an integral is written.
- A written summation explicitly binds its index; it does not create an additional implicit sum.
- Tensors and pairings are real unless stated otherwise. Complex adjoints require conjugation.
- Measure spaces are -finite, and kernels are jointly measurable, wherever Fubini and kernel-operator statements are used.
- Every exchange of an integral, derivative, or integration order requires the stated integrability or regularity conditions.
For a measurable tensor field with , define
Since there are finitely many components, this is equivalent to integrating every scalar component. In any fixed finite-dimensional norm,
What commutes with an integral?
A fixed linear map or tensor contraction commutes with integration:
This includes fixed permutations of axes, traces, projections, and multiplication by a fixed matrix. It does not include arbitrary nonlinear operations:
in general. A coefficient depending on the integration variable must remain inside the integral.
If depends on a parameter , it can still leave a -integral, but differentiation must also act on :
Here the measure is fixed and differentiation under the integral is justified.
Fubini is the rule for rearranging continuous contractions
If
Fubini’s theorem gives
Thus finite index sums and absolutely integrable continuous contractions may be reordered. For nonnegative scalar integrands, Tonelli permits reordering even when the value is infinite. Signed conditionally convergent integrals require separate analysis.
With a product measure and integrable factors,
The distinct variables are essential. An integral of a same-variable product, , generally does not factor.
I.17 Integral operators: kernels, derivatives, and forward tangents
An integral operator combines a tensor contraction with integration over an input coordinate:
identify the output; are the contracted input indices and coordinate. A matrix product is the corresponding construction on a finite set with counting measure.
Function spaces and a sufficient boundedness condition
Take
These are square-integrable fields whose values have the indicated finite tensor shapes. If the kernel is square integrable,
then is bounded and
This Hilbert–Schmidt condition is sufficient, not necessary. The identity on a continuous domain, for example, is bounded but is generally represented by a distributional delta kernel rather than a square-integrable function.
The kernel is the functional derivative
For a perturbation ,
Consequently,
The dot denotes a directional perturbation here, not necessarily time. This is the continuous Jacobian–vector product.
With the convention
the derivative kernel is
For fields, pointwise identities are interpreted almost everywhere. The bounded-operator identity is the rigorous statement; point evaluation itself is not a bounded functional on an arbitrary space.
If both and vary while the measures stay fixed,
This is the product rule under an integral, with every input axis accounted for.
A variable upper limit gives a Volterra operator
For
assume , , and are continuous on the appropriate compact interval and triangular domain. Then the derivative with respect to the coordinate is
This coordinate derivative is distinct from the derivative with respect to the input field . It is precisely the earlier Leibniz rule with tensor-valued integrands.
I.18 Adjoint integral operators and reverse cotangents
The forward and reverse constructions here are differentiation through an integral-valued map. There is no separate universal pair of “forward integration” and “reverse integration” methods corresponding to forward- and reverse-mode differentiation. An antiderivative, an inverse operator, and an adjoint are different objects.
Declare the pairings before taking an adjoint
Use the real pairings
The adjoint is defined by
Expand the left side and exchange integration order:
Therefore,
The output and input roles exchange: the adjoint integrates over with , and returns a field on with . For complex fields under the usual Hermitian pairings, replace in this formula by .
Pulling back a scalar loss
If
then
For a family of output objectives indexed by , the same contraction acts independently on that retained index:
For fixed measures and parameterized , the scalar parameter derivative is
The index is free in this equation. Measure or domain dependence adds the terms in §I.19.
For the simpler reduction , a finite measure makes the map bounded from to the finite output tensor space. Its adjoint broadcasts the output cotangent:
Indeed, . The constant field lies in because the measure is finite. On an infinite-measure domain, integration is not generally a bounded functional on all of ; the admissible space must be changed or a square-integrable weighting introduced.
Worked example: the adjoint of accumulation
On with Lebesgue measure, let
Its pullback is a tail integral:
Equivalently, with terminal condition . This backward accumulation is the adjoint of this particular operator; it is not its inverse.
Changing the inner product changes the represented gradient. With positive-definite matrix weights , the weighted adjoint is
provided the weights and their inverses define the required bounded mappings. The underlying derivative and dual pullback remain the same; their representation by gradient fields depends on the pairing.
I.19 Nonlinear integrands, changing measures, and moving boundaries
Nonlinear tensor integral maps
Consider
Define the local tensor derivative
Assume the chosen function spaces and domination conditions make differentiable with the displayed bounded derivative. Smooth bounded fields on compact domains with finite measures, and suitable uniform bounds on the integrand derivatives, provide a standard setting. Pointwise differentiability alone does not establish Fréchet differentiability on an arbitrary function space.
Then
The nonlinear map is linearized first; its derivative kernel is then transposed through the pairing. If a second derivative exists,
For example, with a bounded kernel on finite-measure domains, integrating a quadratic tensor feature gives
Here contracts the input tensor’s squared norm, while remains an output block. Direct expansion gives
The integral is linear in the quadratic feature but nonlinear in . Its second derivative is
These formulas follow from the expansion of , without treating integration itself as a nonlinear operation.
A parameter-dependent density
On a fixed domain with ,
has derivative
For a positive probability density on a fixed support, this becomes
The second term accounts for changing probability weights. Under the same interchange assumptions,
These score identities require care when the support changes with .
Moving domains retain a boundary contribution
For a smoothly moving domain , let be its boundary velocity when changes, and let be the outward unit normal. The transport rule is
The coordinate index is summed. The interior derivative holds the spatial coordinate fixed. For a weighted integral, apply this identity to .
This is the multidimensional version of the earlier endpoint terms. For example, , , gives
Differentiating only the interior density produces and misses the boundary’s .
Alternatively, map a fixed reference domain into and differentiate the transformed integrand together with its Jacobian determinant. This connects moving-domain differentiation directly to change of variables.
I.20 First variations, second variations, and functional Hessians
For a Fréchet-differentiable scalar functional , its first variation in direction is
The derivative must be a bounded linear functional of under the chosen norm; existence of every directional limit alone does not establish this. On the chosen Hilbert space, its Riesz representation is
For a twice Fréchet-differentiable functional, the second variation is the bilinear form
For a twice continuously Fréchet-differentiable functional, this form is symmetric. A Hessian operator represents it as .
Local integral functionals
For
under the required differentiation and boundedness assumptions,
The Hessian acts pointwise. A functional with interactions between different coordinates instead produces a nonlocal Hessian.
Quadratic interaction kernels: symmetry must exchange both blocks
On one common domain and tensor space, let
Assume defines a bounded operator and its double-integral and adjoint exchanges are justified; a square-integrable kernel is sufficient. Take and define
Expanding gives
Only the self-adjoint part contributes to a real quadratic form. Kernel symmetry means
not merely . Symmetry alone does not establish positive semidefiniteness or convexity.
Worked quadratic objective: an integral observation model
Let and
Its gradient and Hessian-vector product are
The data-term Hessian kernel is
It satisfies , and
The term is the identity part of the operator; it need not be forced into an ordinary integral kernel.
Nonlinear least squares: what Gauss–Newton omits
For , set and . Then
The corresponding Hessian-vector product is
Gauss–Newton retains the first term. It is positive semidefinite and is exact at zero residual or when is affine. In general, the residual-weighted second derivative is part of the exact Hessian.
I.21 Quadrature as a tensor contraction
Quadrature replaces a continuous integration coordinate by a weighted finite axis. Assume the fields have well-defined values at the quadrature nodes; arbitrary equivalence classes do not supply point samples.
For nodes and weights ,
Writing exposes a weighted reduction:
With ordinary Euclidean pairings on the finite arrays,
In the second identity, is contracted while is retained.
Nodes and weights can also depend on parameters
If the rule has smoothly varying nodes and weights,
The middle derivative holds the node coordinate fixed; the last term accounts for node motion. Only is implicitly summed, while is explicitly summed and are free.
This differentiates the quadrature approximation. Identifying its result with the exact derivative of the original integral requires an additional convergence argument. A rule that changes its node count or subdivision pattern discontinuously is not covered by the smooth fixed-rule formula.
Euclidean and quadrature-weighted adjoints are different representations
Discretize the integral operator as
After flattening each retained tensor block only for notation, write
where and output weights give .
Under Euclidean pairings,
If all weights are positive, they also define the inner products
The adjoint under these pairings is
Thus , with
The input weight disappears from the represented weighted adjoint because the input pairing already contains it. It has not disappeared from the derivative.
For example, if , its gradients with respect to are
Quadrature rules with zero or negative weights do not define these positive-definite inner products; their Euclidean pullbacks still exist.
Tensor-product rules and separability
On a product domain with product measure,
Using nodes per coordinate gives combinations. Writing the expression as a tensor contraction does not remove this cost.
If a field has an exact separable representation
and every factor belongs to , then termwise absolute integrability and Fubini give
This reduces integration to one-dimensional factors. The benefit depends on obtaining a sufficiently small rank ; arbitrary high-dimensional integrands need not have such a representation.
I.22 Integration by parts as an adjoint rule
The elementary formula transfers a derivative from one factor to another. In operator notation, that transfer constructs a differential operator’s adjoint.
The derivative’s adjoint includes boundary conditions
For sufficiently regular tensor fields on ,
The formal adjoint of is . An actual Hilbert-space adjoint also specifies domains and boundary conditions. The boundary term must vanish for every admissible pair, as under suitable zero-endpoint or periodic conditions.
For a differential operator with spatially varying coefficients,
its real formal adjoint is
Here is an explicitly summed derivative multi-index. Derivatives act on the coefficients as well as on . Green’s identities are the multidimensional versions of this calculation, with boundary flux replacing the endpoint term.
Weighted adjoints and Stein’s identity
For ,
Thus, when the boundary pairing vanishes,
With a probability density and admissible test function , setting yields
This is a Stein identity. On an unbounded domain, the required boundary decay and integrability are substantive conditions. The spatial score here is distinct from the parameter score in §I.19.
Variational derivatives with spatial derivatives
For
integration by parts gives
With fixed boundary values, admissible variations satisfy there. The interior coefficient is the Euler–Lagrange expression. Free boundary values instead produce natural boundary conditions. On a Sobolev space, the derivative initially belongs to its dual; identifying it with an gradient requires sufficient regularity.
Continuous adjoints for an accumulated ODE objective
Let a tensor state satisfy
and take a fixed terminal time :
Assume a well-posed differentiable solution map and sufficiently smooth data. Write . Integration by parts transfers the state-variation derivative onto an adjoint field:
All coefficients are evaluated along the forward trajectory. The parameter gradient is
Commas with denote explicit parameter derivatives with the state held fixed. The initial-condition term is necessary whenever the initial state depends on the parameter. A varying terminal time requires its own boundary contribution.
This is the adjoint of the continuous model. Differentiating a discretized time-stepping map gives a discrete adjoint; the two procedures need not produce identical finite-resolution gradients.
Connections and primary references
The seven sections above reuse the same core operations: linearity, Fubini, Leibniz differentiation, change of variables, integration by parts, and the chain rule. Tensor notation records retained and contracted axes; the measure and pairing determine continuous accumulation and its adjoint.
- Bright, Edelman, and Johnson, Matrix Calculus (for Machine Learning and Beyond): derivatives as linear maps, ODE sensitivities, and functionals; see the linked MIT lecture notes and readings.
- Steven G. Johnson, Notes on Adjoint Methods: adjoint sensitivity calculations and the role of forward and adjoint solves.
- Harrell and Herod, Geometry and Integral Operators: integral kernels, pairings, and adjoint operators.
- Gilbert Strang, Calculus of Variations: weak and strong variational equations connected by integration by parts.
Differential calculus
- D.1 Definition, meaning, and notation
- D.2 Algebraic differentiation rules
- D.3 Standard derivative table
- D.4 Chain-rule patterns to recognize immediately
- D.5 Inverse-function differentiation
- D.6 Implicit differentiation
- D.7 Logarithmic differentiation and variable exponents
- D.8 Higher derivatives and Leibniz’s rule
- D.9 Parametric and polar curves
- D.10 Tangents, normals, and local differentials
- D.11 Related rates
- D.12 Mean value theorems
- D.13 L’Hôpital’s rule and indeterminate limits
- D.14 Monotonicity, extrema, and concavity
- D.15 Taylor’s theorem and error bounds
- D.16 Core Maclaurin expansions
- D.17 Asymptotic notation and small-angle equivalents
- D.18 Optimization workflow and Newton’s method
- D.19 Numerical differentiation
- D.20 Technique-selection table
- D.21 High-frequency mistakes to avoid
- D.22 Tensor derivatives and Einstein index notation
- D.23 Derivative tensors, gradients, and the tensor chain rule
- D.24 Forward mode, reverse mode, and computational graphs
- D.25 Local tensor derivative rules
- D.26 Worked example: indexed least squares, forward and backward
- D.27 Higher derivatives and mixed-mode automatic differentiation
- D.28 Softmax and attention as tensor differentiation examples
- D.29 Choosing a differentiation mode and checking the result
D.1 Definition, meaning, and notation
The derivative at is
provided the limit is finite. Equivalent notation includes
For a time variable, and .
The most useful interpretation is local linear approximation:
The remainder satisfies . Thus the derivative is the coefficient of the best first-order local approximation, as well as the tangent slope and instantaneous rate of change.
One-sided derivatives
At an interior point, exists exactly when these are finite and equal. At a domain endpoint, a one-sided derivative is often the appropriate object.
Differentiability and continuity
The converse fails: is continuous at but has left derivative and right derivative . A corner, cusp, vertical tangent, or discontinuity can prevent a finite derivative. An infinite slope is not a finite derivative under the usual definition.
A differentiable function need not have a continuous derivative. The notation means that derivatives through order exist and are continuous; means this holds for every finite order. Smoothness alone does not imply equality with a Taylor series.
Piecewise functions and junctions
At a joining point , first compare the one-sided function limits with the assigned value . If continuity fails, ordinary differentiability already fails. If continuity holds, compute the one-sided difference quotients using the actual value at the junction. Matching formulas for derivatives away from the junction is not a substitute for this check.
For example, defining for and for gives , although the second one-sided derivatives at zero differ. The resulting function is continuously differentiable but not twice differentiable at zero. Conversely, replacing the second branch by makes the function discontinuous at zero, regardless of the derivatives away from zero.
D.2 Algebraic differentiation rules
Let be constant and let be differentiable functions of .
| Rule | Formula | Condition |
|---|---|---|
| Constant | — | |
| Identity | — | |
| Linearity | constant | |
| Product | Both differentiable | |
| Reciprocal | ||
| Quotient | ||
| Chain | Appropriate differentiability | |
| Power of a function | Real power defined and differentiable | |
| Product of many factors | No division by a factor required |
The last formula remains valid even where one of the factors vanishes. Its logarithmic version, , requires nonzero factors.
Higher derivatives of a composition
If , then
Do not square the chain rule: the term in the second derivative is essential.
For completeness, the general chain rule is Faà di Bruno’s formula:
This is useful for symbolic higher derivatives; for ordinary revision problems, the first three chain formulas are usually sufficient.
D.3 Standard derivative table
Powers, exponentials, and logarithms
| Function | Derivative | Domain notes |
|---|---|---|
| For arbitrary real , use ; integer/rational powers can have larger domains | ||
| All real | ||
| ; no derivative at |
For a differentiable nonzero ,
The power rule needs attention at zero. For example, is real on all of , but its usual derivative formula is finite only away from ; is differentiable everywhere.
Trigonometric functions
| Function | Derivative | Excluded points |
|---|---|---|
| None | ||
| None | ||
If an angle is expressed in degrees, an additional factor appears when differentiating with respect to its numerical degree value.
Inverse trigonometric functions
Use the usual principal branches, with
and .
| Function | Derivative | Where the derivative is finite |
|---|---|---|
| All real | ||
| All real | ||
The absolute value in the arcsecant and arccosecant derivatives matters. Some references choose different inverse-function branches; state a convention when comparing formulas.
Also, conventionally denotes , whereas . Write when ambiguity is possible.
Hyperbolic functions
| Function | Derivative |
|---|---|
and are undefined at zero.
Inverse hyperbolic functions
| Function | Derivative | Real domain for the displayed derivative |
|---|---|---|
| All real | ||
Useful logarithmic identities are
These are particularly useful for recognizing antiderivatives involving radicals.
D.4 Chain-rule patterns to recognize immediately
Every standard table entry becomes a family of formulas by replacing with and multiplying by :
For a nested composition, differentiate the outside, preserve the inside, and multiply by the derivative of each successive inside.
Worked example 1 — Nested differentiation
For
there are three layers: logarithm, square of sine, and . Hence
The logarithm is defined for all real because its argument is at least .
D.5 Inverse-function differentiation
If , , and , then
Under the usual local inverse-function assumptions, differentiating again gives
In the notation of inverse variables,
provided and an appropriate local inverse exists. The second derivative is not the reciprocal of the original second derivative.
For example, is invertible, but ; its inverse has no finite derivative at zero. Invertibility alone does not guarantee a differentiable inverse everywhere.
D.6 Implicit differentiation
For a relation , apply the chain rule to every occurrence of :
If ,
If , differentiating once more gives
This is a local formula along the selected branch. If in a neighborhood of a point satisfying , the condition at that point guarantees a local continuously differentiable solution by the implicit function theorem.
Worked example 2 — A circle
For ,
Differentiating again,
so
Both expressions require . At , the curve has a vertical tangent; it is more convenient locally to regard as a function of .
D.7 Logarithmic differentiation and variable exponents
For a product, quotient, or variable power, taking a logarithm can turn a difficult derivative into a sum of simpler derivatives.
If
with constant exponents and positive bases, then
For nonzero real factors where the original powers make sense, and often extend the method.
For a variable base and variable exponent, assume and write
Then
Using only the ordinary power rule here would omit the term.
Worked example 3 —
For ,
Thus
The same method gives
on intervals where .
D.8 Higher derivatives and Leibniz’s rule
Define and .
The generalized product rule is
For three or more factors, use the corresponding multinomial sum.
Standard th derivatives
For unless otherwise stated:
where the real power is defined and differentiable. For a polynomial with nonnegative integer , derivatives of order are identically zero, including at .
For and ,
More generally,
and, with on a suitable domain,
where is the rising factorial, with .
For example,
D.9 Parametric and polar curves
Parametric derivatives
If and , with , then
Primes on here mean derivatives with respect to .
The speed is
At a regular point, where this speed is nonzero, the unsigned curvature is
For a graph this reduces to
The radius of curvature is when .
Worked example 4 — Parametric curve
Take . For ,
At , both coordinate derivatives vanish, so the direct quotient formulas do not apply. Limits and the geometry of the two branches must be examined separately.
Polar derivatives
For ,
Writing ,
when the denominator is nonzero. For second derivatives, apply the parametric formula with parameter .
The polar arc-speed factor and curvature are
at regular points. The numerator without its absolute value is a signed curvature for the chosen orientation.
D.10 Tangents, normals, and local differentials
At , if the derivative is finite, the tangent line is
If , the normal line is
A horizontal tangent has a vertical normal. A regular vertical tangent has a horizontal normal. A zero derivative does not by itself determine whether the graph crosses its tangent or lies on one side.
Differential versus finite change
For a small input increment ,
is a linear approximation to , not generally the exact finite change:
If on the segment between and , then
For example, for small .
Error propagation
For a small perturbation ,
If and ,
The factor is a local relative condition number. It measures how relative input errors can be amplified by the mathematical function, independently of the algorithm used to evaluate it.
D.11 Related rates
- Write a geometric or physical relation valid throughout the motion.
- Identify all quantities that depend on time.
- Differentiate with respect to time before substituting instantaneous values.
- Substitute the given measurements and rates.
- Check units and signs.
For ,
Worked example 5 — Expanding sphere
For ,
If and , then
The factor changes with time; substitute only after deriving the relation.
D.12 Mean value theorems
Rolle’s theorem
If is continuous on , differentiable on , and , then some satisfies
Lagrange’s mean value theorem
If is continuous on and differentiable on , then some satisfies
The average slope equals an instantaneous slope somewhere inside the interval.
Cauchy’s mean value theorem
If are continuous on and differentiable on , then some satisfies
If the relevant denominators are nonzero, this becomes
The cross-multiplied version is the more general statement.
Frequently used consequences
- If everywhere on an interval, is constant on that interval.
- If on an interval, is nondecreasing; implies strictly increasing. Strict increase does not require at every point: is a counterexample.
- If on an interval, then there.
- If on an interval, is constant there. On a disconnected domain, different components may have different constants.
- Derivatives have the intermediate value property (Darboux’s theorem), even when they are discontinuous. A derivative cannot have a jump discontinuity.
D.13 L’Hôpital’s rule and indeterminate limits
For a limit of producing or , one useful sufficient version of the theorem assumes:
- and are differentiable in the relevant punctured one-sided neighborhood;
- there;
- the original ratio has one of the stated indeterminate forms;
- exists, finite or infinite.
Then, under these hypotheses,
The rule applies to one-sided limits and to limits at infinity. For a two-sided limit, both sides must give the same result. “” includes the appropriate signed infinite versions.
This is a theorem about limits, not a differentiation identity for quotients. The quotient rule remains .
Other indeterminate forms
| Form | Typical transformation |
|---|---|
| Rewrite or | |
| Combine fractions, rationalize, or factor before applying a ratio theorem | |
| Let , study , then exponentiate | |
| Use the same logarithmic transformation on a positive-base domain | |
| Use the same logarithmic transformation | |
| , | Direct candidates, after checking hypotheses |
Repeated application is permitted only if the new ratio still satisfies the hypotheses. If the derivative ratio fails to have a limit, this does not prove that the original limit fails to exist.
Worked example 6 — A second-order limit
The form is , and after one differentiation it is still :
A Taylor expansion gives the same answer because .
D.14 Monotonicity, extrema, and concavity
Critical numbers and stationary points
A critical number is an interior point in the domain where or does not exist. A stationary point specifically has .
Fermat’s theorem: if has a local maximum or minimum at an interior point and is differentiable there, then .
The converse fails: has but no extremum at zero. Nondifferentiable extrema are possible, as for at zero. At constrained endpoints, a nonzero one-sided slope can coexist with an extremum.
First derivative sign test
Assume continuity at and differentiability on neighboring punctured intervals.
| Sign of as passes through | Conclusion |
|---|---|
| Strict local maximum | |
| Strict local minimum | |
| or | No local extremum under the stated sign pattern |
Second derivative test
If and the required second derivative exists,
Examples of the inconclusive case are (minimum), (maximum), and (neither).
Higher derivative test
Suppose is sufficiently smooth near and
If is even, a positive gives a strict local minimum and a negative value a strict local maximum. If is odd, there is no local extremum. If every derivative vanishes, this test gives no conclusion.
Concavity and inflection points
On an interval, implies concave up, and implies concave down. Under suitable smoothness, characterizes convexity and characterizes concavity.
Under the usual definition, an inflection point is a point where is continuous and the graph changes concavity. Solving only identifies candidates. A point where does not exist may also be an inflection candidate.
For , but the graph is concave up on both sides: no inflection. For , concavity changes at zero.
Absolute extrema on a closed interval
If is continuous on , it attains an absolute maximum and minimum. Evaluate it at:
- all interior critical numbers;
- the endpoints .
Compare the values. For an open or unbounded domain, inspect boundary limits and behavior at infinity; extrema need not be attained.
D.15 Taylor’s theorem and error bounds
The degree- Taylor polynomial about is
Maclaurin means .
Lagrange remainder
If has sufficient smoothness, for example on the interval joining and , then
for some strictly between and when .
If throughout that segment,
The bound needs control over the entire segment, not just the value of the next derivative at .
Integral remainder
Under the corresponding continuity assumptions,
Peano form
For near ,
This is often the cleanest form for local asymptotic reasoning.
Taylor series versus Taylor polynomial
The infinite Taylor series represents only where as . Having derivatives of every order does not guarantee this.
A standard example is
Every derivative at zero is zero, so its Taylor series there is identically zero, although for .
Worked example 7 — Approximation with a certified bound
For , the quadratic approximation at zero gives
Since , we have on . Therefore
The cubic correction improves the approximation further, but the displayed estimate already has a rigorous error bound.
D.16 Core Maclaurin expansions
| Function | Expansion | Real interval of convergence and equality |
|---|---|---|
| All real | ||
| All real | ||
| All real | ||
| All real | ||
| All real | ||
| At least ; see endpoint rules below |
Here
If is a nonnegative integer, the binomial series terminates and is a polynomial valid for every real . Otherwise, for real :
- At , it converges to when ; convergence is absolute for and conditional for .
- At , it converges when , then sums to ; it diverges for .
For frequently needed leading terms,
A power series may be differentiated or integrated term by term strictly inside its radius of convergence. The resulting series has the same radius, but endpoint convergence can change.
For alternating series whose term magnitudes decrease to zero, the error after truncation is at most the magnitude of the first omitted term. Check the decreasing-term condition for the specific value of .
D.17 Asymptotic notation and small-angle equivalents
As :
- means near , for some fixed .
- means .
- means , where the ratio is defined.
As ,
Equivalent expressions can usually replace one another in products and quotients, but not blindly inside a cancellation. Replacing both and by inside would erase the actual leading term .
At infinity, for any fixed and positive ,
Changing variables can reduce many apparently complicated limits to these standard forms.
D.18 Optimization workflow and Newton’s method
One-variable optimization workflow
- Identify the quantity to maximize or minimize.
- Express it using one variable and record the feasible domain.
- Differentiate and find interior critical points.
- Check endpoints, singularities, and limiting behavior.
- Establish local or global optimality using sign, convexity, or value comparisons.
- Return the answer in the original variables and units.
Worked example 8 — A global minimum
Minimize on .
The unique critical point is . The derivative is negative on and positive on , so it is the global minimum:
The domain restriction matters; the same objective on has different global behavior.
Newton–Raphson root finding
The tangent-line approximation to at has a zero at
For a simple root , with , , and suitable smoothness, sufficiently close initial points give local quadratic convergence:
This is a local guarantee. Farther away, Newton’s method may diverge, cycle, or leave the function’s domain; a zero or tiny derivative is problematic.
If a root has known multiplicity , the modified iteration
can restore quadratic local convergence under the usual smoothness assumptions.
To seek a stationary point, apply Newton to :
This seeks a zero of the derivative; it does not by itself guarantee convergence to a minimum.
D.19 Numerical differentiation
For a smooth function and small :
| Scheme | Approximation | Truncation error order |
|---|---|---|
| Forward first difference | ||
| Backward first difference | ||
| Central first difference | ||
| Central second difference | ||
| Five-point first difference |
For sufficiently smooth , the leading errors of the central schemes are
Very small reduces truncation error but can amplify floating-point roundoff and cancellation. For well-scaled problems with unit-roundoff , rough balances give for a forward first derivative, for a central first derivative, and for a central second derivative. Actual choices depend on input/output scales, derivative sizes, noise, and evaluation accuracy.
If a central estimate has an expansion , Richardson extrapolation cancels the leading error:
This improves truncation accuracy for smooth functions; it does not remove measurement noise or floating-point limitations.
Complex-step differentiation
If has a suitable analytic complex extension and its implementation supports that extension,
has truncation error and avoids subtracting two nearly equal real values. Operations such as absolute value, clipping, and branches that discard imaginary parts can invalidate this method.
Automatic differentiation
Automatic differentiation applies the chain rule to the operations in a computational graph. It avoids a finite-difference step-size approximation, but floating-point errors, nondifferentiable operations, and conventions at branch boundaries still require attention.
D.20 Technique-selection table
| What you see | First method to try |
|---|---|
| A sum of standard functions | Linearity and the derivative table |
| A function inside another function | Chain rule |
| A product of functions | Product rule; logarithmic differentiation for many nonzero factors |
| A quotient | Simplify first, then quotient rule if useful |
| A variable exponent | Write |
| An implicit relation | Differentiate the relation; solve for |
| A local inverse | Reciprocal derivative formula with a nonzero derivative |
| Coordinates depending on a parameter | Parametric derivative formulas |
| A polar curve | Convert to parametric |
| A limit with cancellation | Taylor expansion or algebraic simplification |
| A ratio of type or | L’Hôpital after checking hypotheses |
| A local approximation or error estimate | Linearization or Taylor’s theorem |
| A maximum/minimum on a closed interval | Interior critical points plus endpoints |
| A general th derivative of a product | Leibniz’s rule |
| A root available only numerically | Newton with a convergence check or a bracketed method |
| A derivative of numerical black-box output | Finite differences, complex step if valid, or automatic differentiation if supported |
D.21 High-frequency mistakes to avoid
- Missing an inner derivative: .
- Multiplying derivatives for a product: .
- Dividing derivatives for a quotient: .
- Treating as a constant-exponent power: differentiate both the base and the exponent.
- Dropping domain restrictions: , inverse functions, and fractional powers require explicit attention.
- Losing absolute values: for both positive and negative .
- Applying L’Hôpital to a non-indeterminate ratio: check the original limiting form first.
- Confusing with a minimum or maximum: it supplies a candidate.
- Confusing with an inflection point: verify a concavity change.
- Ignoring nondifferentiable critical points or endpoints: either can contain an extremum.
- Assuming every smooth function equals its Taylor series: the remainder must vanish.
- Using a truncated Taylor series outside its useful range without an error bound.
- Substituting instantaneous values before taking a related-rates derivative.
- Treating as exact for nonlinear functions.
- Letting a numerical differentiation step become arbitrarily small: roundoff and noise can dominate.
- Canceling differential symbols indiscriminately: chain-rule manipulations have precise differentiability and nonzero-denominator conditions.
Minimal memory core
If revising under time pressure, first reproduce these from memory:
Then rebuild less familiar formulas from these rules and the standard derivative table.
D.22 Tensor derivatives and Einstein index notation
A derivative is a linear map that describes how an input perturbation changes an output. Scalars, vectors, matrices, and higher-order arrays use the same definition; only the number of component indices changes. This section works with real-valued arrays and independent entries, using the Euclidean or Frobenius inner product. Complex derivatives and derivatives on constrained manifolds require additional conventions.
Free indices, dummy indices, and contractions
Under strict Einstein summation, an index appearing twice in one product term is summed over its range. An index appearing once is free and must match a free index on the other side of the equation.
Here is free and is a dummy summation index. Renaming a dummy index does not change the expression:
Matrix multiplication and the Frobenius inner product become
Every index in the scalar inner product is summed. In a valid contraction, a dummy index has one consistent dimension and normally appears exactly twice per product term. An index appearing three times is ambiguous under this convention; use explicit summation or rewrite the contraction.
Important exceptions must be declared. Elementwise multiplication is
or, more clearly, . Likewise, normally means the trace; extracting a diagonal vector requires with no sum over .
All indices here are Euclidean component labels. This is not the covariant/contravariant convention of differential geometry; the placement of an index above or below a symbol does not itself change its transformation law in this chapter.
Batch indices are not automatically contraction indices
For batched matrix multiplication, write
where the parenthesized labels a fixed batch member and is not summed. Equivalently,
Writing the sum explicitly prevents accidental summation over the batch axis.
Array-library einsum notation is more flexible than strict Einstein notation because its output labels explicitly identify retained axes. For example, bi,bj->bij retains and forms a separate outer product for each batch member; it does not sum over . An einsum expression specifies a contraction, not an automatic derivative by itself.
Kronecker delta and identity derivatives
The Kronecker delta is
It acts as the identity: . For independent entries,
The second formula has four free indices. It is the identity linear map on matrices, represented as a four-axis derivative array.
Terminology: tensor order means the number of axes. It is different from matrix rank and from tensor-decomposition rank.
D.23 Derivative tensors, gradients, and the tensor chain rule
Output axes first, then input axes
Let , with
Use multi-indices and . Define
Its shape is
This is the convention output axes, then input axes. Flattening the output and input turns it into an ordinary Jacobian, where and .
The differential contracts the input axes:
Repeated multi-indices mean summation over every constituent index. More fundamentally, differentiability requires
where is linear in . The derivative tensor is a coordinate representation of that linear map; a program usually does not need to construct the full tensor.
A gradient is the derivative representation for a scalar objective
For ,
Thus has the same shape as . For a matrix,
A tensor-valued generally has a Jacobian, not one unique gradient. To obtain a gradient, first specify a scalar objective, such as
with fixed . Different output weights give different scalarizations and therefore different gradients.
Tensor chain rule
For and ,
The intermediate axes contract. The output axes and input axes remain free. If a node depends on several parents, its total differential contains one term for every parent; all paths from an input to the output contribute.
An index block is an ordered tuple of axes, not necessarily one vector dimension. For example, can collect two batch or spatial axes while collects three feature axes. Writing sums over their Cartesian product. Grouping axes changes the notation, not the underlying derivative.
Independent entries versus symmetric parameters
The identity assumes all entries are independent. If is constrained, its perturbations must also be symmetric. For an ambient gradient ,
If independent upper-triangular parameters set both and , an off-diagonal parameter receives , while a diagonal parameter receives . These are different parameterizations of the same constraint; do not apply a universal factor of two without specifying which entries are independent.
D.24 Forward mode, reverse mode, and computational graphs
Automatic differentiation, or AD, applies derivative rules to the mathematical operations in a computation. It is different from finite differences: there is no perturbation step size to choose. For smooth supported operations, it computes chain-rule derivatives up to floating-point arithmetic effects. It is also different from requiring a simplified symbolic formula for the whole function.
Forward mode: propagate input tangents
Choose an input perturbation and write . Forward mode propagates
This is a Jacobian-vector product, or JVP. In tensor language, the “vector” can be any tangent array having the input shape. It returns the directional output change, with the output shape.
Along a composition,
Forward mode evaluates each operation’s primal value and tangent as the computation proceeds. A scalar example is
Reverse mode: propagate output cotangents
Choose an output weight , written . Reverse mode propagates
This is a vector-Jacobian product, or VJP. With column-vector conventions it is ; row-vector notation writes . For general arrays it is the adjoint derivative map
The defining identity is
Retaining every axis of a downstream tensor
No scalar output is required to state the chain rule. Suppose a downstream observable is a tensor , and retain its complete derivative
Propagation through gives
The observable block remains free throughout. This is a family of pullbacks, one for each observable component, rather than one scalar-objective gradient. Contracting with a fixed output weight gives a single cotangent:
Keeping all observable axes is useful when deriving a kernel’s full derivative structure. Computing all those sensitivities still carries the corresponding number of output seed directions; representing them in a single tensor does not remove that cost.
Scalar reverse differentiation as a special case
For scalar , seed . The resulting input cotangent is . For a multi-output function, a single VJP gives one weighted combination of Jacobian rows; it does not automatically give the entire Jacobian.
Backpropagation is reverse-mode AD applied to a computational graph. It propagates cotangents in reverse topological order. Every outgoing use of a variable contributes to its cotangent, so contributions must be added.
Worked graph: reuse requires accumulation
Consider
Initialize every cotangent to zero except the seed . The sum contributes and . Reversing contributes
Now . Reversing contributes along both appearances of :
Therefore
Overwriting a previous contribution would lose one or more paths.
Fixed cotangents and scalarization
The identity treats as independent of . If is itself differentiated, the product rule adds another term:
This distinction becomes essential for higher derivatives. A fixed external seed should remain fixed; genuine dependence inside the objective must remain part of the differentiated computation.
D.25 Local tensor derivative rules
Each local rule has a forward linearization and a reverse adjoint. The latter can be derived by moving the input perturbation to the right side of a Frobenius inner product.
Arbitrary contraction blocks
Let denote disjoint ordered index blocks. A bilinear contraction can be written
Only contracts; label the output. Its linearization and pullback are
In the first reverse rule contracts; in the second contracts. These formulas hold for arbitrary numbers of axes inside each block. Ordinary matrix multiplication is the case of one axis per block. Independent batch axes can be retained as additional fixed labels; a shared factor receives sums over all its uses.
Elementwise functions and products
For applied entrywise,
Componentwise, for vector input,
The Jacobian is diagonal after flattening. For of equal-shaped arrays,
Broadcasted operands additionally require the reverse reductions described below.
Matrix multiplication
For , where and ,
The local derivative entries are
From ,
In indices,
If both operands are the same square matrix, , add both contributions:
The factors cannot generally be reordered. For a scalar , this reduces to , not unless is symmetric.
Transpose, permutation, reshape, and reduction
| Operation | Forward tangent | Reverse cotangent |
|---|---|---|
| Permute axes | Apply the same permutation | Apply the inverse permutation |
| Reshape without changing entry correspondence | Reshape the tangent identically | Reshape back to the input shape |
| Sum along an axis | Sum the tangent along that axis | Broadcast the cotangent along the reduced axis |
| Mean over entries | Mean of their tangents | Broadcast the cotangent and divide by |
| Broadcast to a larger shape | Broadcast the tangent | Sum over axes introduced or expanded by broadcasting |
For ,
For , where and the bias is shared across rows,
Reduction and broadcasting are adjoint operations. A reduction in the forward computation is a broadcast in reverse; a broadcast forward is a reduction in reverse.
Batched multiplication and shared parameters
For each fixed batch member ,
the matrix-product rules apply independently. If the same matrix is shared instead,
then
The batch sum is required because all batch members depend on the same parameter entries. Weight tying, recurrent reuse, and convolution kernels follow this same accumulation principle.
For a gather operation with fixed integer indices ,
Repeated gathered indices accumulate their contributions. The formula differentiates the gathered values, not the discrete index choices.
D.26 Worked example: indexed least squares, forward and backward
Let
with . Define residuals and a mean quadratic loss:
Here is the all-ones vector, making the bias broadcast explicit. In the residual expression, are free and is summed. In the loss, both and are summed.
Full differential
Constant inputs simply have zero perturbation. The derivative tensor with respect to has shape :
This explicitly separates the residual’s output feature axis from the parameter’s output feature axis .
Forward mode for a parameter direction
Hold fixed and seed . Then
This is one directional derivative of the loss. A single arbitrary does not recover every entry of .
Reverse mode from the scalar loss
Seed . First,
The product, broadcast, and subtraction rules give
The target derivative is relevant only if is treated as a differentiable variable. In components,
The forward/reverse consistency check is
With fixed, the Hessian action on is
It has the same shape as and can be evaluated without constructing a Hessian array.
D.27 Higher derivatives and mixed-mode automatic differentiation
Second derivative tensors
For tensor-valued ,
with shape
Its bilinear action is
For scalar and matrix input , the Hessian has four axes:
If , exchanging the two input-index blocks leaves the Hessian unchanged:
This does not say : exchanging the two coordinates inside a matrix index is a different operation. Derivative symmetry also does not imply that the input matrix itself is symmetric.
Forward-over-forward: contract two input blocks, retain the output
For fixed tangents , differentiate one JVP along the other direction:
This nested forward construction retains every output axis and contracts both derivative-input blocks. For a smooth scalar , the result is the bilinear quantity ; for tensor-valued , it has the same shape as . As with the mixed constructions below, the direction seeds remain fixed.
Forward-over-reverse: differentiate the gradient in a direction
For , compute using reverse mode, then take a JVP of :
This is forward-over-reverse AD. It obtains a Hessian-vector product, or HVP, without materializing the Hessian.
Reverse-over-forward: differentiate a directional derivative
For a fixed , first compute
Then reverse-differentiate this scalar:
The equality to uses Hessian symmetry. Outside classical smooth settings, nested AD conventions may not correspond to a unique symmetric classical Hessian.
Reverse-over-reverse: differentiate a gradient contraction
Alternatively, obtain by reverse mode while keeping its derivative computation differentiable, form , then reverse-differentiate :
Mathematically this gives the same smooth HVP. Computationally it nests two reverse operations and can have different intermediate-storage and primitive-support requirements.
Fixed directions are essential
All formulas above treat as independent of . If ,
The extra term is a product-rule contribution. Keep an externally chosen HVP direction fixed, but do not detach genuine dependencies inside or its gradient computation.
A composed loss needs both second-order terms
For , with sufficiently smooth ,
The actual upstream loss gradient depends on . Treating it as fixed during the entire second derivative would omit . Fixed external seeds and loss-dependent intermediate cotangents must be distinguished.
For fixed , the scalarization has Hessian . Its HVP is a contracted second derivative, not the entire vector-output second-derivative tensor.
Framework-independent pseudocode
# grad: reverse gradient of a scalar-valued function
# jvp: returns (primal output, directional output derivative)
# vjp: returns (primal output, a pullback accepting an output cotangent)
Y, dY = jvp(F, X, V)
Y, pullback = vjp(F, X)
barX = pullback(U)
g = grad(f)
Hv_forward_over_reverse = jvp(g, X, V).tangent
Hv_reverse_over_forward = grad(lambda Z: jvp(f, Z, V).tangent)(X)
Hv_reverse_over_reverse = grad(lambda Z: inner(g(Z), V))(X)
Here V is a fixed array of input shape, U has output shape, and inner is the Euclidean/Frobenius inner product. These are mathematical API sketches, not a claim that every framework uses identical signatures or supports every nesting for every primitive.
D.28 Softmax and attention as tensor differentiation examples
In this section, component sums are written explicitly; repeated free component labels are not silently summed.
Blockwise normalization with a tensor-valued observable
Separate a tensor’s axes into a retained block and a normalization block . Each block may itself contain several axes. Define
where ranges over all coordinates of the normalization block. Use distinct labels for the input entry being differentiated. The full derivative is
Each block delta is a product of coordinate deltas, for example . The factor expresses independence between retained blocks; the normalization couples all coordinates within .
Now let a downstream observable be a tensor , and define its upstream derivative tensor
Without reducing the observable block , the chain rule gives
Contracting the deltas yields
The output block and input blocks remain free. This is the full derivative propagation rule for an arbitrary tensor observable. A scalar objective is the case with no axes; a single VJP is obtained by contracting against a fixed seed. The vector and attention formulas below are specializations of this index-block identity.
Softmax: full Jacobian versus its actions
For ,
The JVP is
and the VJP is
Neither requires constructing . Their similar form results from the symmetry of this particular Jacobian; arbitrary Jacobians are not symmetric. As a useful check, because softmax probabilities retain unit sum, and because a shared logit shift leaves the probabilities unchanged.
Scaled dot-product attention: primal computation
Let
For a fixed additive bias or mask , define
Thus and . For exact masking, interpret each row’s softmax as normalization over its allowed keys; excluded entries have zero probability and zero logit derivative. Every row must have at least one allowed key.
Attention JVP
For perturbations and fixed ,
If the additive bias is also perturbed, include in .
Attention VJP
Given from the downstream scalar loss,
Apply rowwise softmax reverse differentiation:
Then
If a finite additive bias is trainable, , followed by reduction over any broadcast axes. A fixed mask receives no parameter gradient.
If self-attention uses , , and , the shared input receives all three paths:
Parameter gradients are , and similarly for . Batch and head axes carry the same contractions independently; any parameters shared across them require summed contributions. These identities describe the attention operation itself, before extra components such as dropout, normalization, or residual paths, whose own derivative rules must also be included.
D.29 Choosing a differentiation mode and checking the result
Let be the number of scalar input entries and the number of scalar output entries.
| Quantity required | Natural construction | Direction count |
|---|---|---|
| One directional output derivative | Forward JVP | One input direction |
| Gradient of one scalar objective | Reverse VJP seeded by | One output seed |
| One weighted output sensitivity | Reverse VJP with fixed | One output cotangent |
| Full Jacobian by forward mode | JVPs on an input basis | input directions |
| Full Jacobian by reverse mode | VJPs on an output basis | output directions |
| One Hessian-vector product | A suitable nested AD construction | One fixed input direction |
| Full scalar Hessian | HVPs on an input basis, or a suitable Hessian transform | input directions and output entries |
Directions can be batched or processed in chunks; the table counts directions, not necessarily separate API calls. For a full Jacobian, relatively few inputs often favor forward mode and relatively few outputs often favor reverse mode. A scalar loss with many parameters is the characteristic reverse-mode case.
Work and memory are properties of the computation
A JVP or VJP often costs a small multiple of a primal evaluation, but the constants depend on the operations, derivative implementation, and execution strategy. An HVP for supported differentiable primitives can have work proportional to the cost of evaluating the original computation, up to such factors. It is not universally : the primal function itself may cost far more than .
Forward mode need not preserve a complete history for a later reverse sweep. Reverse mode needs relevant forward intermediates, either saved or recomputed. Checkpointing deliberately trades extra computation for reduced saved-intermediate storage. Higher-order nesting can change both costs, and no nesting order is universally the fastest or most memory efficient.
Forming a full Jacobian or Hessian has an unavoidable output-storage cost proportional to its number of entries if stored densely. Prefer a contraction such as JVP, VJP, or HVP when that is what the downstream calculation actually uses.
Five practical checks
- Free-index check: every output index remains free, and only intended contraction indices are summed. Keep batch labels distinct from contraction labels.
- Shape check: JVP output has output shape; VJP output has input shape; a scalar gradient has parameter shape.
- Adjoint check: for chosen test arrays , verify . This catches transpose and missing-reduction errors.
- Sharing check: add contributions from every use, including broadcast axes, tied parameters, repeated gathers, and residual branches.
- Smoothness and seed check: hold external direction seeds fixed, preserve actual objective dependence, and identify kinks or discrete decisions.
At a smooth point, a numerical directional check can additionally compare with . This uses finite differences to check AD, not to define it; truncation and roundoff mean the discrepancy is not expected to vanish for arbitrarily tiny .
At ties in max, at ReLU’s kink, or at discrete operations such as argmax, an ordinary derivative may be absent. A framework’s chosen convention, zero gradient, subgradient, or custom surrogate should not be presented as a unique classical derivative. Data-dependent branching differentiates the executed branch where its local mathematical derivative is meaningful; it does not automatically differentiate a change of discrete control flow.
Multivariable vector and matrix calculus
- M.1 Objects, dimensions, and the central correspondences
- M.2 Partial derivatives, total derivatives, and differentiability
- M.3 Multivariable chain rules
- M.4 Taylor expansions, local approximation, and error
- M.5 Implicit and inverse functions
- M.6 Multivariable optimization
- M.7 Double and triple integrals
- M.8 Changes of variables and Jacobians
- M.9 Line integrals, circulation, and planar flux
- M.10 Surface integrals and flux
- M.11 Gradient, divergence, curl, and Laplacian
- M.12 The major integral theorems
- M.13 Integration by parts in several variables
- M.14 Matrix differential calculus
- M.15 Useful derivatives for probabilities and modern optimization
- M.16 Final error checklist
M.1 Objects, dimensions, and the central correspondences
Let , , and .
| Object | Definition or shape | What it does |
|---|---|---|
| Gradient | , entries | Collects first derivatives of a scalar function |
| Jacobian | , entry | Maps a small input change to a first-order output change |
| Hessian | , entry | Describes second-order variation |
| Differential | A scalar linear function of a displacement | |
| Differential | The linearization of a vector-valued function | |
| Directional derivative | when is differentiable | Rate of change along |
The useful one-variable correspondences are:
| One variable | Several variables |
|---|---|
| for scalar output; for vector output | |
| in a change of variables | |
| Integration by parts | Divergence identities and boundary integrals |
| Gradient theorem, Green, Stokes, and divergence theorem |
Shape check: is a scalar, is an -vector, and is a scalar. Checking dimensions catches many chain-rule and matrix-gradient errors.
M.2 Partial derivatives, total derivatives, and differentiability
Partial derivative
Hold the other variables fixed:
For ,
For an expression such as , and are different:
The partial derivative ignores the change in ; the total derivative includes it.
Differentiability means a single linear approximation
is differentiable at if there is a linear map such that
Then . Continuous partial derivatives in a neighborhood are a sufficient condition. Merely having every partial derivative at the point is insufficient. Even having every directional derivative is insufficient if those derivatives do not arise from one linear map.
For example, define
At the origin both partial derivatives are zero, while for ,
All these directional derivatives exist, but their dependence on is not linear. The function is not differentiable at the origin.
Gradient and directional derivatives
For differentiable ,
If , the maximum directional derivative is , attained in the gradient direction when the gradient is nonzero. The minimum is . Without the unit-length restriction, the derivative also scales with the speed .
The gradient is perpendicular to a regular level surface . A tangent displacement satisfies . At , the usual normal-direction interpretation can fail.
Mixed partial derivatives
If the second partial derivatives are continuous near a point, then
Do not interchange mixed partials without checking an appropriate regularity condition.
Euler’s theorem for homogeneous functions
A differentiable function is homogeneous of degree if
on a domain closed under the relevant positive scalings. Differentiating with respect to and setting gives
If is twice differentiable, differentiating this identity with respect to gives
Example: has degree , so . This is an effective algebraic check on derivatives of homogeneous expressions. The scaling is about the origin; a translated quadratic need not be homogeneous.
M.3 Multivariable chain rules
First-order chain rule
For and ,
For scalar outer ,
For ,
If depends explicitly on time as well,
Second-order chain rule
For scalar and ,
Evaluate and at . The second term disappears for an affine ; it generally does not disappear for a nonlinear .
Along a curve,
Along a straight line ,
Example: the extra Hessian term
Take and . Then ,
The formula gives
Using only the first term would miss in the upper-left entry.
M.4 Taylor expansions, local approximation, and error
For near ,
For two variables, the quadratic term is
For a function on a neighborhood of the segment from to , the remainder after the quadratic term can be written
If the operator norm of is at most along that segment, the linearization error satisfies
The integral forms are particularly useful:
For scalar , a segment version of the mean value theorem gives some with . For vector-valued , a single common generally does not work for every component; the integral formula remains valid componentwise.
M.5 Implicit and inverse functions
Implicit function theorem
Let be , with
Locally, the equation defines a unique function , and
This is a local theorem: invertibility at one point does not establish a global, single-valued solution.
For a scalar constraint with ,
For a level surface with ,
Example: passes through . At this point,
Inverse function theorem
If is near and , it has a differentiable local inverse. At ,
A nonzero determinant everywhere is still not, by itself, a general guarantee of global injectivity.
M.6 Multivariable optimization
Interior unconstrained extrema
For a differentiable function, an interior local extremum must satisfy . Such points are stationary points, not automatically maxima or minima.
At a stationary point of a function:
| Hessian | Conclusion |
|---|---|
| Positive definite | Strict local minimum |
| Negative definite | Strict local maximum |
| Indefinite | Saddle point |
| Positive or negative semidefinite | Inconclusive in general |
| Zero matrix | Inconclusive |
Positive definiteness means for every nonzero . For symmetric , all eigenvalues must be positive. Sylvester’s criterion equivalently requires all leading principal minors to be positive. For negative definiteness, these leading principal minors alternate signs, beginning negative.
For two variables, define at a stationary point:
| Condition | Classification |
|---|---|
| , | Strict local minimum |
| , | Strict local maximum |
| Saddle | |
| Inconclusive |
A continuous function on a compact feasible set attains its maximum and minimum. To find them, compare interior candidates with candidates on every relevant boundary piece, including corners and singular boundary points.
Convexity
On an open convex domain, a function is convex if and only if is positive semidefinite everywhere. A stationary point of a differentiable convex function is a global minimum. Strict convexity makes a minimizer unique, if it exists. Positive definite Hessians everywhere are sufficient for strict convexity but not necessary.
Newton and Gauss–Newton equations
Newton’s step for a stationary point solves
This follows by setting the gradient of the local quadratic Taylor approximation to zero. An invertible Hessian makes the linear system solvable, but an indefinite Hessian need not give a descent direction. Local convergence statements require further assumptions; damping, line searches, or trust regions address different global and conditioning concerns.
For nonlinear least squares ,
Gauss–Newton uses as an approximation to the Hessian and solves
The omitted term vanishes at a zero-residual point and for affine residuals. It is not generally zero merely because the objective is a sum of squares. A damped system adds to the left-hand matrix; solving a linear system is preferable to explicitly constructing an inverse.
Equality constraints: Lagrange multipliers
Minimize subject to , where . Define
When has full row rank at a constrained local extremum,
Geometrically, lies in the span of the constraint normals. The feasible tangent space is
For a regular equality-constrained candidate, assess on this tangent space, not on all of . If has columns forming a basis of , use
Positive definiteness gives a strict constrained local minimum; positive semidefiniteness is necessary at a constrained local minimum under the usual regularity assumptions. The bordered Hessian is
Its determinant tests depend on the number of constraints and the sign convention. The tangent-space test is usually easier to apply correctly.
Example: Minimize subject to . Stationarity gives , so . The minimum is . A tangent vector is , and its quadratic form is for .
Inequality constraints: KKT conditions
For
use
The Karush–Kuhn–Tucker conditions are:
- Stationarity: .
- Primal feasibility: , .
- Dual feasibility: .
- Complementary slackness: for every .
They are necessary at local minima only under an appropriate constraint qualification, such as linear independence of the active constraint gradients. If and all are convex and all are affine, a feasible KKT point is globally optimal. Slater’s condition is a standard condition ensuring necessity and strong duality in the convex setting. Changing constraints from to changes the multiplier-sign convention.
Envelope theorem: differentiating an optimized value
Suppose , where is a differentiable branch of interior stationary optimizers and the relevant derivatives exist. The chain rule gives
The optimizer’s derivative drops out because at the optimum. For regular equality-constrained problems, with , the corresponding formula is
This assumes a suitable smooth optimizer/multiplier branch. Nonunique optimizers, changes of active constraints, or nonsmooth optimal-value functions require more careful directional or generalized statements. It is not permission to discard arbitrary intermediate derivatives in a computation graph.
M.7 Double and triple integrals
Definitions and iterated integrals
For a region ,
accumulates a scalar density over area. For a region ,
does the same over volume.
For a vertically simple region,
Integrate inside first, treating the outer variable as constant. To reverse order, describe the same geometric region using the new slices; swapping differential symbols without changing the limits is invalid.
When exchanging integration order is valid
- Tonelli: For a measurable nonnegative function, iterated integrals agree with the product-space integral, allowing .
- Fubini: If , integration order may be exchanged, with the iterated expressions understood almost everywhere where needed.
- A continuous function on a compact rectangle satisfies the usual elementary hypotheses automatically.
- For signed improper integrals without absolute integrability, order changes may alter the result or fail entirely.
Example: reversing order makes the integral elementary
The region is , so
The original inner antiderivative is non-elementary; the reversed integral is straightforward.
M.8 Changes of variables and Jacobians
For a sufficiently regular, one-to-one transformation between -dimensional regions, with nonsingular Jacobian in their interiors,
The absolute determinant measures volume scaling. Orientation does not change an ordinary volume integral. Singularities on negligible boundary sets, such as the origin in polar coordinates, can be handled by the usual limiting or measure-theoretic interpretation. If the map covers the image several times, account for multiplicity.
| Coordinates | Transformation | Measure |
|---|---|---|
| Polar | , | |
| Cylindrical | , , | |
| Spherical | , , | |
| Linear | , nonsingular |
In this spherical convention, is the polar angle from the positive -axis, is azimuth, and . Many books exchange the names and ; identify the convention before using a formula.
For an ellipsoid , use . With , its volume is times the unit-ball volume:
Mass, averages, and moments
For nonnegative density on with finite positive mass and finite displayed moments,
For area ,
Moments of inertia for a plane lamina are
Triple-integral versions replace by . About a spatial axis, integrate squared perpendicular distance times density.
M.9 Line integrals, circulation, and planar flux
Let have a piecewise smooth parametrization , .
Scalar line integral
This accumulates density along length and is unchanged when the orientation is reversed.
Vector line integral
In three dimensions,
It changes sign under orientation reversal. Work by a force is a vector line integral. Circulation is the corresponding integral around a closed curve.
Planar outward flux
For a positively oriented, counterclockwise simple closed boundary and ,
Using the left normal of a counterclockwise curve would give the inward normal and the opposite sign.
Conservative vector fields and exact differentials
If on a domain containing the curve,
This is the fundamental theorem for line integrals. On a connected open domain, having a potential is equivalent to path independence and to zero integral around every piecewise smooth closed loop.
For a field, a potential implies . The converse requires a suitable domain, for example a simply connected open domain. In two dimensions the analogous test is . A hole or singularity can obstruct a global potential.
Example: a curl-free field with nonzero circulation. On ,
has , but on the unit circle ,
There is no global single-valued potential on this punctured domain.
To find a potential in two variables, integrate with respect to , add an unknown function , and use to determine . In three dimensions, add an unknown function of the other two variables at the first step.
M.10 Surface integrals and flux
For a regular parametrized surface ,
Thus
For the orientation corresponding to ,
Scalar surface integrals are independent of orientation; flux integrals reverse sign with the chosen normal. Avoid multiplying by the surface scale factor twice: already combines the unit normal and area scaling.
For a graph ,
The upward-oriented vector area is
For an implicit regular surface , a unit normal is
Choose the sign using the specified orientation. For the sphere of radius , is outward.
M.11 Gradient, divergence, curl, and Laplacian
In Cartesian coordinates, write .
| Operator | Input | Output | Interpretation |
|---|---|---|---|
| Gradient | Scalar field | Vector field | Local direction and rate of increase |
| Divergence | Vector field | Scalar field | Local net outward flow per unit volume |
| Curl in | Vector field | Vector field | Local circulation density and axis |
| Laplacian | Scalar field | Scalar field | Trace of the Hessian; divergence of the gradient |
For sufficiently smooth fields,
where the Cartesian vector Laplacian acts componentwise.
Orthogonal coordinates
For orthogonal coordinates with scale factors and orthonormal coordinate vectors ,
Here are components in the local orthonormal basis. Cylindrical scale factors for are ; spherical scale factors for in the convention above are .
For a right-handed orthonormal coordinate basis, curl can be remembered by the formal determinant
Expand along the first row, with each derivative acting on the corresponding third-row product. These are physical components in the orthonormal basis, not the unnormalized coordinate-basis components.
Common scalar Laplacians are
For a radial function in , with ,
Coordinate singularities at or the poles require limits or another coordinate chart; division by zero is not permitted.
M.12 The major integral theorems
Assume the fields are on suitable open neighborhoods, regions have piecewise smooth boundaries, and surfaces carry the stated orientations. If there are field singularities, exclude them and include all resulting boundary pieces before applying a theorem.
Green’s theorem: circulation form
For a planar region with positively oriented boundary ,
Positive orientation keeps the region on the left: outer boundaries run counterclockwise and boundaries around holes run clockwise.
Green’s theorem: flux form
Useful area formulas for positively oriented simple closed curves are
Stokes’ theorem
For an oriented surface with boundary ,
Boundary orientation follows the right-hand rule relative to . One can replace with another spanning surface with the same boundary and compatible orientation if the field is smooth on the relevant surfaces. The boundary can have several components.
Divergence theorem, also called Gauss’ theorem
For a solid region with outward-oriented closed boundary,
A surface must be closed for direct use. If a surface is open, add a closing piece, apply the theorem, then subtract the flux through that piece. Inner cavity boundaries use normals pointing out of the solid and into the cavity.
Example: For and a sphere of radius ,
Directly, on the sphere, and its area is , giving the same answer.
Which theorem matches the integral?
| Integral or structure | First theorem to consider |
|---|---|
| Line integral of a gradient | Fundamental theorem for line integrals |
| Closed planar circulation | Green’s circulation theorem |
| Closed planar outward flux | Green’s flux theorem |
| Three-dimensional circulation around a boundary | Stokes’ theorem |
| Flux through a closed surface | Divergence theorem |
| Curl-free field on a domain with holes | Check topology before claiming a potential |
The advanced unifying statement is generalized Stokes:
Here is a compact oriented smooth manifold with boundary, is a sufficiently smooth differential form of degree , and is its exterior derivative. The boundary has the induced orientation. The classical theorems above are its concrete calculus manifestations.
M.13 Integration by parts in several variables
Applying the divergence theorem to gives
Componentwise,
These are direct analogues of : a derivative transfers to another factor, its sign changes, and a boundary term appears.
Green’s first identity
Set :
where .
Green’s second identity
Subtract the first identity with and exchanged:
Weak derivatives and weak formulations
For a compactly supported smooth test function inside , the boundary term vanishes:
This identity defines a weak derivative even when an ordinary pointwise derivative is unavailable. A weak derivative represented by a function is distinguished from a general distributional derivative, which may include singular terms.
For Poisson’s equation with homogeneous Dirichlet boundary conditions, multiply by a test function vanishing on the boundary and integrate by parts:
The weak form reduces the highest derivative needed on from second to first. For nonzero boundary terms or different boundary conditions, keep the appropriate surface contribution; do not silently discard it.
M.14 Matrix differential calculus
Conventions and basic differential rules
For a scalar with , define the matrix gradient by
This convention gives the same shape as .
The inverse formula comes from differentiating . Matrix multiplication order must be preserved.
For a differentiable matrix path ,
For real invertible matrices,
Writing without absolute values requires in the real setting. On the symmetric positive definite cone, its gradient is and
for symmetric directions . Thus is concave on that cone.
Standard vector and matrix gradients
All constants below are fixed and dimensions must be compatible.
| Scalar function | Gradient |
|---|---|
| for symmetric | |
| , symmetric | |
| for | |
| , invertible |
The Hessian of is . It is positive semidefinite, and positive definite exactly when has full column rank.
Least-squares normal equations: Stationarity gives
If has full column rank, mathematically. Numerically, QR or singular-value decompositions often avoid the conditioning penalty from explicitly forming .
For column-stacked vectorization,
Thus the Jacobian of in these vectorized coordinates is . A different vectorization convention changes the expression.
JVPs, VJPs, and Hessian-vector products
For :
- A Jacobian-vector product maps an input direction to .
- A vector-Jacobian product, represented as a column cotangent, maps an output weight to . In row notation it is .
- For scalar , a Hessian-vector product is .
These products can be computed without explicitly materializing full Jacobian or Hessian matrices. Backpropagation applies transposed Jacobians repeatedly to propagate scalar-objective sensitivities toward the inputs.
M.15 Useful derivatives for probabilities and modern optimization
Softmax and log-sum-exp
For logits ,
Therefore
For ,
For any vector ,
The Hessian is a covariance matrix and vanishes in the all-ones direction, reflecting invariance of softmax to a shared logit offset.
For cross-entropy with a fixed target distribution satisfying and ,
For sigmoid ,
The binary cross-entropy derivative with respect to its logit is .
Differentiating an expectation: fixed support
Suppose is a differentiable density, positive on its fixed support wherever the score is used, and differentiation may be moved through the integral, for example because suitable local dominating integrable bounds exist. For differentiable ,
The logarithmic derivative is the score. Under the same regularity assumptions,
An -independent baseline can therefore be subtracted from in the score term without changing its expectation. This identity does not license ignoring an explicit derivative of .
Reparameterization or pathwise differentiation
If with independent of , then, under suitable interchange and differentiability assumptions,
The explicit derivative treats as fixed; the second term differentiates the sampled value through . Discontinuous sample maps or nonsmooth objectives may invalidate naive pathwise differentiation.
Moving-support warning
If the density support depends on , boundary terms can appear. For with ,
Using only the interior score would give , missing the moving-boundary contribution. Reparameterizing , correctly gives .
Multivariate Gaussian integral
For symmetric positive definite ,
Completing the square yields
Positive definiteness ensures decay in every direction and finiteness of the integral. For a covariance matrix , set to recover the Gaussian normalization factor .
M.16 Final error checklist
- Dimensions: Does each gradient, Jacobian, and matrix product have the required shape?
- Dependence: Have all implicit paths of variable dependence been included?
- Smoothness: Are mixed partials, Taylor expansions, and derivative-integral interchanges justified?
- Local versus global: Does a local inverse or local minimum really support the global claim being made?
- Regions: Are the new integration limits a description of the same domain?
- Scaling: Is the absolute Jacobian determinant included exactly once?
- Orientation: Is the normal outward, and is the boundary direction compatible with it?
- Topology: Are there holes, singularities, or omitted inner boundaries?
- Boundary terms: Have integration-by-parts contributions been retained unless they actually vanish?
- Constraints: Is the Hessian being tested in feasible directions, and are KKT multiplier signs consistent with the inequality convention?
- Matrix order: Have noncommuting factors retained their order?
- Probability support: Does the parameter alter the domain of integration, requiring a boundary contribution?
Advanced connections
- A.1 Differential equations as an application of calculus
- A.2 Calculus of variations and functional derivatives
- A.3 Convolution, Fourier and Laplace transforms
- A.4 Nonsmooth and generalized differentiation and integration
- A.5 Complex-calculus formulas used to evaluate real integrals
- A.6 Probability integrals and Monte Carlo integration
A.1 Differential equations as an application of calculus
A differential equation relates a function to its derivatives. These are the most reusable elementary patterns; solving an equation must also respect its domain and initial or boundary conditions.
Separable first-order equation
For , on an interval where ,
Before dividing by , separately check constant solutions with . Division can otherwise erase equilibrium solutions.
Example:
including .
For logistic growth with , nonzero solutions have the form
on intervals where the denominator does not vanish. The equilibrium solutions are and ; the latter is included by .
Linear first-order equation and integrating factor
For
take . The product rule gives
Example:
Bernoulli equation
For
put on an interval where the power is defined and the substitution is valid. Then
a linear equation. Again check solutions lost by dividing by a power of .
Exact differential equation
For
look for a potential with , . A local test on a rectangle with coefficients is
Then describes the implicit solution curves. On a general domain, topology matters for a global potential.
Recover by integrating in :
and determine from . Here the “constant of integration” is a function of the other variable.
Homogeneous second-order linear equation with constant coefficients
For constant real coefficients , consider
Solve .
| Characteristic roots | General real solution |
|---|---|
| Distinct real | |
| Repeated real | |
| , |
For a nonhomogeneous equation, . Undetermined coefficients and variation of parameters find a particular solution; matching a forcing term to a homogeneous solution requires a resonance correction.
Repeated integration
For continuous and integer , the fold integral from a fixed lower endpoint is
Thus a solution to with prescribed is
This is also the structure behind the integral remainder in Taylor’s theorem.
A.2 Calculus of variations and functional derivatives
Ordinary optimization varies finitely many coordinates. Variational calculus varies an entire function or trajectory.
Let
For a perturbation ,
Integration by parts moves the derivative off the perturbation:
For fixed endpoint values, . A sufficiently smooth stationary function must satisfy the Euler–Lagrange equation:
The interior functional derivative, with the pairing, is
This is a necessary stationarity condition under the usual regularity hypotheses; it does not by itself prove a minimum.
Boundary conditions matter. If the endpoint location is fixed but the endpoint value of is free, its perturbation need not vanish. The corresponding natural boundary condition is there. Moving endpoint locations require additional transversality conditions.
Example: smooth trajectory fitting
For fixed endpoints and ,
The data-fitting term has derivative ; the derivative penalty contributes after integration by parts:
If instead the functional contains , the interior contribution is , with additional boundary terms.
Other reusable forms
For and variations whose boundary terms vanish:
For a field ,
For with no explicit dependence, the Beltrami identity is
along a smooth Euler–Lagrange solution.
For an integral constraint , a suitable multiplier gives the augmented integrand under the corresponding constraint regularity assumptions.
A.3 Convolution, Fourier and Laplace transforms
These methods convert some differentiation and integration problems into algebraic ones. The normalization and boundary assumptions determine the signs and constants.
Convolution on the real line
For integrable functions, convolution is commutative and associative in the standard almost-everywhere sense. If differentiation is justified, and the necessary boundary terms vanish when transferring the derivative between factors,
The equality involving follows from integration by parts; it is not valid without sufficient regularity and boundary control.
Fourier transform
Use
For a smooth rapidly decaying function, or more generally when and is continuous at the evaluation point, inversion with this normalization gives
Sufficiently smooth, rapidly decaying functions satisfy
The first identity is integration by parts with .
For functions in , and more generally by the extension, Parseval–Plancherel with this normalization gives
One-sided Laplace transform
Work in a half-plane where the integrals converge. With sufficient smoothness and exponential growth control:
For the causal convolution
the transform is under absolute-convergence conditions.
| Function | Laplace transform | Simple real convergence condition |
|---|---|---|
| , integer | ||
A.4 Nonsmooth and generalized differentiation and integration
Subgradients for convex functions
If a convex function is not differentiable at , a subgradient satisfies
The set of subgradients is . For example:
For convex on , is equivalent to being a global minimizer. A selected subgradient at a kink is not an ordinary classical derivative.
Weak derivatives and distributions
A locally integrable is a weak derivative of locally integrable if
for every smooth compactly supported test function .
More generally a distribution is differentiated by
The Dirac delta is defined through its action:
Useful distributional identities:
Here is the unit step; its chosen value at the single point does not affect these distributional identities.
For nonzero real :
For a smooth with isolated simple real zeros :
locally where the roots are simple. A repeated root does not satisfy this formula.
Riemann–Stieltjes and Lebesgue viewpoints
Riemann–Stieltjes integration replaces increments by increments of an integrator :
If and is continuous:
For continuous bounded-variation functions , integration by parts reads
If both functions have jumps, jump conventions and correction terms require care.
Lebesgue integration handles measurable functions and provides the convergence theorems used for expectations and parameterized integrals. If , then
is absolutely continuous and almost everywhere. Conversely, absolute continuity gives
Merely having a derivative almost everywhere is insufficient for this converse.
A.5 Complex-calculus formulas used to evaluate real integrals
These are advanced extensions; they require complex analyticity, which is much stronger than real differentiability.
For and , complex differentiability implies the Cauchy–Riemann equations
If the first partial derivatives are continuous on an open set and these equations hold throughout it, then is holomorphic there.
For a piecewise smooth closed simple contour , oriented counterclockwise, and holomorphic on an open set containing the contour and its interior:
For inside , Cauchy’s integral formula and its derivative version are
If is holomorphic inside and on except at finitely many isolated singularities strictly inside:
For a simple pole:
For a pole of order :
Example. For , close with an upper semicircle. The arc contribution tends to zero, and only lies inside. Its residue is , so
For other integrands, arc decay, branch cuts, poles on the contour and principal-value interpretations must be checked separately.
A.6 Probability integrals and Monte Carlo integration
For a probability density ,
For a nonnegative random variable , Tonelli gives the tail formula
allowing . More generally, for ,
Monte Carlo on a bounded region
For a region of finite positive volume , sample independently and uniformly from . Then
is an unbiased estimate of when is absolutely integrable on . If has finite variance,
The root-mean-square error therefore scales as . This is a statistical error statement, not a deterministic bound for every realized sample.
Importance sampling
For absolutely integrable on and a density on that is positive almost everywhere that the integrand contributes,
The corresponding estimator is
Finite variance requires . A poor proposal density can create infinite variance even when the target integral is finite.
Parameter gradients of expectations, reparameterization and score-function identities are covered in the multivariable chapter.
Revision checklist and self test
- R.1 What to memorize and what to reconstruct
- R.2 The final error checklist
- R.3 Self-test
- R.4 References for further revision
R.1 What to memorize and what to reconstruct
The strongest revision strategy is to remember a small set of generators and reconstruct the larger table when needed.
| Memorize fluently | Reconstruct from it |
|---|---|
| Product and chain rules | Integration by parts and substitution |
| Derivatives of | Most elementary derivative/antiderivative patterns |
| and double-angle identities | Trigonometric power reductions |
| Fundamental theorem and moving-endpoint rule | Accumulation derivatives and most Leibniz examples |
| Taylor coefficients and error term | Local approximations, limits, finite differences |
| Gradient/Jacobian conventions | Multivariable chain rule and backpropagation |
| Product divergence identity | Multivariable integration by parts and Green identities |
| Domain and convergence checks | Which apparently plausible manipulations are actually allowed |
Suggested order for revision:
- Definitions, domains, standard limits, elementary derivative/antiderivative tables.
- Substitution, integration by parts, partial fractions, trigonometric and radical techniques.
- FTC, definite-integral symmetry, improper convergence and numerical integration.
- Implicit/logarithmic/parametric differentiation, extrema, Taylor approximation and remainder.
- Gradients, Jacobians, Hessians, constraints and multiple integrals.
- Vector integral theorems, matrix calculus, expectation gradients and variational identities.
R.2 The final error checklist
Before differentiating
- Identify the variable and all explicit and implicit dependence.
- Specify the real domain; logarithms, inverse functions and roots have restrictions.
- Apply the chain rule at every level.
- For a piecewise function, inspect the junction using the definition; do not differentiate only the two open pieces.
- Keep partial and total derivatives distinct.
- Check vector/matrix dimensions and multiplication order.
- If the expression contains an integral or infinite series, justify the interchange.
Before integrating
- Distinguish indefinite integration, signed definite accumulation and geometric area.
- Simplify algebra and test the reverse chain rule first.
- Identify all singularities before using an antiderivative.
- Change limits together with the variable, or return entirely to the original variable before evaluation.
- In integration by parts, retain every boundary term until its limit is known.
- Include absolute values in logarithmic primitives when required.
- For multiple integrals, transform the region and the measure, including the absolute Jacobian.
- For oriented integrals, check boundary directions and normals.
- Verify convergence before invoking oddness, periodicity or cancellation.
- Differentiate an indefinite answer; for a definite answer, also check its sign, magnitude and units.
Before declaring an optimum or approximation
- A stationary point is a candidate; test and compare it.
- Include endpoints, boundaries, corners and points where derivatives fail.
- A zero second derivative is inconclusive.
- A semidefinite Hessian at a single stationary point is generally inconclusive.
- A constrained Hessian must be tested along feasible directions.
- A Taylor polynomial is an approximation with a remainder.
- Check the radius and endpoints of a power series.
- Rounding and cancellation limit how small a finite-difference step should be.
Before differentiating a tensor map or an integral operator
- Separate free output indices, input indices, contraction indices and batch indices.
- Decide whether the required object is a complete derivative tensor, a JVP, a VJP or a Hessian action.
- State the inner product or dual pairing before identifying a derivative with a gradient or an adjoint.
- Retain all axes of a tensor-valued observable; a scalar loss is one special case.
- Keep external direction seeds fixed in higher derivatives, while preserving genuine dependence of an upstream loss gradient.
- Record the measure, domain, quadrature nodes and weights, and differentiate every part that depends on the parameter.
- Distinguish the derivative of a continuous model from the derivative of its finite discretization.
- Verify the adjoint pairing, including boundary conditions and quadrature weights.
R.3 Self-test
Attempt these without using the tables. The answer key follows.
| No. | Task |
|---|---|
| 1 | Evaluate . |
| 2 | Evaluate . |
| 3 | Evaluate for . |
| 4 | Evaluate . |
| 5 | Evaluate , treating the endpoint correctly. |
| 6 | Evaluate . |
| 7 | For which real does converge, and to what? |
| 8 | Differentiate . |
| 9 | Differentiate on . |
| 10 | For , find and where . |
| 11 | Find . |
| 12 | Classify the stationary point of at . |
| 13 | Find and for . |
| 14 | Find the maximum directional derivative of at , over unit directions. |
| 15 | Evaluate . |
| 16 | Evaluate , . |
| 17 | Compute the outward flux of through the sphere of radius . |
| 18 | Differentiate with respect to . |
| 19 | Find the interior functional derivative of with fixed endpoint values. |
| 20 | If , find and identify why the interior-score-only calculation fails. |
| 21 | For , give the JVP and the VJP with output cotangent under Frobenius pairings. |
| 22 | For with fixed , compute the Hessian action on a direction . |
| 23 | For on , find its adjoint and its terminal boundary condition. |
| 24 | Let , with positive diagonal input/output weight matrices . Compare the Euclidean transpose with the adjoint under the corresponding weighted inner products. |
| 25 | For , with bounded linear and , find the gradient and Hessian operator. |
| 26 | Differentiate , accounting for moving quadrature nodes. |
Answer key
- by .
- by repeated integration by parts.
- by , .
- after completing the square.
- . The primitive is , and as .
- by reflection .
- Converges exactly for , to . Use .
- .
- .
- and on the unit circle where .
- by Taylor expansion or two applications of L’Hôpital.
- A strict global minimum, despite .
- and .
- , in direction .
- by reversing the order to .
- from .
- , because .
- ; its Hessian is .
- .
- . The support endpoint moves with , so the integral derivative contains a boundary term. Reparameterizing with fixed also gives .
- ; and . In matrix form these are , and .
- . The Hessian is a linear map on matrices; no dense fourth-order array needs to be formed.
- . Thus almost everywhere and .
- , whereas . They represent different pairings.
- and . The Hessian is positive semidefinite, and is bounded below by when .
- . With vector nodes, the last product becomes the spatial directional derivative.
R.4 References for further revision
The explanations and examples in this sheet are written as a unified revision reference. The following primary educational and mathematical references provide complementary tables, theorem statements and longer derivations.
- OpenStax Calculus Volume 1 — Table of Derivatives. Elementary, inverse-trigonometric and hyperbolic derivative tables.
- OpenStax Calculus Volume 2 — Integration by Parts. The product-rule derivation and applications of the integration-by-parts identity.
- MIT OpenCourseWare — Single Variable Calculus, Techniques of Integration. Lessons and practice on the principal integration methods.
- MIT OpenCourseWare — Multivariable Calculus. Gradients, constrained optimization, multiple integration, line/surface integrals and vector integral theorems.
- NIST Digital Library of Mathematical Functions — Gamma Function Definitions. Euler’s gamma integral and its domain of convergence.
- NIST Digital Library of Mathematical Functions — Beta Function. The beta integral, gamma relation and trigonometric forms.
- Petersen and Pedersen — The Matrix Cookbook. A larger collection of matrix identities and derivative formulas; align gradient conventions before transferring a formula.
- MIT OpenCourseWare — Principles of Optimal Control, Calculus of Variations. Variational methods for continuous optimization.
- MIT OpenCourseWare — Complex Variables with Applications, Lecture Notes. Complex derivatives, Cauchy’s formula, contour integration and residues.
- Baydin et al. — Automatic Differentiation in Machine Learning: A Survey. Forward and reverse accumulation, computational graphs and higher derivatives.
- JAX — Forward- and reverse-mode autodiff. Derivations of JVPs, VJPs and several mixed-mode Hessian-vector constructions.
- JAX — Hessian transformation. The output-axis and input-axis structure of higher derivatives of tensor-valued maps.
- JAX — Gradient checkpointing. The computation–memory tradeoff in reverse accumulation.