Skip to content

12.2 Operation with functions

Composition

Given \(f: A \rightarrow B\) and \(g: B \rightarrow C\), we define.\((g \circ f)(a) = g(f(a)).\)

image

Example

\(f(x) = x^2: \mathbb{R} \rightarrow \mathbb{R}\) \(g(x) = \sin(x): \mathbb{R} \rightarrow [-1, 1]\)

\(g \circ f: \mathbb{R} \rightarrow [-1, 1]\) is given by \(g \circ f(x) = \sin(x^2)\)

Some properties

  1. Given: \(f: A \to B\)

    • \(f \circ id_A = f\)
    • \(id_B \circ f = f\)
  2. Composition is associative: Given image​ then: \(h \circ (g \circ f) = (h \circ g) \circ f\)

    Proof: These are functions from \(A\) to \(D\).

    Given \(a\in A\) then \(h\circ(g\circ f)\left(a\right)=h(g\circ f(a))=h(g(f))\left(a\right)=\left(h\circ g\right)\circ f\left(a\right).\)

Characteristic function

Restriction

image

Given \(f: U \to B\) and a subset \(A\subset U\), the restriction to \(A\) is the function \(f|_A: A \to B\) given by \(f|_A(a) = f(a)\)

In other words, \(f|_A = f \circ i\), where \(i: A \to U\) is the inclusion.

Example:

image

Extension

Given \(f: A \to B\) and \(U \supseteq A\), an extension of \(f\) to \(U\) is a function \(g: U \to B\) such that \(g|_A = f\)

In other words, \(g \circ i = f\).

image

Example

\(f(x) = \sqrt{x}\), \(f:R_{\geq0}\to\mathbb{R}\)

image

We want to extend it to \(\mathbb{R}\).

\(g: \mathbb{R} \to \mathbb{R}\), \(g(x)=\begin{cases}-x & \text{if }x<0\\ \sqrt{x} & \text{if }x\geq0\end{cases}\)

Example

\(f(x) = \frac{1}{x}\), \(f: \mathbb{R} - \{0\} \to \mathbb{R}\)

We define \(g: \mathbb{R} \to \mathbb{R}\) by \(g(x)=\begin{cases}\frac{1}{x} & \text{if }x\neq0\\ 0 & \text{if }x=0\end{cases}\)

image

Remark

We can also extend the codomain or both.

image

\(g\) is an extension of \(f\) if \(g(a) = f(a)\) for \(a \in A\).

Remark

We can also restrict the codomain.

image

Injective functions

A function \(f: A \to B\) is said to be one-to-one or injective if:

\(\forall x_1, x_2 \in A, \, (f(x_1) = f(x_2) \implies x_1 = x_2)\).

Or

\(\forall x_1,x_2\in A,\,(x_1\neq x_2\Rightarrow f(x_1)\neq f(x_2))\).

We can also write: \(\forall (b \in B) \, f(x) = b\) has at most one solution in \(A\).

image

Example

\(f(n)=n^2,f:\mathbb{N}\to\mathbb{N}\).

Given \(n_1, n_2 \in \mathbb{N}\), we can assume that \(n_1 < n_2\).

Then \(f(n_1)=n_1\cdot n_1<n_1\cdot n_2<n_2\cdot n_2=f(n_2)\implies f(n_1)\neq f(n_2)\).

Non-example

\(g(n) = n^2\) \(g: \mathbb{Z} \to \mathbb{Z}\)

\(g\) is not one-to-one because \(g(1) = 1^2 = g(-1)\)

image

Surjective functions

We say that \(f: A \to B\) is surjective or onto \(B\) if:

\(\forall b\in B,f^{-1}(b)\neq\emptyset\)

or \(\text{Im} \, f = B\)

or \(\forall b\in B,\exists x\in A:f(x)=b\)

image

Example

\(f(x)=x^2\,,f:\mathbb{R}\to\mathbb{R}_{\geq}0\).

This function is surjective because: given \(y\geq 0\), we choose \(x=\sqrt{y_{}}\) and then \(f(\sqrt{y})=(\sqrt{y})^2=y\).

Given \(y \geq 0\), \(f(x) = y\) has two solutions, \(\sqrt{y}\) and \(-\sqrt{y}\).

Non-example

\(g(x)=x^2,g:\mathbb{R}\to\mathbb{R}\) is not surjective because \(x^2 = -1\) doesn't have solutions.

Horizontal line test

\(f: D \subset \mathbb{R} \to \mathbb{R}\).

\(f\) is injective if each horizontal line meets the graph in at most one point.

image

\(f\) is surjective if each horizontal line meets the graph in at least one point.

imageimage

General properties

  1. \(Id_{A}:A\to A\) is surjective and injective.

  2. If \(f: A \to B\) injective and \(g: B \to C\) injective then \(g \circ f: A \to C\) injective

  3. If \(f: A \to B\) surjective and \(g: B \to C\) surjective then \(g \circ f: A \to C\) surjective

Proof

  1. Take \(id(x_1)=id(x_2)\Rightarrow x_1=x_2\)

    For any \(x\in A\), \(\exists x\in A\), \(id(x)=x\)

  2. Take \(g(f(x_1))=g(f(x_2))\), since \(g\) is injective, then \(f(x_1)=f(x_2)\)

    Also since \(f\) is injective, then \(x_1=x_2\), thus \(g\circ f\) is injective

  3. We need to prove for any \(c\in C\), \(\exists a\in A:g(f(a))=c\)

    Since \(f\) is surjective, then for any \(b\in B,\exists a\in A:f(a)=b\)

    Since \(g\) is surjective, then for any \(c\in C,\exists b\in B:g(b)=c\)

    Then we have for any \(c\in C,\exists a\in A:g(f\left(a\right))=c\)

Bijective function

A function \(f: A \to B\) is said to be a one-to-one correspondence or bijective if it is both injective and surjective.

In other words:

\(\forall b\in B,\;\exists!a\in A:f(x)=b\)

image

Example

\(f(x)=2x+1\;,f:\mathbb{R}\to\mathbb{R}\).

Given \(y \in \mathbb{R}\), we solve \(2x + 1 = y\).

\(x = \frac{y - 1}{2}\). Just one solution.

\(f\) is bijective.

Properties

  1. \(I_{A}:A\to A\) is bijective then:

  2. \(f:A\rightarrow B\) is bijective, \(g:B\rightarrow C\) is bijective then \(g\circ f:A\rightarrow C\) is bijective

Proposition

If \(f: A \to B\) is bijective, then \(f^{-1}\) is a function form \(B\) to \(A\) and \(f^{-1}\circ f=id_A\) and \(f\circ f^{-1}=id_B\)

Proof:

Let \(f^{-1}=\left\lbrace\left(b,a\right):afb\right\rbrace=\left\lbrace\left(b,a\right):f\left(a\right)=b\right\rbrace\)

Because \(f\) is surjective, given \(b \in B\), let \(\exists a \in A\) such that \(f(a) = b\)

Then \(Dom(f^{-1})=B\)

Given \((b,a_1)\), \((b,a_2)\in f^{-1}\) then \(f(a_1)=b\wedge f(a_2)=b\).

So \(a_1 = a_2\) since \(f\) is injective.

Finally, given \(a \in A\), we have \(f(a)=b\), so \(f^{-1}(b)=a\). So \(f^{-1}f(a)=a\Rightarrow f^{-1}\circ f=id_A\)

Similarly, given \(b \in B\), we choose \(a \in A\) such that \(f(a)=b,b=f\left(a\right)=f(f^{-1}(b))\Rightarrow f\circ f^{-1}=id_{B}\).