# Associative Property for Composition of Functions

Please explain me proof of "Associative Property for Composition of Functions"

-
@JackManey: There is no need to be rude to new users even if the question is not ideal. I think we should be more welcoming of new users. Specifically, see this meta question, and the most upvoted answer there: What should we do with poorly posed questions? –  Eric Naslund Aug 30 '12 at 23:12
@EricNaslund - This question is not poorly posed--at least not in the sense that it's easy to understand what the OP is looking for--but the OP is clearly asking for help without putting forth any effort. That's not acceptable on Stack Overflow; why should it be acceptable here? –  user5137 Aug 31 '12 at 2:51
@EricNaslund There is something about "Explain the answer of my question before my test day after tomorrow." that makes them easy to downvote :( –  rschwieb Aug 31 '12 at 16:31

Let $A$, $B$, $C$, and $D$ be sets. Let $f : A \rightarrow B$, $g : B \rightarrow C$, and $h : C \rightarrow D$. Take any $a \in A$.

$(h \circ (g \circ f))(a) = h ((g \circ f)(a)) = h(g(f(a)))$ $\color{red}{(1)}$

On the other hand

$((h \circ g)\circ f))(a) = (h \circ g)(f(a)) = h(g(f(a))$ $\color{blue}{(2)}$

$\color{red}{(1)}$ and $\color{blue}{(2)}$ are equal for any abitrary $a \in A$. Hence $(h \circ g)\circ f = h \circ (g \circ f)$. This gives associativity.

-

Both $f\circ(g\circ h)$ and $(f\circ g)\circ h$ are functions which take an argument $x$ and yield $f(g(h(x))$. Since they always yield the same result for the same argument, they are the same function.

-

It means that if you have three functions $f,g,h$, then $f\circ(g\circ h)$ is the same function as $(f\circ g)\circ h$.

Proving this is just a routine verification, since $(f\circ g)(x)$ is defined to be $f(g(x))$.

Let's write some of it out: $f\circ(g\circ h)(x)=f((g\circ h)(x))=f(g(h(x)))=$?

Perhaps at this point you might start at the other end ($(f\circ g)\circ h$) and see if that connects with this.

-