Function composition: definition, properties, examples and applications
Function composition combines two functions into one by feeding the output of the first into the second. This article explains notation, properties, examples, generalizations and common uses.
Overview
Function composition is an operation that builds a new mapping by applying one function and then another. In elementary terms, if f sends elements of a set X to Y, and g sends elements of Y to Z, then composing g with f yields a map from X to Z that applies f first and then g. Composition is fundamental across calculus, algebra, programming and category theory because it captures the idea of chaining transformations.
Definition and notation
Given two functions f: X → Y and g: Y → Z the composite is written g ∘ f and defined by (g ∘ f)(x) = g(f(x)) for every x in X. The order of symbols can be counterintuitive: the symbol on the right is applied first. Authors sometimes use alternative notations such as g(f(x)) or g∘f to emphasize that the output of f becomes the input of g. For background on the general concept of functions see mathematics and on the idea of forming a new function from two others.
Key properties
- Associativity: Composition is associative: (h ∘ g) ∘ f = h ∘ (g ∘ f) when domains and codomains match, so long chains can be unambiguously evaluated.
- Identity elements: For each set there is an identity function id that leaves inputs unchanged; id ∘ f = f = f ∘ id.
- Noncommutativity: In general g ∘ f ≠ f ∘ g, so the order of application matters.
- Invertibility: If f and g are invertible and their domains align, then (g ∘ f)^{-1} = f^{-1} ∘ g^{-1}.
Examples and illustrations
Concrete numerical examples make the operation clear. Let f(x) = 2x (a rule that doubles a number) and let g(x) = x − 1 (which subtracts one). Then (g ∘ f)(x) = g(2x) = 2x − 1 while (f ∘ g)(x) = 2(x − 1) = 2x − 2; the two composites are distinct. The symbolic placement of each operation and a simple diagram can help visualize this process.
Generalizations and applications
Composition extends beyond real-valued functions. It applies to functions between sets, linear operators on vector spaces, measurable maps in probability, and morphisms in category theory. It also generalizes to binary relations, where relation composition composes pairs according to a shared intermediate element. In programming, composing functions implements pipelines and middleware; in geometry, composing transformations yields rotations, translations, and scalings combined into a single transform. For operations like multiplication by a constant one may note the relation to arithmetic: the doubling f(x)=2x uses multiplication, a fact connected to basic algebraic structure (multiply).
Distinctions and notable facts
Because composition is associative, long chains of mappings are normally unambiguous, but care is needed with domains and codomains: composition is defined only when the codomain of the first matches the domain of the second. Unlike many binary operations, composition has a directional flavor: composing on the left or right has different effects, which is important in function algebras and operator theory. Historical development of the notation and formal treatment of composition followed the evolution of function concept and modern algebraic language.
Understanding composition helps unify many mathematical constructions: complex formulas, iterative procedures, transformations in graphics, and modular program design are all organized by composing simpler pieces into more complex ones.
Questions and answers
Q: What is function composition?
A: Function composition is a way of making a new function from two other functions through a chain-like process.
Q: How is the value of g composed with f written?
A: The value of g composed with f is written as (g ∘ f)(x), and is defined as g(f(x)).
Q: What are some examples of functions?
A: An example could be a function which doubles a number (multiplies it by 2) and another which subtracts 1 from a number.
Q: What would be an example of g composed with f?
A: An example of g composed with f would be the function which doubles a number, and then subtracts 1 from it. That is (g ∘ f)(x)=2x-1.
Q: What would be an example of f composed with g?
A: An example of f composed with g would be the function which subtracts 1 from a number, and then doubles it; that is (f ∘ g)(x)=2(x-1).
Q: Can composition also be generalized to binary relations?
A: Yes, composition can also be generalized to binary relations, where it is sometimes represented using the same symbol (as in R ∘ S).
Related articles
Author
AlegsaOnline.com Function composition: definition, properties, examples and applications Leandro Alegsa
URL: https://en.alegsaonline.com/art/37014
Sources
- proofwiki.org : proofwiki.org