# If $f:\mathbb{Z}\times\mathbb{Z}\to\mathbb{Z}$ is defined by $f((a,b))=b$, then does $f \circ f$ exist?

Let $$f: \mathbb{Z} \times \mathbb{Z} \rightarrow \mathbb{Z}$$ be defined by $$f((a,b))=b$$.

I am confused as to whether $$f \circ f$$ exists here.

I was taught that for this composite function to exist, the codomain of the inner function must be equal to the domain of the outer function. Now I understand $$\mathbb{Z}$$ is not equal to $$\mathbb{Z} \times \mathbb{Z}$$, however since $$f$$ in this case doesn't even use $$a$$, is it at all possible for $$f \circ f$$ to indeed exist?

• No, it is not defined, because of the reason you already mentioned. Commented Apr 16 at 0:18
• Got it - just wanted to confirm, thanks! I think I was just overthinking it Commented Apr 16 at 0:25
• Can't exist. For the reason you gave. Not using something doesn't mean you don't have to put something in. Commented Apr 16 at 0:26
• Now it's possible to have a function $g:\mathbb Z \to \mathbb Z\times Z$ that is defined as $g(b) = (7, b)$. Then we can have $f\circ g\circ f$. And what's more $f\circ g \circ f = f$. If we input $(a,b)$ then $f:(a,b)\to b$. And then $g: b \to (7,b)$ and then the second $f:(7,b)\to b$. So $f\circ g\circ b: (a,b)\to b$ and is, thus, the exact same function as $f$..... but that wasn't your question, was it? Commented Apr 16 at 0:32

Given two functions $$f: A \to B$$ and $$g: C \to D$$, we can only form $$g \circ f: A \to D$$ if $$B \subseteq C$$.
In your example, $$\mathbb{Z}$$ is not a subset of $$\mathbb{Z} \times \mathbb{Z}$$, so this composition is not defined. However, if you come up with some $$h: \mathbb{Z} \to \mathbb{Z} \times \mathbb{Z}$$, like say by fixing some $$m \in \mathbb{Z}$$ and defining the inclusion $$\iota_m(n) = (m, n)$$, then you can form the composition $$f \circ \iota_m \circ f$$ $$\mathbb{Z} \times \mathbb{Z} \xrightarrow{f} \mathbb{Z} \xrightarrow{\iota_m} \mathbb{Z} \times \mathbb{Z} \xrightarrow{f} \mathbb{Z}$$ that maps $$(a, b) \mapsto b \mapsto (m, b) \mapsto b$$ for $$(a, b) \in \mathbb{Z} \times \mathbb{Z}$$, so it turns out that $$f \circ \iota_m \circ f = f$$.
However, that is certainly not the only possible map $$\mathbb{Z} \to \mathbb{Z} \times \mathbb{Z}$$ (even if we only consider abelian group homomorphisms).
• I think it may be important to note that $\iota_m$ will always append the same $m$ no matter what. If $f:(a,b)\to b$ and $a\ne m$ the $a$ is simply lost for ever. And there is no function $MAGIC:\mathbb Z \to \mathbb Z\times Z$ that we "rembember" that the $b$ was once attached to $a$ and map $MACIG:b\to (a,b)$. All $\iota_m$ does is map any $x$ to $(m,x)$ no matter what.... in other words there is no "inverse" $f^{-1}$ so that $f^{-1}\circ f$ will map $(a,b)\to b \to (a,b)$. That just is not possible.... Or maybe it's not important to note that. Commented Apr 16 at 0:40