In mathematics, the **formal derivative** is an operation on elements of a polynomial ring or a ring of formal power series that mimics the form of the derivative from calculus. Though they appear similar, the algebraic advantage of a formal derivative is that it does not rely on the notion of a limit, which is in general impossible to define for a ring. Many of the properties of the derivative are true of the formal derivative, but some, especially those that make numerical statements, are not.

Formal differentiation is used in algebra to test for multiple roots of a polynomial.

Fix a ring (not necessarily commutative) and let be the ring of polynomials over . (If is not commutative, this is the free algebra over a single indeterminate variable.)

Then the formal derivative is an operation on elements of , where if

then its formal derivative is

In the above definition, for any nonnegative integer and , is defined as usual in a ring: (with if ).^{[1]}

This definition also works even if does not have a multiplicative identity (that is, is a rng).

One may also define the formal derivative axiomatically as the map satisfying the following properties.

- for all
- The normalization axiom,
- The map commutes with the addition operation in the polynomial ring,
- The map satisfies Leibniz's law with respect to the polynomial ring's multiplication operation,

One may prove that this axiomatic definition yields a well-defined map respecting all of the usual ring axioms.

The formula above (i.e. the definition of the formal derivative when the coefficient ring is commutative) is a direct consequence of the aforementioned axioms:

It can be verified that:

- Formal differentiation is linear: for any two polynomials
*f*(*x*),*g*(*x*) in*R*[*x*] and elements*r*,*s*of*R*we have

- The formal derivative satisfies the product rule:

- Note the order of the factors; when
*R*is not commutative this is important.

These two properties make *D* a derivation on *A* (see module of relative differential forms for a discussion of a generalization).

Note that the formal derivative is not a ring homomorphism, because the product rule is different from saying (and it is not the case) that . However, it is a homomorphism (linear map) of *R*-modules, by the above rules.

As in calculus, the derivative detects multiple roots. If *R* is a field then *R*[*x*] is a Euclidean domain, and in this situation we can define multiplicity of roots; for every polynomial *f*(*x*) in *R*[*x*] and every element *r* of *R*, there exists a nonnegative integer *m _{r}* and a polynomial

where *g*(*r*) ≠ 0. *m _{r}* is the multiplicity of

has no roots in *R*; however, its formal derivative () is zero since 3 = 0 in *R* and in any extension of *R*, so when we pass to the algebraic closure it has a multiple root that could not have been detected by factorization in *R* itself. Thus, formal differentiation allows an effective notion of multiplicity. This is important in Galois theory, where the distinction is made between separable field extensions (defined by polynomials with no multiple roots) and inseparable ones.

When the ring *R* of scalars is commutative, there is an alternative and equivalent definition of the formal derivative, which resembles the one seen in differential calculus. The element Y–X of the ring *R*[X,Y] divides Y^{n} – X^{n} for any nonnegative integer *n*, and therefore divides *f*(Y) – *f*(X) for any polynomial *f* in one indeterminate. If the quotient in *R*[X,Y] is denoted by *g*, then

It is then not hard to verify that *g*(X,X) (in *R*[X]) coincides with the formal derivative of *f* as it was defined above.

This formulation of the derivative works equally well for a formal power series, as long as the ring of coefficients is commutative.

Actually, if the division in this definition is carried out in the class of functions of continuous at , it will recapture the classical definition of the derivative. If it is carried out in the class of functions continuous in both and , we get uniform differentiability, and the function will be continuously differentiable. Likewise, by choosing different classes of functions (say, the Lipschitz class), we get different flavors of differentiability. In this way, differentiation becomes a part of algebra of functions.