Skip to content

Truncated Polynomial Algebras

Dual numbers capture first-order derivatives because the infinitesimal element satisfies

Dual numbers capture first-order derivatives because the infinitesimal element satisfies

ε2=0. \varepsilon^2 = 0.

To compute higher-order derivatives, we extend this idea by allowing higher powers to survive temporarily before truncation.

The resulting structures are called truncated polynomial algebras.

They generalize dual numbers from first-order infinitesimals to finite-order infinitesimal expansions.

From Dual Numbers to Higher Orders

Recall the dual-number algebra:

R[ε]/(ε2). \mathbb{R}[\varepsilon]/(\varepsilon^2).

Every element has the form

a0+a1ε. a_0 + a_1\varepsilon.

The condition

ε2=0 \varepsilon^2 = 0

removes all second-order and higher terms.

Now instead consider:

R[ε]/(εk+1). \mathbb{R}[\varepsilon]/(\varepsilon^{k+1}).

Here powers up to εk\varepsilon^k survive:

a0+a1ε+a2ε2++akεk. a_0 + a_1\varepsilon + a_2\varepsilon^2 + \cdots + a_k\varepsilon^k.

Only terms of degree k+1k+1 and higher vanish.

This algebra stores derivatives up to order kk.

Example: Second-Order Algebra

The simplest nontrivial extension is:

R[ε]/(ε3). \mathbb{R}[\varepsilon]/(\varepsilon^3).

Elements have the form:

a+bε+cε2. a + b\varepsilon + c\varepsilon^2.

Now:

ε3=0, \varepsilon^3 = 0,

but:

ε20. \varepsilon^2 \neq 0.

Multiplication works by ordinary polynomial multiplication followed by truncation.

For example:

(a+bε+cε2)(d+eε+fε2) (a+b\varepsilon+c\varepsilon^2) (d+e\varepsilon+f\varepsilon^2)

expands to:

ad+(ae+bd)ε+(af+be+cd)ε2+higher-order terms. ad + (ae+bd)\varepsilon + (af+be+cd)\varepsilon^2 + \text{higher-order terms}.

All powers containing ε3\varepsilon^3 or above vanish.

Taylor Expansion Interpretation

The key connection comes from Taylor expansion.

For a smooth function:

f(x+h)=f(x)+f(x)h+12f(x)h2+. f(x+h) = f(x) + f'(x)h + \frac12 f''(x)h^2 + \cdots.

Substitute a truncated infinitesimal:

h=ε,εk+1=0. h = \varepsilon, \quad \varepsilon^{k+1}=0.

Then:

f(x+ε)=f(x)+f(x)ε+12f(x)ε2++1k!f(k)(x)εk. f(x+\varepsilon) = f(x) + f'(x)\varepsilon + \frac12 f''(x)\varepsilon^2 + \cdots + \frac1{k!}f^{(k)}(x)\varepsilon^k.

The series terminates exactly.

Higher-order derivatives become coefficients in the algebra.

Second Derivative Example

Let:

f(x)=x3. f(x)=x^3.

Use the algebra:

ε3=0. \varepsilon^3=0.

Evaluate:

(x+ε)3. (x+\varepsilon)^3.

Expanding:

=x3+3x2ε+3xε2+ε3. = x^3 + 3x^2\varepsilon + 3x\varepsilon^2 + \varepsilon^3.

Since:

ε3=0, \varepsilon^3=0,

we obtain:

x3+3x2ε+3xε2. x^3 + 3x^2\varepsilon + 3x\varepsilon^2.

Compare with Taylor expansion:

f(x+ε)=f(x)+f(x)ε+12f(x)ε2. f(x+\varepsilon) = f(x) + f'(x)\varepsilon + \frac12 f''(x)\varepsilon^2.

Since:

f(x)=3x2, f'(x)=3x^2,

and

f(x)=6x, f''(x)=6x,

we get:

12f(x)=3x. \frac12 f''(x)=3x.

The coefficients match exactly.

Structure of the Algebra

The truncated polynomial algebra

R[ε]/(εk+1) \mathbb{R}[\varepsilon]/(\varepsilon^{k+1})

is:

  • commutative
  • finite-dimensional
  • associative
  • local
  • nilpotent

Its basis is:

1,ε,ε2,,εk. 1,\varepsilon,\varepsilon^2,\ldots,\varepsilon^k.

Dimension is:

k+1. k+1.

Every element is represented uniquely as:

i=0kaiεi. \sum_{i=0}^{k} a_i\varepsilon^i.

Arithmetic remains finite because powers terminate.

First-Order Versus Higher-Order AD

Dual numbers compute first derivatives:

f(x+ε)=f(x)+f(x)ε. f(x+\varepsilon) = f(x)+f'(x)\varepsilon.

Truncated polynomial algebras compute finite Taylor expansions:

f(x+ε)=i=0kf(i)(x)i!εi. f(x+\varepsilon) = \sum_{i=0}^{k} \frac{f^{(i)}(x)}{i!}\varepsilon^i.

Thus:

AlgebraInformation Stored
ε2=0\varepsilon^2=0First derivative
ε3=0\varepsilon^3=0Second derivative
ε4=0\varepsilon^4=0Third derivative
εk+1=0\varepsilon^{k+1}=0kk-th derivatives

Forward-mode higher-order AD is therefore polynomial propagation over truncated algebras.

Polynomial Propagation Through Programs

Suppose a program computes:

f(x)=sin(x2). f(x)=\sin(x^2).

Represent input as:

x=a+ε. x = a+\varepsilon.

Each intermediate variable becomes a truncated polynomial.

First compute:

x2=a2+2aε+ε2. x^2 = a^2 + 2a\varepsilon + \varepsilon^2.

Then evaluate sine:

sin(a2+2aε+ε2). \sin(a^2 + 2a\varepsilon + \varepsilon^2).

Taylor expansion automatically propagates derivative information through every intermediate computation.

Programs become finite Taylor-series transformers.

Jet Spaces

In differential geometry, truncated polynomial algebras correspond to jet spaces.

A kk-jet stores derivatives up to order kk.

Two smooth functions are equivalent at a point if their derivatives agree through order kk.

The truncated algebra captures exactly this finite local behavior.

For example:

  • dual numbers correspond to first jets
  • cubic truncations correspond to second jets
  • higher truncations correspond to higher jets

Automatic differentiation over truncated algebras therefore computes finite jets of programs.

Multiple Variables

For multivariate functions, introduce several infinitesimal generators:

ε1,ε2,,εn. \varepsilon_1,\varepsilon_2,\ldots,\varepsilon_n.

A second-order algebra may satisfy:

εi3=0 \varepsilon_i^3=0

or:

εi2=0 \varepsilon_i^2=0

while mixed products survive.

A general element becomes:

a+ibiεi+i,jcijεiεj. a + \sum_i b_i\varepsilon_i + \sum_{i,j} c_{ij}\varepsilon_i\varepsilon_j.

The coefficients encode:

  • first derivatives
  • mixed partial derivatives
  • Hessian structure

This forms the basis of multivariate higher-order AD.

Example: Mixed Partial Derivatives

Let:

f(x,y)=xy+sin(xy). f(x,y)=xy+\sin(xy).

Represent:

x=a+ε1 x = a+\varepsilon_1 y=b+ε2. y = b+\varepsilon_2.

Then:

xy=ab+bε1+aε2+ε1ε2. xy = ab + b\varepsilon_1 + a\varepsilon_2 + \varepsilon_1\varepsilon_2.

The mixed product term survives.

Expanding the full function reveals coefficients involving:

ε1ε2. \varepsilon_1\varepsilon_2.

Those coefficients encode:

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

Higher-order structure emerges directly from algebraic multiplication.

Computational Complexity

Higher-order propagation becomes expensive because coefficient counts grow rapidly.

For order kk in nn variables, the number of monomials is:

(n+kk). \binom{n+k}{k}.

Growth is combinatorial.

For example:

VariablesOrderNumber of Terms
123
226
5356
1041001

This combinatorial explosion is one of the main challenges in higher-order automatic differentiation.

Sparse and Structured Representations

Practical systems rarely store full dense polynomial expansions.

Instead they exploit:

  • sparsity
  • symmetry
  • directional derivatives
  • compressed Hessians
  • low-rank structure

Methods include:

  • truncated Taylor mode
  • hyper-dual numbers
  • Hessian-vector products
  • checkpointed higher-order reverse mode

The algebraic viewpoint remains the same even when representations become optimized.

Relation to Formal Power Series

Truncated polynomial algebras are finite approximations to formal power series.

A formal power series has infinite expansion:

i=0aiεi. \sum_{i=0}^{\infty} a_i\varepsilon^i.

Truncated algebras cut this off at finite order:

i=0kaiεi. \sum_{i=0}^{k} a_i\varepsilon^i.

Automatic differentiation computes finite local expansions rather than full analytic series.

This finite truncation keeps computation practical.

Program Semantics View

Ordinary execution interprets variables as real numbers:

xR. x \in \mathbb{R}.

First-order forward AD interprets them as dual numbers:

xR[ε]/(ε2). x \in \mathbb{R}[\varepsilon]/(\varepsilon^2).

Higher-order AD interprets them as truncated polynomials:

xR[ε]/(εk+1). x \in \mathbb{R}[\varepsilon]/(\varepsilon^{k+1}).

The program structure remains unchanged.

Only the underlying algebra changes.

This is one of the deepest ideas in automatic differentiation: differentiation can be implemented by changing the algebra of evaluation.

Algebraic Summary

Truncated polynomial algebras generalize dual numbers by preserving higher-order infinitesimal terms.

The algebra:

R[ε]/(εk+1) \mathbb{R}[\varepsilon]/(\varepsilon^{k+1})

stores finite Taylor expansions up to order kk.

Evaluating a function in this algebra produces:

f(x+ε)=i=0kf(i)(x)i!εi. f(x+\varepsilon) = \sum_{i=0}^{k} \frac{f^{(i)}(x)}{i!}\varepsilon^i.

Thus:

  • coefficients become derivatives
  • multiplication propagates chain rules
  • higher-order interactions emerge naturally
  • differentiation becomes algebraic evaluation

Higher-order automatic differentiation is therefore computation over truncated polynomial algebras.