Skip to content

8.16 Function Tutorial

Identity function

Let \(X\) be a set.The identity function on \(X\) is the function \(id_x:\mathbb{X}\rightarrow \mathbb{X}\) given by \(id_x(x)=x\) for all \(x\in \mathbb{X}\)

If the identity function is \(\R\rightarrow \N\), then we write \(id(x)=x,~id(x):\mathbb{R}\rightarrow \mathbb{N}\)

Constant function

If \(x\) and \(y\) are sets and \(c\in \mathbb{Y}\),the constant function is the function \(K_c:\mathbb{X}\rightarrow \mathbb{Y}\) given by \(K_c(x)=c\) for all \(x\in \mathbb{X}\)

Inclusion function

Let \(A\) and \(X\) be sets with \(A\subseteq X\). The inclusion function of \(A\) in \(X\) is the function \(l:A\rightarrow X\) given by \(l(x)=x\) for all \(x\in A\)

Restriction function

If \(f:X\rightarrow Y\) is a function and \(A\subseteq X\), the restriction function of \(f\) to \(A\) is the function \(f|_A:A\rightarrow Y\) given by \(f|_A(x)=f(x)\) for all \(x\in A\)

Remark

If \(f\) is invetible, then its inverse is unique and is denoted \(f^{-1}\)

Suppose that \(g:Y\rightarrow X,~g\prime :Y\rightarrow X\) are inverse of \(f\) then (below explanation: \(f:X\rightarrow Y\), \(g:Y\rightarrow X\). So \(g\circ f: X\rightarrow X\) )

\[ g\circ f=id_x=g\prime \circ f~~~~~f\circ g=id_y=f\circ g\prime \]
\[ g=g\circ id_y=g\circ (f\circ g\prime)=(g\circ f)\circ g\prime=id_x \circ g\prime=g\prime \]

Definition of image

Let $f:X\rightarrow Y $ be a function

If \(A\subseteq X\), the direct image of \(A\) under \(f\), denote \(f(A)\), is the set

\[ f(A)=\{y\in Y:y=f(x)~for~some~x\in A\} \]

If \(C\subseteq Y\), the inverse image of \(C\) under \(f\), denote \(f^{-1}(C)\), is the set

\[ f^{-1}(C)=\{x\in X:f(x)\in C\} \]

Remark

Note that \(f(x)=Ran(f)\)

Exercise

  1. If \(f:X\rightarrow Y~and~g:Y\rightarrow Z\) are function. Prove that

    (a) if \(f\) and \(g\) are injective, then \(g\circ f\) is injective

    (b) if \(f\) and \(g\) are surjective, then \(g\circ f\) is surjective

    (c) if \(f\) and \(g\) are bijective, then \(g\circ f\) is bijective

    Proof

    (a) Considering that \(f\) and \(g\) are injective. We still use definition.

    Then we take \(x_1,x_2\in X\) and then \(g(f(x_1))=g(f(x_2))\)

    Since \(g\) is injective, then \(f(x_1)=f(x_2)\)

    Since \(f\) is injective, then \(x_1=x_2\)

    Therefore \(g\circ f\) is injective.

    (b) Suppose that \(f\) and \(g\) are surjective, Let \(z\in Z\) as \(g\) is surjective, there exists \(y\in Y\) such that \(z=g(y)\) and as \(f\) is surjective, there exists \(x\in X\) such that \(y=f(x)\).

    Hence \(z=g(y)=g(f(x))=(g\circ f)(x)\) and thus \(g\circ f\) is surjective.

    (c) Follows from (a) and (b)

  2. Let \(f:\mathbb{R}\rightarrow \mathbb{R}~and~g:\mathbb{R}\rightarrow \mathbb{R}\), be functions given by

    \(f(x)=\begin{cases}x^{2}+2&\mathrm{if~}x\leq0\\3-x^{2}&\mathrm{if~}x>0\end{cases}g(x)=\begin{cases}-\sqrt{x-2}&\mathrm{if~}x\geq2\\\sqrt{2-x}&\mathrm{if~}x<2\end{cases}\)

    Prove that \(g=f^{-1}\)

    Proof

    We need to prove that \(g\circ f=id_R\) and \(f\circ g=id_R\)

    If \(x\) \(\leq 0\), then \(x^2\geq0\) and \(x^2+2\geq 0\)

    Hence \((g\circ f)(x)=g(f(x))=g(x^{2}+2)=-\sqrt{(x^{2}+2)-2}=-\sqrt{x^{2}}=-|x|=x=id_{R}(x)\)

    If \(x>0\) then \(x^2>0\) and \(2-x^2<2\)

    Hence \((g\circ f)(x)=g(f(x))=g(2-x^{2})=\sqrt{2-(2-x^{2})}=\sqrt{x^{2}}=|x|=x=id_{R}(x)\)

    Therefore \((g\circ f)(x)=id_R(x)\) for all \(x \in \mathbb{R}\) and thus \(g\circ f=id_R\)

  3. Suppose \(f:X\rightarrow Y~and~g:Y\rightarrow Z\) are function. Prove that

    (a) if \(g\circ f\) is injective, then \(f\) is injective

    We need to prove f is injective, it is equivalent to take \(f(x_1)=f(x_2)\) (y1=y1,then prove \(x_1=x_2\))

    Now since \(f(x_1)=f(x_2)\), then \(g(f(x_1))=g(f(x_2))\)

    Now \(g\circ f\) is injective by hypothesis and we have \((g\circ f)(x_1)=(g\circ f)(x_2)\Rightarrow x_1=x_2\Rightarrow f\) is injective

    (b) if \(g\circ f\) is surjective, then \(g\) is surjective

    To prove \(g\) is surjective, we need to prove \(\forall z\in Z, \exists y\in Y such~that~g(y)=z\)

    Since \(g\circ f\) is surjective, then \(\forall z\in Z, \exists x\in X such~that~g(f(x))=z~with~f(x)\in Y\)

    Therefore \(g\) is surjective

  4. If \(f:X\rightarrow Y\) be a function, \(A\subseteq X\) and \(B\subseteq Y\). Prove that

(a) \(A\subseteq f^{-1}(f(A))\)

To prove it, we need to prove \(a\in A \Rightarrow a\in f^{-1}(f(A))\)

Pick \(a\in A\subseteq X\), then \(f(a)\in f(A)\Rightarrow a\in f^{-1}(f(A))\), then \(A\subseteq f^{-1}(f(x))\)

(b) \(f(f^{-1}(B))\subseteq B\)

Definition: \(f^{-1}(B)=\{a\in X:f(a)\in B\}\) means \(a\in f^{-1}(B)\) if \(f(a)\in B\)

Now, if \(B=f(A)\), then \(a\in f^{-1}(f(A))\) since \(f(a)\in f(A)\)

To prove \(f(f^{-1}(B))\subseteq B\), we need to prove that if \(y\in f(f^{-1}(B))\Rightarrow y\in B\)

Pick \(y\in f(f^{-1}(B))\Rightarrow f^{-1}(y)\in f^{-1}(B)\Rightarrow y\in B\)

Remark

Note that \(A\supseteq f^{-1}(f(A))~and~f(f^{-1}(B))\supseteq B~are~not~always~true\)

Consider \(f:\R\rightarrow\R\) given by \(f(x)=x^2\), \(A=\{-1\}\)

\(f^{-1}(f(A))=f^{-1}(\{1\})=\{1,-1\}\)

Then \(f^{-1}(f(A))=\{1,-1\}\nsubseteq \{-1\}=A\)

Consider \(f:\Z_{\geq0}\rightarrow \Z\) given by \(f(x)=x\), \(B=\{1,-1\}\)

then \(B=\{1,-1\}\nsubseteq f(f^{-1}(B))=f(f^{-1}(\{1,-1\}))=f(\{1\})=\{1\}\)

  1. A function \(f:X\rightarrow Y\) has a right inverse if there exists a function \(g:Y\rightarrow X\) such that \(f\circ g=id_y\). Prove that \(f\) is surjective, if and only if it has a right inverse

    Proof

    \(\Rightarrow\)) Suppose \(f\) is surjective. We must define a function \(g\) such that \(f\circ g= id_y\).

    We define \(g\) as follows: on a given input \(y\), we know that there is at least one \(x\) with \(f(x)=y\) (since \(f\) is surjective). We choose one such \(x\) and define \(g(y)=x\)​.

    With this definition, it is clear that \((f\circ g)(y)=y\), so \(g\) is a right inverse of \(f\)​, as required.

    \(\Leftarrow\)) Suppose that \(f\) has a right inverse, that is, there exists a function \(g:Y\rightarrow X\) such that \(f\circ g=id_y\).

    Let \(y\in Y\) then \(y=id_y(y)=(f\circ g)(y)=f(g(y))~with~(g(y)\in X)\)

    Therefore \(f\) is surjective

  1. Let \(f:X\rightarrow Y\) be a function. \(A,B\subseteq X\) and \(C,D\subseteq X\). Prove that

    • \(f(A\cap B)\subseteq f(A)\cap f(B)\)

    跳转 * \(f(A\cup B)=f(A)\cup f(B)\)

    \($\subseteq$\)Let \(y\in f(A\cup B)\) then \(y=f(x)\) for some \(x\in A\cup B\), that is \(x\in A\) or \(x\in B\)

    Therefore \(y=f(x)\in f(A)~or~y=f(x)\in f(B)\)

    Hence \(y\in f(A\cup B)\) and thus \(f(A\cup B)=f(A)\cup f(B)\)

    (\(\supseteq\)) Let \(y\in f(A)\cup f(B)\), then \(y\in f(A)\) or \(y\in f(B)\), that is, \(y=f(x)\) for some \(x\in A\) or \(y=f(x')\) for some \(x'\in B\)

    Hence \(y=f(x)\) for some \(x\in A\) or \(x\in B\).

    Therefore \(y=f(x)\) for some \(x\in A\cup B\), that is, \(y\in f(A\cup B)\) and thus \(f(A)\cup f(B)\subseteq f(A\cup B)\) * \(f^{-1}(C\cap D)=f^{-1}(C)\cap f^{-1}(D)\)

    Pick \(x\in f^{-1}(C\cap D)\)

    [[elementary set theory - prove \(f^{-1}(C \cap D) = f^{-1}(C) \cap f^{-1}(D)\) - Mathematics Stack Exchange]] * \(f^{-1}(C\cup D)=f^{-1}(C)\cup f^{-1}(D)\)

    same above

  1. \(f:A\rightarrow B~|~prove:f~is~bijective\Leftrightarrow \exists~inverse~of~f\)

    \(\Rightarrow\)) Since \(f\) is bijective. \(\forall b\in B,\exists ! a\in A\) such that \(f(a)=b\)

    Claim: \(g: B \rightarrow A\)

    Hence \(g(b)=a\) due to bijection

    Then we want to prove exist inverse of \(f\)

    We should prove that \(f\circ g=id_B, g\circ f=id_A\)

    So, \(f\circ g(b)=f(g(b))=f(a)=b=id_B(b)\)

    \(g\circ f(a)=g(f(a))=g(b)=a=id_A(a)\)

    Therefore, \(\exists~inverse~of~f\)

    \(\Leftarrow\)) Suppose that \(f:A\rightarrow B\) is invertible that is , there exist a function \(g:B\rightarrow A\) such that \(f\circ g=id_B\) and \(g\circ f=id_A\)

    • \(f\) is injective

    If \(f(x_1)=f(x_2)\) then \(g(f(x_1))=g(f(x_2))\), that is

    \((g\circ f)(x_1)=(g\circ f)(x_2)\)

    \(id_A(x_1)=id_A(x_2)\)

    \(x_1=x_2\)

    Therefore \(f\) is injective * \(f\) is surjective

    Let \(b\in B\) then

    \(b=id_B(b)=(f\circ g)(b)=f(g(b))~with~g(b)\in A\)

    Therefore \(f\) is surjective

    Therefore \(f\) is bijective