Composition of Functions

Given two functions [math]f[/math] and [math]g[/math], the composition of the functions [math]g\circ f[/math] exists if the target of [math]f[/math] is a subset of the domain of [math]g[/math]. Conversely, [math]f\circ g[/math] exists if the target of [math]g[/math] is a subset of the domain of [math]f[/math].[br][br]Taking by example the functions [math]f:R\longrightarrow R,f\left(x\right)=3\left(x+2\right)[/math] and [math]g:R\longrightarrow R,g\left(x\right)=-5x+2[/math], does the composition [math]f\circ g[/math] exist? What about [math]g\circ f[/math]?[br][br]The two functions are graphed below, evaluate [math]f(g(2))[/math], [math]f(g(-4))[/math], [math]g(f(3.5))[/math]. Can you write a general expression for [math]f(g(x))[/math]? what about [math]g(f(x))[/math]?
It is not always possible to compose functions because their domains and targets may not match correctly. The next graph shows [math]h:\left[2,+\infty\right]\longrightarrow R,h\left(x\right)=\sqrt{x-2}[/math] and [math]k:R\longrightarrow R,k\left(x\right)=x^3[/math].[br][br] Which composition exists without any changes? Which composition has to have the domain/target modified? What changes are necessary?
Think about the following statement: "The compositions [math]f\circ g[/math] and [math]g\circ f[/math] are always equal, i.e. [math]f\circ g=g\circ f[/math]." Is it true or false? Why?[br][br] To help you test your answer, compare the values of [math]sin\left(cos\left(\frac{\pi}{2}\right)\right)[/math] and [math]cos\left(sin\left(\frac{\pi}{2}\right)\right)[/math]; [math]sin(cos(1.9))[/math] and [math]cos(sin(1.9))[/math]; [math]sin\left(cos\left(-5\right)\right)[/math] and [math]cos\left(sin\left(-5\right)\right)[/math] in the graph below.
The graphs of [math]h\left(x\right)=sin\left(cos\left(x\right)\right)[/math] and [math]p\left(x\right)=cos\left(sin\left(x\right)\right)[/math] below will give you a better idea of why that does not happen. Is there any point where [math]h\left(x\right)=p\left(x\right)?[/math]

Information: Composition of Functions