# Bijections and compositions

A function $$f:X\to Y$$ is bijective if, for each value $$y\in Y$$, there is exactly one element $$x\in X$$ that is mapped to $$y$$. In other words, the equation $$$y=f(x)$$$ has a unique solution $$x$$ for every $$y$$.

We call $$x$$ the pre-image of $$y$$ and we denote it $$f^{-1}(y)$$. We usually compute the pre-image of $$y$$ by expressing $$x$$ in terms of $$y$$.

A bijective function is also called a bijection or a one-to-one correspondence.

The function $$x^2$$ defined on $$\R$$ is not bijective, because $$1$$ has two pre-images ($$f(-1) = f(1) = 1$$).

The function $$ x^3$$ is bijective on $$\R$$, because every $$y$$ in $$\R$$ has a unique pre-image, specifically $$x=y^{1/3}$$.

The composition of functions is the successive application of functions. The resulting function is called a composite function.

The composite of $$f(x)=2x$$ and $$g(x)=x^2$$ is $$h(x)=f(g(x))=2x^2$$.

More formally, if $$g:D_g\to R_g$$ and $$f:D_f\to R_f$$ are two functions with $$$R_g\subset D_f,$$$ the composite function $$f\circ g$$ is the function from $$D_g$$ to $$R_f$$ defined by $$$f\circ g (x) = f\big(g(x)\big).$$$

The composite function is written either as $$f\circ g$$ or $$fg$$ and is read $$f$$ of $$g$$. $$fg$$ is often used for the product of functions, so $$f\circ g$$ should be preferred.

$$h(x) = \sin(x^2)$$ is the composite $$\sin\circ g$$ where $$g(x) = x^2$$. $$\vert x^3\vert$$ is the composite function $$f\circ g$$ with $$f(x) =\vert x\vert$$ and $$g(x) = x^3$$.

The inverse function of a bijection $$f:X\to Y$$ is the function $$f^{-1}:Y\to X$$ that maps each value to its unique pre-image $$$ y=f(x) \Longleftrightarrow x=f^{-1}(y). $$$

The inverse of $$x^2$$ from $$[0, +\infty)$$ to $$[0, +\infty)$$ is $$\sqrt{x}$$. This is because $$y=x^2$$ is equivalent to $$x = \sqrt{y}$$. The inverse of $$\ln x$$ is $$ e^x$$.

The domain of the inverse $$f^{-1}$$ is the range of the original function $$f$$. The range of the inverse $$f^{-1}$$ is the domain of $$f$$. To summarise, $$$ D_{f^{-1}} = R_f,\quad R_{f^{-1}} = D_f. $$$

$$(0,+\infty)$$ is the range of $$e^x$$ and the domain of $$\ln x$$.

The inverse function is bijective and its inverse is the original function $$$(f^{-1})^{-1} = f. $$$

The **graph of the inverse function** is deduced from the graph of the function by a reflection across the line $$y=x$$. This is because the two graphs simply have the $$x$$ and $$y$$ axes inverted.

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.