Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a (non-piecewise, non-trivial) function where $f(x) = f(\frac{1}{x})$?


It would be nice to compare ratios without worrying about the ordering of numerator and denominator. For example, I might want to know whether the "magnitude" of the ratio (maybe the "absolute ratio") of the widths of two objects is greater than $2$, but not care which is larger.

It occurred to me that there's a common solution for this problem when comparing the difference of two numbers: the square of a number is the same as the square of its opposite - $(a-b)^2=(b-a)^2$. This is really useful with Euclidean distances, because you don't have to worry about the order of subtraction or use absolute values. Can we get the same elegance for ratios?

Difference: $g(a-b)=g(b-a) \rightarrow g(x)=x^2$

Ratio: $f(\frac{a}{b})=f(\frac{b}{a}) \rightarrow f(x)=\ ?$

share|cite|improve this question
$$ f(x) = x + \frac{1}{x} $$ – Will Jagy Nov 25 '13 at 4:34
For positive $x$, we have $(\ln(x))^2=(\ln(1/x))^2$. So $f(t)=(\ln(t))^2$ works. But it may not be what you are after. – André Nicolas Nov 25 '13 at 4:35
$f(x) = x \times \frac1x$. – Stephen Montgomery-Smith Nov 25 '13 at 4:40
@StephenMontgomery-Smith that's not a very useful solution, but kudos for it anyway :) – Sparr Nov 25 '13 at 4:43
Your use of $\Longrightarrow$ is very disconcerting. – Carsten S Nov 25 '13 at 10:05
up vote 12 down vote accepted

$$ \frac{x}{x^2+1} $$ the inverse of Will Jagy's $x + \frac{1}{x}$.

I like $$x - \frac{1}{x} = \frac{x^2-1}{x}$$ because it contains sign information (input magnitude greater or less than one) that you may choose to ignore, and gives a nice zero for $x = \frac{1}{x} = \pm 1$. If you choose to take the absolute value of it (ignoring the sign) it gives you the desired $f(x) = f(\frac{1}{x})$

share|cite|improve this answer
For that matter, any $f(x) + f(\frac{1}{x})$, or $f(x)\cdot f(\frac{1}{x})$ – adam W Nov 25 '13 at 4:59
Oooh that's nice – Nolan Nov 25 '13 at 6:36
...or simply any $f(x+\frac1x)$ (or, if you want adamW's sign dependency, $f(x-\frac1x)$) – Tobias Kienzler Nov 25 '13 at 10:38

For lack of a better idea, $f(x)=|\ln x|$.

share|cite|improve this answer

$$ \frac{1}{1 + x + \frac{1}{x}} = \frac{x}{x^2 + x + 1} $$ extends to the real analytic function written on the right. Notice that $x^2 + x + 1 = (x + \frac{1}{2})^2 + \frac{3}{4} \geq \frac{3}{4}. $

share|cite|improve this answer

For lack of anything worse than this, $f(x)=(x - \frac{1}{x})^2$.

share|cite|improve this answer

Let $f(x)$ be arbitrary for $-1\leqslant x\leqslant 1,$ and define $f(x):=f(1/x)$ otherwise.

share|cite|improve this answer
The question specifies "non-piecewise" – Sparr Nov 25 '13 at 16:17
@Sparr: This definition includes the "non-piecewise" function specified in Will Jagy's answer as well as the first function in adam W's answer. (The other functions require a second statement to define them at $0.$) In fact, it includes all functions $f$ that satisfy $f(x)=f(1/x)$ for $x\neq 0.$ – John Bentin Nov 25 '13 at 18:18
one of the pieces of your function being non-piecewise does not make your function non-piecewise. pretty much the opposite, actually – Sparr Nov 25 '13 at 19:30
@Sparr: Agreed. – John Bentin Nov 25 '13 at 21:26

It works for any function $f(x) = g(x, \frac{1}{x})$ where $g$ is symmetric (i.e., $g(x, y) = g(y, x)$).

share|cite|improve this answer
OP wants actual functions – Cruncher Nov 25 '13 at 19:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.