# Is there a function so that $f(f(x))=1/x$? [duplicate]

This question already has an answer here:

I tried to look for a function that fulfills this rule; $$f(f(x))=\frac{1}{x}$$

I tried a lot, and I didn't find anything.

Can anyone help me find such a function? Or prove that there isn't? It doesn't have to be a real function.

## marked as duplicate by Winther, Community♦Nov 11 '16 at 2:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 4 Answers

Define $f$ on $\mathbb R\setminus\{0\}$ as:

$$f(x)=\begin{cases} -x&x>0\\ -\frac1x&x<0\\ \end{cases}$$

There are infinitely many similar functions - if $g:\mathbb R^+\to\mathbb R^+$ is any $1-1$ and onto function with $g(1/x)=1/g(x)$ then:

$$f(x)=\begin{cases} -g(x)&x>0\\ \frac{1}{g^{-1}(-x)}&x<0 \end{cases}$$

has this property.

• Whoops, yes. @EricWofsey – Thomas Andrews Nov 11 '16 at 1:32
• I would add that you can find many such $g$ by taking $g:(1,\infty)\to(1,\infty)$ to be any bijection and then extending $g$ to $(0,1)$ so that $g(1/x)=1/g(x)$ (and defining $g(1)=1$). You can even easily find many such $g$ that are continuous by requiring your bijection $(1,\infty)\to(1,\infty)$ to be order-preserving. – Eric Wofsey Nov 11 '16 at 1:34
• @Eric Wofsey and finding such g would amount to answering the original question. – Anixx Nov 11 '16 at 1:34
• Not sure what you mean by that, @Anixx. It's certainly not an "equally hard" problem - there are lots of simple examples of such a $g$, include $g(x)=x$ and $g(x)=1/x$. But – Thomas Andrews Nov 11 '16 at 1:36

There is no such function $f:\mathbb{C}\setminus\{0\}\to\mathbb{C}\setminus\{0\}$ that is continuous. Indeed, note that $x\mapsto 1/x$ induces multiplication by $-1$ on $\pi_1(\mathbb{C}\setminus\{0\})\cong\mathbb{Z}$, which cannot be $f_*\circ f_*$ for any homomorphism $f_*:\mathbb{Z}\to\mathbb{Z}$.

Similarly, there is no such continuous function $f:(0,\infty)\to(0,\infty)$, since $f$ would have to be injective and thus monotone, and then $f\circ f$ would be increasing no matter what.

You can get such a continuous function $f:\mathbb{R}\setminus\{0\}\to\mathbb{R}\setminus\{0\}$ by defining $$f(x)=\begin{cases}-x&\text{ if }x>0\\ -1/x&\text{ if } x<0.\end{cases}$$

Finally, if you don't require continuity, it is very easy to get such functions. Here's one way to do so. Just define $f(1)=1$, $f(-1)=-1$, and then partition the rest of the domain of $f$ into sets of the form $\{a,1/a,b,1/b\}$ (where these elements are all distinct). In each such set, define $f(a)=b$, $f(b)=1/a$, $f(1/a)=1/b$, and $f(1/b)=a$.

• I do not see where in the question it is asked about everywhere continuous function. – Anixx Nov 11 '16 at 1:16
• @Anixx The OP was not very restrictive about answers, so it is safe to make assumptions. – Simply Beautiful Art Nov 11 '16 at 1:16
• It is totally excessive assumption. For instance, function $f(x)=i+\frac{2}{i + x}$ satisfies the conditions and it is discontinuous at only one point (the pole). – Anixx Nov 11 '16 at 1:17
• The question was rather vague about what it is requiring, so I answered it in many different possible interpretations, including both a requirement of continuity and no such requirement. – Eric Wofsey Nov 11 '16 at 1:20

I think there is infinitely many such functions.

One such function that satisfies the conditions is

$$f(x)=i+\frac{2}{i + x}$$

• @RossMillikan I just evaluated $f(f(x))$ by hand, and I got $1/x$. Anyways, you input wrong. It should be $$f(f(x))=i+\frac2{i+(i+\frac2{i+x})}$$ – Simply Beautiful Art Nov 11 '16 at 1:22
• @Ross Millikan you can see the graphic yourself: wolframalpha.com/input/… – Anixx Nov 11 '16 at 1:23
• You are correct. Sorry. – Ross Millikan Nov 11 '16 at 1:25

Assume that we have

$$f(x)=x^n$$

Plugging this in gives

$$(x^n)^n=x^{n^2}=x^{-1}$$

Thus, we have

$$n^2=-1\implies n=\pm i$$

Since these are complex exponents, we must be more careful. If we restrict $x$ to be positive, we have

$$x^i=e^{i\ln(x)}$$

where we use real valued logarithms. Thus,

$$f(x)=e^{i\ln(x)},e^{-i\ln(x)}$$

• :/ what is wrong with this answer? OP says complex functions are allowed. – Simply Beautiful Art Nov 11 '16 at 1:05
• Complex exponentiation is not uniquely defined, and you must be careful with your choices of branch if you want to be sure $(x^i)^i=x^{-1}$ is always true. – Eric Wofsey Nov 11 '16 at 1:06
• @EricWofsey Thanks for reminding me. :) – Simply Beautiful Art Nov 11 '16 at 1:12