Exercises – Short Day#
Exercise 1: Python Exercise#
This exercise revisits the formula mentioned in Question 2c from Long Day this week.
Use command console Python on your computer for running the following program. You can either type the given code into your console or copy-paste the given Python code lines below.
Question a#
A set in the form \(\{1,2,3\}\) can be input into Python by typing {1,2,3}
in the command console. As explained in the beginning of Section 2.1 in the textbook the order of elements is not important in a set. How can we check with the help of Python that for example \(\{1,2,3\}=\{1,3,2\}\)? Duplicated elements in a set also does not change the set. For instance we have \(\{1,1,2\}=\{1,2\}\). Try to check this identity in Python.
Hint
Two sets \(A\) and \(B\) are equal precisely if the equation \(A=B\) is true. Last week (Short Day’s Questions 2a and 2c) we already saw how to check if two things are equal in Python.
Hint
What happens if you write {1,2,3} == {1,3,2}
in Python?
Question b#
Run the following Python code:
A={9, 12, 15, 21, 24, 27, 30, 33, 36, 42, 48, 51, 54, 57, 60, 63, 66, 69, 72, 78, 81, 84, 87, 90, 93, 96}
B={12, 16, 24, 28, 32, 36, 48, 52, 56, 60, 64, 68, 72, 80, 84, 88, 92, 96}
len(A)
len(B)
What is the meaning of the command len
?
Answer
len(A)
provides the number of elements in a set \(A\). In Question 2c from this week’s Long Day this number was denoted \(|A|\).
Question c#
The intersection and the union of two sets \(A\) and \(B\) can be computed with Python as A.union(B)
and A.intersection(B)
.
Try the commands on the two sets \(A\) and \(B\) from Question a.
Question d#
Now check with Python that the formula \(|A \cup B|=|A|+|B|-|A \cap B|\) holds true for the two sets from Question a.
Answer
You can run the command len(A.union(B))==len(A)+len(B)-len(A.intersection(B))
. The output is True
, meaning that the formula works!
Question e#
We now introduce a new set \(C\):
C={6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96}
Try formulating an identity about \(|A \cup B \cup C|\), now with the three sets \(A\), \(B\) and \(C\) rather than just the two from before. You can check with Python whether you have created a formula that works.
Exercise 2: Composite functions#
We are given the set \(A=\{0,1,2\}\) as well as the two function \(f: A \to A\) and \(g: A \to \mathbb{R}\). \(f\) is defined by the expression \(f(x)=2-x\) while \(g\) is defined by the expression \(g(x)=2x+\mathrm e^x\).
Question a#
Is the composite function \(f \circ g\) defined? What about \(g \circ f\)?
Hint
In the textbook right after Example 2.2.2 you can read about what must be fulfilled before two functions can be connected into a composite function.
Answer
\(f \circ g\) is not defined since the co-domain of \(g\) is \(\mathbb R\), which is not the domain of \(f\) (that is, \(A\)).
\(g \circ f\) is defined since the co-domain of \(f\) is the same as the domain of \(g\) (which is \(A\)).
Note that we do not need to know the functional expressions for the two functions to be able to determine whether a composition of them is defined. Just knowing their domains and co-domains is sufficient.
Question b#
Compute \((g\circ f)(a)\) for all \(a \in A\).
Answer
\((g \circ f)(0)=4+\mathrm e^2\), \((g \circ f)(1)=2+\mathrm e\), and \((g \circ f)(2)=1\).
The steps to achieve the latter answer are:
Question c#
Determine the functional expression, domain, co-domain, and image set (also called the range) of the function \(g\circ f.\)
Hint
The image set can be determined from the answer to Question b. The domain and co-domain can be determined from the definition of a composite function.
Answer
Functional expression: \((g \circ f)(x)=2(2-x)+\mathrm e^{2-x}\) (or a bit nicer: \((g \circ f)(x)=4-2x+\mathrm e^{2-x}\)).
Image set: \(\{4+\mathrm e^2,2+\mathrm e,1\}\) (it is also fine to order the numbers by size and give as an answer \(\{1,2+e,4+\mathrm e^2\}\)).
Domain: \(A\), that is: \(\{0,1,2\}\).
Co-domain: \(\mathbb R\).
Question d#
Is the function \(g \circ f\) injective? What about surjective?
Answer
Injective: Yes. Surjective: No.
Exercise 3: Invers Functions#
For a given bijective function \(f: A \to B\) the corresponding inverse function is denoted by \(f^{-1}: B \to A\) (see Definition 2.2.1 in the textbook). The natural logarithm \(\mathrm{ln}\) is introduced in Example 2.3.2 as the inverse function of the exponential function \(\mathrm{exp}: \mathbb{R} \to \mathbb{R}_{>0}\) given by the expression \(x\mapsto \mathrm e^x.\)
Question a#
State the domain, co-domain, and image set of \(\mathrm{ln}\).
Answer
Domain: \(\mathbb{R}_{>0}\).
Co-domain: \(\mathbb{R}\).
Image set: \(\mathbb{R}\).
Question b#
State the functional expression, domain, co-domain, and image set of the composite functions \(\mathrm{ln} \circ \mathrm{exp}\) and \(\mathrm{exp} \circ \mathrm{ln}\).
Hint
If you are in doubt about what the notation \(g \circ f\) exactly means, the see an explanation in the textbook right after Example 2.2.2. If you wish to read the definition of an inverse function, you can look up Definition 2.2.1.
Answer
From Definition 2.2.1 we have \(\mathrm{ln} \circ \mathrm{exp}=\mathrm{id}_{\mathbb R}\) and \(\mathrm{exp} \circ \mathrm{ln}=\mathrm{id}_{\mathbb{R}_{>0}}\). Thus, the following applies:
\(\mathrm{ln} \circ \mathrm{exp}\) has the functional expression \(x \mapsto x\) (that is, \(\mathrm{ln}(\mathrm e^x)=x\)), the domain \(\mathbb R\), the co-domain \(\mathbb R\), and the image set \(\mathbb R\).
\(\mathrm{exp} \circ \mathrm{ln}\) has the functional expression \(x \mapsto x\) (that is, \(\mathrm e^{\mathrm{ln}(x)}=x\)), the domain \(\mathbb R_{>0}\), the co-domain \(\mathbb R_{>0}\), and the image set \(\mathbb R_{>0}\).
Question c#
Proof the algebraic rule
where \(a\) and \(b\) are positive real numbers, \(a,b \in \mathbb{R}_{>0}\).
Hint
You can use the fact that \(\mathrm e^x \cdot \mathrm e^y=\mathrm e^{x+y}\) for all real numbers \(x\) and \(y\). You can also use the fact that the exponential function has the image set \(\mathbb{R}_{>0}.\)
Hint
Because the exponential function has the image set \(\mathbb{R}_{>0}\) we can for given positive real numbers \(a\) and \(b\) always find real numbers \(x\) and \(y\) such that \(a=\mathrm e^x\) and \(b=\mathrm e^y\). More down to earth: if \(a=\mathrm e^{\ln(a)}\) and \(b=\mathrm e^{\ln(b)}\), then we have \(x=\ln(a)\) and \(y=\ln(b)\) for any given \(a\) and \(b\).
Exercise 4: Logarithms#
Let \(a\) be a positive, real number different from \(1\). The function \(f: \mathbb R \to \mathbb R_{>0}\) is given by the expression \(x \mapsto a^x\).
Question a#
Draw a sketch of the graph of the function for \(a \in ]0,1[\). Is \(f\) monotone? More precisely, is \(f\) strictly increasing, or strictly decreasing?
Hint
If you are in doubt about what the terms “monotone”, “strictly increasing” and “strictly decreasing” mean then you can find an explanation in the text right after Lemma 2.3.1 in the textbook.
Answer
The function \(f\) is monotone. More precisely, it is strictly decreasing.
Question b#
Again draw a sketch of the graph of the function, but now under the assumption that \(a \in \mathbb{R}_{>1}\). Is \(f\) strictly increasing or strictly decreasing?
Answer
The function \(f\) is strictly increasing.
Question c#
One can show that \(f\) is bijective, which means that \(f\) has an inverse function. Provide a functional expression for the inverse function of \(f\).
Hint
Try solving the equation \(y=a^x\) for \(x\). The formula \(a=\mathrm e^{\ln(a)}\) can be of help, and so can the rule that \((u^v)^w=u^{vw}\) for all \(u \in \mathbb R_{>0}\) and all \(v,w \in \mathbb R\).
Answer
\(f^{-1}(x)=\ln(x)/\ln(a).\)
Remark: one would typically write \(\log_a\) to denote this inverse function and then call it the logarithm with base \(a\). Often-used logarithmic functions apart from \(\mathrm{ln}\) are \(\log_2\) and \(\log_{10}\).
Exercise 5: Graph of Invertible Function#
Question a#
Sketch the graphs of the exponential and logarithmic functions from Example 2.3.2 in the same figure. Is there a symmetry between these two graphs?
Sketch also the graphs of the \(\tan\) and \(\mathrm{arctan}\) functions from Section 2.3 in the textbook in a (new) figure. Verify that the same symmetry appears.
What is the reason for this symmetry?
Hint
In the first figure the reason for the symmetry is that \(\mathrm e^x=y\) if and only if \(x=\ln(y).\)
Answer
The symmetry is a mirroring about the line \(y=x\).
In general, if \(f: A \to B\) is an invertible function and \(x \in A\), \(y \in B\), then it applies that \(f(x)=y\) if and only if \(x=f^{-1}(y)\). The symmetry thus makes sense: If you mirror the point \((x,f(x))\) on the graph of \(f\), you achieve the new point \((f(x),x)\). If we now denote \(f(x)\) by \(y\) (that is, \(y=f(x)\)), then we have that \((f(x),x)=(y,f^{-1}(y)),\) which precisely is a point on the graph of \(f^{-1}\). In a similar way it can be shown that if we mirror a point on the graph of \(f^{-1}\), then we achieve a point on the graph of \(f\).
Exercise 6: Slope and Inverses#
Keep in mind in this exercise that if you mirror a line in the plane with a slope of \(r \in \mathbb{R}\setminus \{0\}\) about the line \(y=x\), then you get a line with a slope of \(1/r\). We consider an invertible function \(f: \mathbb R \to \mathbb R\).
Question a#
Use the result described in the answer to Exercise 5 to realise graphically that if the graph of \(f\) has a tangent line through \((x,f(x))\) with a slope of \(r \in \mathbb{R}\setminus \{0\}\), then the graph of \(f^{-1}\) has a tangent line through \((f(x),x)\) with a slope of \(1/r\).
Question b#
Conclude that if \(f\) has a derivative \(f'(x)\) in \(x\) then the derivative of \(f^{-1}\) in \(f(x)\) is equal to \(1/f'(x)\). In other words:
Question c#
By replacing the variable \(x\) with \(f^{-1}(x)\) rewrite the formula from Question b to \((f^{-1})'(x)=1/f'(f^{-1}(x)).\)
Question d#
Now use the formula from Question c to realise that \(\mathrm{arctan}'(x)=1/\tan'(\mathrm{arctan}(x))\).
Question e#
Use the formula \(\tan'(x)=\tan^2(x)+1\) to reach the formula
Remark: a similar approach will give the formulas:
and