4
$\begingroup$

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?
  • 6
    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.2012-03-30

1 Answers 1

13

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.