Katana VentraIP

Function composition

In mathematics, function composition is an operation  ∘  that takes two functions f and g, and produces a function h = g  ∘  f such that h(x) = g(f(x)). In this operation, the function g is applied to the result of applying the function f to x. That is, the functions f : XY and g : YZ are composed to yield a function that maps x in domain X to g(f(x)) in codomain Z. Intuitively, if z is a function of y, and y is a function of x, then z is a function of x. The resulting composite function is denoted g ∘ f : XZ, defined by (g ∘ f )(x) = g(f(x)) for all x in X.[nb 1]

This article is about the mathematical concept. For the computer science concept, see Function composition (computer science).

The notation g ∘ f is read as "g of f ", "g after f ", "g circle f ", "g round f ", "g about f ", "g composed with f ", "g following f ", "f then g", or "g on f ", or "the composition of g and f ". Intuitively, composing functions is a chaining process in which the output of function f feeds the input of function g.


The composition of functions is a special case of the composition of relations, sometimes also denoted by . As a result, all properties of composition of relations are true of composition of functions,[1] such as the property of associativity.


Composition of functions is different from multiplication of functions (if defined at all), and has some quite different properties; in particular, composition of functions is not commutative.[2]

Composition of functions on a finite set: If f = {(1, 1), (2, 3), (3, 1), (4, 2)}, and g = {(1, 2), (2, 3), (3, 1), (4, 2)}, then gf = {(1, 2), (2, 1), (3, 2), (4, 3)}, as shown in the figure.

Composition of functions on an : If f: RR (where R is the set of all real numbers) is given by f(x) = 2x + 4 and g: RR is given by g(x) = x3, then:

(fg)(x) = f(g(x)) = f(x3) = 2x3 + 4, and
(gf)(x) = g(f(x)) = g(2x + 4) = (2x + 4)3.

infinite set

If an airplane's altitude at time t is a(t), and the air pressure at altitude x is p(x), then (pa)(t) is the pressure around the plane at time t.

By convention, f0 is defined as the identity map on f's domain, idX.

If Y = X and f: XX admits an f−1 (sometimes called «minus first iteration»), negative functional powers fn are defined for n > 0 as the negated power of the inverse function: fn = (f−1)n.[12][10][11]

inverse function

If Y X, then f: XY may compose with itself; this is sometimes denoted as f 2. That is:


More generally, for any natural number n ≥ 2, the nth functional power can be defined inductively by fn = ffn−1 = fn−1f, a notation introduced by Hans Heinrich Bürmann[10][11] and John Frederick William Herschel.[12][10][13][11] Repeated composition of such a function with itself is called iterated function.


Note: If f takes its values in a ring (in particular for real or complex-valued f), there is a risk of confusion, as fn could also stand for the n-fold product of f, e.g. f2(x) = f(x) · f(x).[11] For trigonometric functions, usually the latter is meant, at least for positive exponents.[11] For example, in trigonometry, this superscript notation represents standard exponentiation when used with trigonometric functions: sin2(x) = sin(x) · sin(x). However, for negative exponents (especially −1), it nevertheless usually refers to the inverse function, e.g., tan−1 = arctan ≠ 1/tan.


In some cases, when, for a given function f, the equation gg = f has a unique solution g, that function can be defined as the functional square root of f, then written as g = f1/2.


More generally, when gn = f has a unique solution for some natural number n > 0, then fm/n can be defined as gm.


Under additional restrictions, this idea can be generalized so that the iteration count becomes a continuous parameter; in this case, such a system is called a flow, specified through solutions of Schröder's equation. Iterated functions and flows occur naturally in the study of fractals and dynamical systems.


To avoid ambiguity, some mathematicians choose to use to denote the compositional meaning, writing fn(x) for the n-th iterate of the function f(x), as in, for example, f∘3(x) meaning f(f(f(x))). For the same purpose, f[n](x) was used by Benjamin Peirce[14][11] whereas Alfred Pringsheim and Jules Molk suggested nf(x) instead.[15][11][nb 3]

Alternative notations[edit]

Many mathematicians, particularly in group theory, omit the composition symbol, writing gf for gf.[16]


In the mid-20th century, some mathematicians decided that writing "gf" to mean "first apply f, then apply g" was too confusing and decided to change notations. They write "xf" for "f(x)" and "(xf)g" for "g(f(x))".[17] This can be more natural and seem simpler than writing functions on the left in some areas – in linear algebra, for instance, when x is a row vector and f and g denote matrices and the composition is by matrix multiplication. This alternative notation is called postfix notation. The order is important because function composition is not necessarily commutative (e.g. matrix multiplication). Successive transformations applying and composing to the right agrees with the left-to-right reading sequence.


Mathematicians who use postfix notation may write "fg", meaning first apply f and then apply g, in keeping with the order the symbols occur in postfix notation, thus making the notation "fg" ambiguous. Computer scientists may write "f ; g" for this,[18] thereby disambiguating the order of composition. To distinguish the left composition operator from a text semicolon, in the Z notation the ⨾ character is used for left relation composition.[19] Since all functions are binary relations, it is correct to use the [fat] semicolon for function composition as well (see the article on composition of relations for further details on this notation).

Multivariate functions[edit]

Partial composition is possible for multivariate functions. The function resulting when some argument xi of the function f is replaced by the function g is called a composition of f and g in some computer engineering contexts, and is denoted f |xi = g


When g is a simple constant b, composition degenerates into a (partial) valuation, whose result is also known as restriction or co-factor.[20]





In general, the composition of multivariate functions may involve several other functions as arguments, as in the definition of primitive recursive function. Given f, a n-ary function, and n m-ary functions g1, ..., gn, the composition of f with g1, ..., gn, is the m-ary function


This is sometimes called the generalized composite or superposition of f with g1, ..., gn.[21] The partial composition in only one argument mentioned previously can be instantiated from this more general scheme by setting all argument functions except one to be suitably chosen projection functions. Here g1, ..., gn can be seen as a single vector/tuple-valued function in this generalized scheme, in which case this is precisely the standard definition of function composition.[22]


A set of finitary operations on some base set X is called a clone if it contains all projections and is closed under generalized composition. A clone generally contains operations of various arities.[21] The notion of commutation also finds an interesting generalization in the multivariate case; a function f of arity n is said to commute with a function g of arity m if f is a homomorphism preserving g, and vice versa i.e.:[21]


A unary operation always commutes with itself, but this is not necessarily the case for a binary (or higher arity) operation. A binary (or higher arity) operation that commutes with itself is called medial or entropic.[21]

Typography[edit]

The composition symbol is encoded as U+2218 RING OPERATOR (∘, ∘); see the Degree symbol article for similar-appearing Unicode characters. In TeX, it is written \circ.

– a graphical technique for functional composition

Cobweb plot

Combinatory logic

a formal axiomatization of the composition operation

Composition ring

Flow (mathematics)

Function composition (computer science)

distribution of a function of a random variable

Function of random variable

Functional decomposition

Functional square root

Higher-order function

Infinite compositions of analytic functions

Iterated function

Lambda calculus

, Encyclopedia of Mathematics, EMS Press, 2001 [1994]

"Composite function"

"" by Bruce Atwood, the Wolfram Demonstrations Project, 2007.

Composition of Functions