# Lesson 31 Solutions

Exercise 1) Let $f:\{1, 2, 3, 4\}\rightarrow \{a, b, c\}$ be the function defined as $f(1)=b, f(2)=b, f(3)=c, f(4)=a$ and let $g:\{a,b,c\}\rightarrow \{apple, Kobe, Donkey, fruitcake\}$ be the function defined as $g(a)=Kobe, g(b)=fruitcake, g(c)=Donkey$.  Write down (or say out loud, or figure out in your head) the value of $g\circ f: \{1, 2, 3, 4\}\rightarrow \{apple, Kobe, Donkey, fruitcake\}$ for each element in $\{1, 2, 3, 4\}$.  In other words, calculate $g(f(a))$ for all $a\in A$.

Solution:  All we have to do here is “trace through” the various definitions of the functions.  Namely, for figuring out what $g(f(a))$ is for some $a\in \{1, 2, 3, 4\}$, we simply need to follow the element $a$ through the two functions.  So here we go.  Let’s start with $1\in \{1, 2, 3, 4\}$.  We have $f(1)=b$, and $g(b)=fruitcake,$ so $g\circ f(1)= g(f(1))=fruitcake$.  Simple as that!

Similarly, we have $f(2)=b$ and again we have $g(b)=fruitcake$ so we have $g\circ f(2)=g(f(2))=fruitcake$.  Next, we have $f(3)=c$ and $g(c)=Donkey,$ so $g\circ f(3)=Donkey$.  Finally we have $f(4)=a$ and $g(a)=Kobe,$ so $g\circ f(4)=Kobe$.  To recap, then, we have that the composition $g\circ f: \{1, 2, 3, 4\}\rightarrow \{apple, Kobe, Donkey, fruitcake\}$ of $f$ and $g$ is defined by

$g\circ f(1)=fruitcake$

$g\circ f(2)=fruitcake$

$g\circ f(3)=Donkey$

$g\circ f(4)=Kobe$.

And we’re done!

Exercise 2)  Recall that $\mathbb{Z}$ is the set of integers: $\mathbb{Z}=\{..., -3, -2, -1, 0, 1, 2, 3, ...\}$.  Let $\mathbb{E}$ denote the set of even integers: $\mathbb{E}=\{..., -6, -4, -2, 0, 2, 4, 6, ...\}$.  Let $\mathbb{T}$ denote the set of multiples of 3: $\mathbb{T}=\{..., -9, -6, -3, 0, 3, 6, 12, ...\}$.  Let $f:\mathbb{Z}\rightarrow \mathbb{E}$ be the function that takes each integer to 4 times that integer, so that $f(a)=4\times a$ and for example $f(-5)=-20\in \mathbb{E}$ (note that $f$ is most certainly not surjective).  Now let $g:\mathbb{E}\rightarrow \mathbb{T}$ be the function that sends each element in $\mathbb{E}$ to 3 times itself, so that $g(a)=3\times a$ and for example $g(6)=18$.  Let $g\circ f:\mathbb{Z}\rightarrow \mathbb{T}$ be the composition of $f$ and $g$.  Calculate

i) $g\circ f(-3)$

ii) $g\circ f(5)$

iii) $g\circ f(10)$.

Solution:  Again, for each of the three things that we need to calculate, we just need to “follow through” the definitions of the functions.  So, for i), we have that $f(-3)=-12$ since $f$ sends each integer to 4 times itself.  Then $g(-12)=-36$ since $g$ sends each element in its domain to 3 times itself.  Thus $g\circ f(-3)=g(f(-3))=-36$.  However, we notice that we can do this much faster.  For let’s choose some arbitrary integer $n\in \mathbb{Z}$.  Then $f(n)=4n$ by definition of $f$.  Additionally, by definition of $g$, $g(4n)=3\times 4n=12n$.  So effectively what we’re doing by first applying $f$ and then applying $g$ is just multiplying the input integer by 12.  Thus, calculating the three cases that we’re asked to is easy.  Namely,

$g\circ f(-3)=-36(=12\times -3)$

$g\circ f(5)=60(=12\times 5)$

$g\circ f(10)=120(=12\times 10)$.

And we’re done!

Back to Lesson 31

On to Lesson 32