# Composition is not commutative

Contrary to the properties of sums and products, **order matters in composition**. In general, $$$f\circ g\ne g\circ f.$$$ We say that composition is **not commutative**.

Setting $$f(x) = x^2$$ and $$g(x) = x+1$$, we see that, for $$x\ne0$$, $$$f\circ g(x) = (x+1)^2\ne x^2+1 = g\circ f(x).$$$

However, for the **inverse function**, we have $$$ f\circ f^{-1}(y) =y,\qquad f^{-1}\circ f(x) =x $$$ This comes from $$y=f(x)\Longleftrightarrow x=f^{-1}(y)$$.

**The composition of monotonic functions is monotonic**. If both functions have same monotonicity (both increasing or decreasing), the composite function is increasing; otherwise it is decreasing.

To see this, assume that both $$f$$ and $$g$$ are decreasing. Then, for $$x\le y$$, we have $$g(x)\ge g(y)$$, hence $$f\left(g\left(x\right)\right)\le f\left(g\left(x\right)\right)$$. This means that means that $$f\circ g$$ is increasing.