Take the 2-minute tour ×
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.

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|improve this question
1  
What if you use the Taylor series for $\sqrt{x^2}$? –  draks ... Mar 30 '12 at 13:09
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. –  GEdgar Mar 30 '12 at 13:19
add comment

1 Answer 1

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|improve this answer
add comment

Your Answer

 
discard

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.