Relations & Functions — Exercises

énoncés

By Pr. El Hadiq Zouhair

Contents

  1. Relation as a set of tuples easy
  2. Is this a function? easy
  3. Domain & range (finite) easy
  4. Domain of $\sqrt{x-3}/(x-7)$ medium
  5. Injectivity test medium
  6. Surjectivity test medium
  7. Inverse of a finite bijection medium
  8. Symbolic inverse medium
  9. Composition medium
  10. Pipe of $n$ functions hard
  11. $x^2$ vs $x^3$ — invertibility hard
  12. Sigmoid example hard

1Relation as a set of tuples easy

Let $A = \{1, 2, 3\}$ and $B = \{a, b, c\}$. Define the relation $R = \{(1, a), (1, b), (2, c), (3, b)\}$.

  1. Verify that $R \subseteq A \times B$.
  2. List all elements in $A$ that have at least one image in $R$ (the domain of definition).
  3. List all elements in $B$ that appear as an image (the image set).
Your answer…

2Is this a function? easy

For each relation on $A = \{1, 2, 3, 4\}$, decide whether it is a function. Use Python.

  1. $R_1 = \{(1, 1), (2, 4), (3, 9), (4, 16)\}$
  2. $R_2 = \{(1, 1), (1, 2), (2, 4), (3, 9), (4, 16)\}$
  3. $R_3 = \{(1, 1), (2, 4), (3, 9)\}$ — domain still $A = \{1,2,3,4\}$
Your answer…

3Domain & range (finite) easy

Given the dictionary f = {1:'a', 2:'b', 3:'a', 4:'c', 5:'b'}, compute the domain, the image, and the preimage of 'a' and of 'b'.

Your answer…

4Domain of $\dfrac{\sqrt{x-3}}{x-7}$ medium

Find the (real) domain of $f(x) = \dfrac{\sqrt{x-3}}{x-7}$, both by hand and with SymPy.

Your answer…

5Injectivity test medium

Decide whether each of these is injective on its domain:

  1. $f_1(x) = 3x - 4$ on $\mathbb{R}$
  2. $f_2(x) = x^2 - 4x + 7$ on $\mathbb{R}$
  3. $f_3(x) = x^2 - 4x + 7$ on $[2, \infty)$
  4. $f_4 = \{1\!\to\!a,\, 2\!\to\!b,\, 3\!\to\!a\}$
Your answer…

6Surjectivity test medium

Is the function $f : \mathbb{R} \to \mathbb{R},\; f(x) = e^x$ surjective? What about $f : \mathbb{R} \to (0, \infty),\; f(x) = e^x$?

Your answer…

7Inverse of a finite bijection medium

Let $f = \{1\!\to\!v,\, 2\!\to\!x,\, 3\!\to\!w,\, 4\!\to\!z\}$ from $\{1,2,3,4\}$ to $\{v,w,x,z\}$. Build $f^{-1}$ and verify $f^{-1}(f(k)) = k$ for every key.

Your answer…

8Symbolic inverse medium

Find the inverse of $f(x) = 2x + 5$ and of $g(x) = \dfrac{x-1}{x+1}$. Verify with SymPy.

Your answer…

9Composition medium

Let $f(x) = x^2 + 1$ and $g(x) = 2x - 3$. Compute $f \circ g$ and $g \circ f$ symbolically with SymPy, then verify numerically that $f(g(2)) = 2$ and $g(f(2)) = 7$.

Your answer…

10Pipe of $n$ functions hard

Write pipe(*fs) such that pipe(f1, f2, …, fn)(x) = fn(…f2(f1(x))) (left-to-right). Then write compose(*fs) for the mathematical right-to-left convention (f1(f2(…fn(x)))).

Your answer…

11$x^2$ vs $x^3$ — invertibility hard

Decide whether each is invertible on its stated domain, and give the inverse when it exists.

  1. $f(x) = x^2$ on $\mathbb{R}$
  2. $f(x) = x^2$ on $[0, \infty)$
  3. $f(x) = x^3$ on $\mathbb{R}$
Your answer…

12Sigmoid example hard

Let $f(x) = \dfrac{-x}{-1+x}$ and $g(x) = \log(x)$. Compute $h = f^{-1} \circ g^{-1}$, then find its domain and range with SymPy. Recognize the result.

Your answer…

Going further

Open the main lesson for the matching theory.