# Does $f(f(x)) = x \Rightarrow f$ is bijective apply?

As far as I remember a reverse function for some function $f$ exists iff an inverse function exists.

Can I therefore follow from $f(f(x)) = x$ ($f$ is its own inverse function) for some function $f$ that it is bijective without proving it is injective and surjective?

Example:

$f : \mathbb{R} \rightarrow \mathbb{R},\ f(x) = 5 - x$

• What's the domain of $f$? Is it the full codomain $Y$? – Roland Jun 7 '14 at 15:22
• $f$ is bijective for $f: X\to Y$ iff $Y\subset X$ – kingW3 Jun 7 '14 at 15:25
• @kingW3 what if $Y \subseteq X$? – muffel Jun 7 '14 at 15:35
• @muffel As far as I know, it is customary to use the notation $\subset$ to denote weak set inclusion. Personally, I find it annoying and I always use $\subseteq$, but even the most respected mathematicians use $\subset$ with no reservations. – triple_sec Jun 7 '14 at 15:38

This depends on the domain and codomain chosen for the function. For example, suppose that $f : \Bbb{R} \to \Bbb{C}$ is defined by $f(x) = x$. Then $f(f(x)) = x$ for every $x \in \Bbb{R}$, but $f$ is not a bijection since it is certainly not surjective. You can say, however, that if $x \neq y$ are both in the domain of $f$, then $f(x) \neq f(y)$ since otherwise $f(f(x)) = f(f(y)) \implies x = y$.

• Nice counterexample! – triple_sec Jun 7 '14 at 15:43
• I'm not convinced: see my answer. – Tom Collinge Jun 7 '14 at 16:07
• How does "$f(f(x))$" make sense in this case? The domain of $f$ is $\mathbb{R}$, not $\mathbb{C}$. – Neal Jun 7 '14 at 16:10
• I see; you're defining $\mathbb{R}$ as the subset of $\mathbb{C}$ with zero imaginary part. – Neal Jun 7 '14 at 16:19
• @Neal If we don't consider $\Bbb{R} \subseteq \Bbb{C}$ then the statement $f(x) = x$ in my example doesn't even make sense. However, for the purposes of this counterexample, I think that assuming $\Bbb{R} \subseteq \Bbb{C}$ isn't unreasonable. – Tom Jun 7 '14 at 17:12

Since f(f(x)) exists it implies that f(x) must be in the domain of f (else we can't form $f(f(x))$. So f must map some set A to itself, i.e. $f:A \rightarrow A$. Examples using say R and C are therefore not valid: the domain of f is either R or C, in this case you would have $f: R \rightarrow C$ and $F: C \rightarrow R$ with $f = F|_R$ (i.e. f is $F$ restricted to R), and then $F(f(x)) = x$.

In general if $f:A \to B$ and $F:B \to A$ then $f = F \implies B = A$, and here $f = F$ is implied by $f(f(x)) = x$.

So with that understanding then f is a bijection.

1. f must be onto (surjective) since for all $x \in A$ $f(x)$ is defined (under normal understanding) and $=x$, so for all $x \in A$ there exists $x \in A$ such that $x = f(x)$
2. f must be into (injective) as $f(y) = y$ so if $f(x) = f(y)$ then $x = y$.
• Consider $f : \{0\} \to \{0\} \cup A$ where $A$ is your favorite set; define the rule of $f$ by $f(0) = 0$. In this case $f \circ f$ makes sense because the domain of $f$ is a subset of the range (not codomain) of $f$. Moreover $f(f(x)) = x$ for all $x \in \{0\}$. – Tom Jun 7 '14 at 16:16
• @Tom. If f is a well defined function then it must have a corresponding domain: what is the domain in your example, is it {0} or is it {0} $\cup A$ ? - it can't be both. – Tom Collinge Jun 7 '14 at 16:21
• I absolutely agree the domain is not both $\{0\}$ and $\{0\} \cup A$! The domain of $f$ is $\{0\}$. The range of $f$ is $f(\{0\}) = \{0\} \subset \{0\} \cup A$. Therefore, it makes sense to write the composition of $f$ with itself since the range of $f$ is a subset of the domain of $f$. – Tom Jun 7 '14 at 16:23
• @Tom Then f is a bijection from {0} to {0}, yes ? – Tom Collinge Jun 7 '14 at 16:50
• If $f:A\rightarrow B$ then $B\subseteq A$ is enough for each $f(x)$ to be in the domain of $f$. It is not necessary that $B=A$. If $\iota: B\rightarrow A$ is the inclusion of $B$ then $\iota\circ f:A\rightarrow A$. This function is the same as $f$ if and only if $A=B$ (then $\iota$ is the identity). – drhab Jun 7 '14 at 16:53

Assuming $f: A \to A$...

If $f \circ g$ is bijective, then $f$ is a surjective and $g$ is injective. Here, $f \circ f$ is a bijective (in fact it is the identity mapping), so $f$ is surjective and $f$ is injective. Therefore, $f$ is bijective.

• The domain of $f$ is relevant as $f \circ f$ is only a bijection on the domain of $f$ - this does not tell you anything about surjectivity on the whole codomain. – Roland Jun 7 '14 at 15:25
• Right. Fixed that. – M. Vinay Jun 7 '14 at 15:28

The self-inverse property implies injectivity but not surjectivity.

• if $f:X\to X$ then $f(f(x))=x$ clearly implies surjectivity. – user126154 Jun 7 '14 at 15:21
• @user126154 Why do you assume that the domain and codomain are both the common set $X$? – Tom Jun 7 '14 at 15:24

$f$ is injective, because if $f(x)=f(y)$, then $x=f(f(x))=f(f(y))=y$.

$f$ is surjective because every $x$ is the image of some $y$, namely $f(f(x))=x$ (provided that the image is the same set as the domain).

So... yes.

• It is not necessarily true that $f$ is surjective. – Tom Jun 7 '14 at 15:23
• The proof goes through and $f$ is surjective as long as the codomain is a subset of the domain. – triple_sec Jun 7 '14 at 15:26
• @DanZimm True, but this is implied by the condition $f(f(x))=x$. In this case, $x\in\text{Dom}$ implies that $f(f(x))=x$, so $x\in f(\text{Dom})\subseteq\text{Codom}$, so $\text{Dom}\subseteq\text{Codom}$. In fact, I just realized that it must be true for an arbitrary non-empty domain. So, to refine, the result goes through as long as $\text{Dom}=\text{Codom}.$ – triple_sec Jun 7 '14 at 15:31
• @DanZimm What's wrong with the function $f : \{0\} \to \Bbb{R}$ where $f(0) = 0$? The codomain is $\Bbb{R}$, which is not even finite. Note that $f(f(x)) = x$ for every $x$ in the domain of $f$. – Tom Jun 7 '14 at 15:33
• @Tom In your example, the codomain is not a subset of the domain, so $f$ will not be surjective, indeed. – triple_sec Jun 7 '14 at 15:34

You have plenty of answers and according to my view you accepted one that is indeed okay. I just want to mention a subtle point here. Your condition was: $$\forall x\; f\left(f\left(x\right)\right)=x$$ and under that condition $f$ is injective but does not have to be surjective.

If it would have been slightly different: $$\forall x\; f\circ f\left(x\right)=x$$ then you are dealing with something else. This condition can only 'make sense' if function $f\circ f$ is indeed defined. That means that its domain and codomain must be the same. So then the answer would have been: yes, $f$ is a bijection.

The first condition is not equivalent with: $f$ is its own inverse (as you argued in your question). The second condition is.