# Definition:Composition of Mappings

## Definition

Let $S_1$, $S_2$ and $S_3$ be sets.

Let $f_1: S_1 \to S_2$ and $f_2: S_2 \to S_3$ be mappings such that the domain of $f_2$ is the same set as the codomain of $f_1$.

### Definition 1

The **composite mapping** $f_2 \circ f_1$ is defined as:

- $\forall x \in S_1: \map {\paren {f_2 \circ f_1} } x := \map {f_2} {\map {f_1} x}$

### Definition 2

The **composite of $f_1$ and $f_2$** is defined and denoted as:

- $f_2 \circ f_1 := \set {\tuple {x, z} \in S_1 \times S_3: \tuple {\map {f_1} x, z} \in f_2}$

### Definition 3

The **composite of $f_1$ and $f_2$** is defined and denoted as:

- $f_2 \circ f_1 := \set {\tuple {x, z} \in S_1 \times S_3: \exists y \in S_2: \map {f_1} x = y \land \map {f_2} y = z}$

### General Definition

Let $f_1: S_1 \to S_2, f_2: S_2 \to S_3, \ldots, f_n: S_n \to S_{n + 1}$ be mappings such that the domain of $f_k$ is the same set as the codomain of $f_{k - 1}$.

Then the **composite of $f_1, f_2, \ldots, f_n$** is defined and denoted as:

\(\ds \forall x \in S_1: \map {\paren {f_n \circ \cdots \circ f_2 \circ f_1} } x\) | \(:=\) | \(\ds \begin {cases} \map {f_1} x & : n = 1 \\ \map {f_n} {\map {\paren {f_{n - 1} \circ \cdots \circ f_2 \circ f_1} } x} : & n > 1 \end {cases}\) | ||||||||||||

\(\ds \) | \(=\) | \(\ds \map {f_n} {\dotsm \map {f_2} {\map {f_1} x} \dotsm}\) |

### Commutative Diagram

The concept of **composition of mappings** can be illustrated by means of a commutative diagram.

This diagram illustrates the specific example of $f_2 \circ f_1$:

- $\begin{xy}\[email protected]+1em{ S_1 \ar[r]^*+{f_1} \[email protected]{-->}[rd]_*[l]+{f_2 \mathop \circ f_1} & S_2 \ar[d]^*+{f_2} \\ & S_3 }\end{xy}$

### Composition as a Binary Operation

Let $\sqbrk {S \to S}$ be the set of all mappings from a set $S$ to itself.

Then the concept of **composite mapping** defines a binary operation on $\sqbrk {S \to S}$:

- $\forall f, g \in \sqbrk {S \to S}: g \circ f = \set {\tuple {s, t}: s \in S, \tuple {f \paren s, t} \in g} \in \sqbrk {S \to S}$

Thus, for every pair $\tuple {f, g}$ of mappings in $\sqbrk {S \to S}$, the composition $g \circ f$ is another element of $\sqbrk {S \to S}$.

## Warning

Let $f_1: S_1 \to S_2$ and $f_2: S_2 \to S_3$ be mappings such that the domain of $f_2$ is the same set as the codomain of $f_1$.

If $\Dom {f_2} \ne \Cdm {f_1}$, then the **composite mapping** $f_2 \circ f_1$ is **not defined**.

This definition is directly analogous to that of composition of relations owing to the fact that a mapping is a special kind of relation.

## Also known as

In the context of analysis, this is often found referred to as a **function of a function**, which (according to some sources) makes set theorists wince, as it is technically defined as a **function on the codomain of a function**.

Some sources call $f_2 \circ f_1$ the **resultant of $f_1$ and $f_2$** or the **product of $f_1$ and $f_2$**.

Some authors write $f_2 \circ f_1$ as $f_2 f_1$.

Some use the notation $f_2 \cdot f_1$ or $f_2 . f_1$.

Some use the notation $f_2 \bigcirc f_1$.

Others, particularly in books having ties with computer science, write $f_1; f_2$ or $f_1 f_2$ (note the reversal of order), which is read as **(apply) $f_1$, then $f_2$**.

## Examples

### Compositions of $x^2$ with $2 x + 1$

Let $f: \R \to \R$ be the real function defined as:

- $\forall x \in \R: \map f x = x^2$

Let $g: \R \to \R$ be the real function defined as:

- $\forall x \in \R: \map g x = 2 x + 1$

Then the compositions of $f$ with $g$ are:

$f \circ g: \R \to \R$:

- $\forall x \in \R: \map {\paren {f \circ g} } x = \paren {2 x + 1}^2$

$g \circ f: \R \to \R$:

- $\forall x \in \R: \map {\paren {g \circ f} } x = 2 x^2 + 1$

### Compositions of $\sin x$ with $2 x + 1$

Let $f: \R \to \R$ be the real function defined as:

- $\forall x \in \R: \map f x = \sin x$

Let $g: \R \to \R$ be the real function defined as:

- $\forall x \in \R: \map g x = 2 x + 1$

Then the compositions of $f$ with $g$ are:

$f \circ g: \R \to \R$:

- $\forall x \in \R: \map {\paren {f \circ g} } x = \map \sin {2 x + 1}$

$g \circ f: \R \to \R$:

- $\forall x \in \R: \map {\paren {g \circ f} } x = 2 \sin x + 1$

### Arbitrary Finite Sets

Let:

\(\ds A\) | \(=\) | \(\ds \set {1, 2, 3}\) | ||||||||||||

\(\ds B\) | \(=\) | \(\ds \set {a, b}\) | ||||||||||||

\(\ds C\) | \(=\) | \(\ds \set {u, v, w}\) |

Let $\theta: A \to B$ and $\phi: B \to C$ be defined in two-row notation as:

\(\ds \theta\) | \(=\) | \(\ds \binom {1 \ 2 \ 3} {a \ b \ a}\) | ||||||||||||

\(\ds \phi\) | \(=\) | \(\ds \binom {a \ b} {w \ v}\) |

Then:

- $\phi \circ \theta = \dbinom {1 \ 2 \ 3} {w \ v \ w}$

### Arbitrary Finite Set with Itself

Let $X = Y = \set {a, b}$.

Consider the mappings from $X$ to $Y$:

\(\text {(1)}: \quad\) | \(\ds \map {f_1} a\) | \(=\) | \(\ds a\) | |||||||||||

\(\ds \map {f_1} b\) | \(=\) | \(\ds b\) |

\(\text {(2)}: \quad\) | \(\ds \map {f_2} a\) | \(=\) | \(\ds a\) | |||||||||||

\(\ds \map {f_2} b\) | \(=\) | \(\ds a\) |

\(\text {(3)}: \quad\) | \(\ds \map {f_3} a\) | \(=\) | \(\ds b\) | |||||||||||

\(\ds \map {f_3} b\) | \(=\) | \(\ds b\) |

\(\text {(4)}: \quad\) | \(\ds \map {f_4} a\) | \(=\) | \(\ds b\) | |||||||||||

\(\ds \map {f_4} b\) | \(=\) | \(\ds a\) |

The Cayley table illustrating the compositions of these $4$ mappings is as follows:

- $\begin{array}{c|cccc} \circ & f_1 & f_2 & f_3 & f_4 \\ \hline f_1 & f_1 & f_2 & f_3 & f_4 \\ f_2 & f_2 & f_2 & f_2 & f_2 \\ f_3 & f_3 & f_3 & f_3 & f_3 \\ f_4 & f_4 & f_3 & f_2 & f_1 \\ \end{array}$

We have that $f_1$ is the identity mapping and is also the identity element in the algebraic structure under discussion.

## Also see

- Results about
**composite mappings**can be found here.

## Sources

- 1967: John D. Dixon:
*Problems in Group Theory*... (previous) ... (next): Introduction: Notation

- 2011: Robert G. Bartle and Donald R. Sherbert:
*Introduction to Real Analysis*(4th ed.) ... (previous) ... (next): $\S 1.1$: Sets and Functions