What is the difference between (fo(goh)(x) and ((fog)oh)(x)?

1 Answer
Nov 28, 2015

Function composition is associative, that is

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

There is no difference in the result, though the steps may be expressed differently.

Explanation:

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

For example, suppose:

f(x) = x^2

g(x) = 1/x

h(x) = x + 1

Then:

(g@h)(x) = g(h(x)) = 1/(x+1)

(f@(g@h))(x) = f((g@h)(x)) = f(1/(x+1)) = 1/(x+1)^2

(f@g)(x) = f(g(x)) = 1/x^2

((f@g)@h)(x) = (f@g)(h(x)) = (f@g)(x+1) = 1/(x+1)^2