Linear Algebra - Function composition

• $f : A \rightarrow B$
• and $g : B \rightarrow C$

the functional composition of f and g is the function:

• $(g \circ f) : A rightarrow C$

defined by:

• $(g \circ f)(x) = g(f (x))$

Example

Example $g \circ f$
$f : \lbrace {1, 2, 3} \rbrace \rightarrow \lbrace { A, B, C, D } \rbrace$
$g : \lbrace{A, B, C, D}\rbrace \rightarrow \lbrace{4, 5}\rbrace$
$g(y) = y%%^%%2$
$f(x) = x + 1$
$(g \circ f)(x) = (x + 1)%%^%%2$
$f: \lbrace {A, B, C, ..., Z} \rbrace \rightarrow \lbrace {0, 1, 2, ..., 25}\rbrace$
$g(x) = (x+3) mod 26$
$h: \lbrace{A, B, C, ..., Z}\rbrace \rightarrow \lbrace{0, 1, 2, ..., 25}\rbrace$
$h \circ (g \circ f)$ is the Caesar cypher

Associativity

Associativity of function composition: $h \circ (g \circ f) = (h \circ g) \circ f$

$(h \circ (g \circ f))(x)$ =

• $h(g \circ f)(x)$
• $h(g(f(x)))$
• $(h \circ g)(f(x))$
• $((h \circ g) \circ f)(x)$