# Mapping functions

Let $S$ be the set of all positive integers. Define $f : S \to S$ by $f(1)=2$, $f(2) =3$, $f(3) =1$, and $f(s) = s$ for any other $s \in S$. Show that $f \circ f\circ f = i_s$. What is $f^{-1}$ in this case?

I do not know how to do this. I take that $i_s$ is the identity?

-
Yes, $i_S$ is the identity function on $S$, so that $i_S(n)=n$ for all $n\in S$. You can find $f(f(f(1))),f(f(f(2))),f(f(f(3))),f(f(f(4))),\ldots$ using the definition. Can you find a function $g$ such that $f(g(n))=n$ for all $n$, by "undoing" $f$? – Jonas Meyer Jan 11 '13 at 5:30
@JonasMeyer Would $g$ then be identity or will it be just $f$ itself? – Q.matin Jan 11 '13 at 5:36
Q.matin: No, neither of those. – Jonas Meyer Jan 11 '13 at 5:37
@Q.matin what about $g = f^2$? – jim Jan 11 '13 at 5:39
@JonasMeyer So, you are asking if there is a function $g$ such that $f(g(n)) = n$ . Then the only possible way I can think of that happening is if $f(f(n)) = n$. Can you provide more hints? – Q.matin Jan 11 '13 at 5:41

You can see that this map is both injective and surjective, and thus bijective, and therefore has an inverse.

To find the inverse, you just look at the function "backwards". Since $f(3) = 1$, we may say that $f^{-1}(1) = 3$, and similarly $f^{-1}(2) = 1$ and $f^{-1}(3) = 2$. For any other $s \in S$, we see that $f(s) = s$, and applying $f^{-1}$, we see that $f^{-1}(s) = s$.

To show that $f \circ f \circ f$ (call it $f^3$), we must show that for all $s \in S$, $f^3(s) = s$.

To do this, look at where the first power of $f$ sends any element $s$. For $s \in S - \{1,2,3\}$, what happens? Can you generalize this to any other powers?

For $s \in \{1,2,3\}$, simply apply $f$ three times ("by hand"), and see what you get!

-
Thanks!! And how will I show that $f \circ f\circ f = i_s$? – Q.matin Jan 11 '13 at 5:36
Ah yes, forgot that part. I'll edit. – andybenji Jan 11 '13 at 5:37
@Q.matin: By finding $f(f(f(n)))$ for each $n$. Where did you get stuck in your attempt? For example, do you know how to find $f(f(f(1)))$? (Work from the inside out. There are 3 steps.) – Jonas Meyer Jan 11 '13 at 5:38
@JonasMeyer I couldnt attempt it because I didn't know where to start. – Q.matin Jan 11 '13 at 5:40
@Q.matin: Start by finding $f(1)$. Then find $f(f(1))$. Then find $f(f(f(1)))$. – Jonas Meyer Jan 11 '13 at 5:40

Let us suppose the inverse of $f$ is $g$, then $g(1)=3$, $g(2)=1$, $g(3)=2$ and $g(s)=s$ for all $s \in S$.

-