Is function composition associative?

2 Answers
Jul 24, 2015

Yes

Explanation:

Given composable functions #f#, #g# and #h#

#(f@(g@h))(x)#

#= f((g@h)(x)) = f(g(h(x))) = (f@g)(h(x))#

#= ((f@g)@h)(x)#

So #f@(g@h) = (f@g)@h#

It is, if the following works:

#(f@(g@h))(x) = ((f@g)@h)(x)#

That is, if:

#f(x) = "something"#
#g(h(x)) = (g@h)(x) = "something else"#
#f(g(x)) = (f@g)(x) = "something else again"#
#h(x) = "something else yet again"#

...and you can use these together to satisfy the first expression, then they are associative. Let:

#f(x) = 2x#
#g(x) = x^2#
#h(x) = x^3#

Thus:

#g(h(x)) = g(x^3) = (x^3)^2 = x^6#

#f(g(x)) = g(x^2) = 2(x^2) = 2x^2#

Then:

#(f@(g@h))(x) = f(x^6) = 2(x^6) = color(blue)(2x^6)#

#((f@g)@h)(x) = f(g(x^3)) = f((x^3)^2) = f(x^6) = color(blue)(2x^6)#

Therefore they are associative.