Function composition

Composition of functions

Let and be functions. The composition of and is the function $\boxed{ (f \circ g): A \rightarrow C }$, can also define this for all $a \in A$ as: $$ (f \circ g)(a) = f(g(a)) $$

We only define the composition when the codomain of is equal to the domain of .

Link to original

title: Example
Let $X = \{ a,b,c \}$ and $Y = \{ 1,2,3 \}$.
Let the function $g: X \rightarrow X$ be defined by:
 
$$
	g(a) = b, \hspace{12px} g(b) = c, \hspace{12px} g(c) = a
$$
 
Let the function $f: X \rightarrow Y$ be defined by:
 
$$
	f(a) = 3, \hspace{12px} f(b) = 2, \hspace{12px} f(c) = 1
$$
 
Then:
- $(f \circ g)(a) = f(g(a)) = f(b) = 2$
- $(f \circ g)(b) = 1$
- $(f \circ g)(c) = 3$
- $(g \circ g)(a) = c$
- $(g \circ g)(b) = a$
- $(g \circ g)(c) = b$

Properties of composition

  • Even if both and are defined, and can differ. Let and be both functions, defined by and , then:
  • is associative:
  • If is a bijection then and
  • For any function ,