# 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)$

Discover More
Automata - Deterministic finite-state automata (DFA)

A Deterministic finite-state automata (DFA) is a finite automaton that cannot be in more than one state at any one time. The term deterministic refers to the fact that on each input there is one and only...
Ggplot - History