Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

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

I wonder if it is possible to build a sign(x) function which will return either 1 for positive values of x, or -1 for negative ones - using only the 4 basic arithmetic operations (+ - / *)

Clearly it is easy to accomplish this if using sqrt() would be allowed as well ( sign(x) = x/sqrt(x²) )

  • But is it possible using only basic arithmetics as well?
share|cite|improve this question
What if you use the Taylor series for $\sqrt{x^2}$? – draks ... Mar 30 '12 at 13:09
Using $+, -, \times, /$ we get the so-called "rational functions". So now you ask for a proof that sign($x$) is not a rational function. Well, maybe prove that a rational function cannot have a "jump" discontinuity. – GEdgar Mar 30 '12 at 13:19
up vote 13 down vote accepted

No. First, note that you can rewrite every expression given in the arithmetic operations as a rational function: Say your expression calculates $f(x)$. Then $f(x) = p(x)/q(x)$ for two polynomials $p, q$. Suppose $f(x) = \mathrm{sign}(x)$. Then $p(x) = q(x)$ for $x > 0$ and $p(x) = -q(x)$ for $x < 0$. But if two polynomials $p, q$ agree on more than $\max \{ \deg p, \deg q\} + 1$ points, $p = q$, which is the case here, which implies $p = q$.

Of course, we must have $q(x) \neq 0$ for all $x$, since otherwise, $p(x)/q(x)$ is not defined everywhere. On the other hand, since $p(-1) = -q(-1) = -p(-1)$, $p(-1) = q(-1) = 0$, which is a contradiction.

share|cite|improve this answer

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.