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.

What is the correct definition of the absolute value of $x$, $|x|$?

Option A

$$ |x|= \begin{cases} -x&\text{if } x < 0\\ 0& \text{if } x=0\\ x&\text{if } x>0 \end{cases} $$

Option B

$$ |x|= \begin{cases} -x&\text{if } x \leq 0\\ x&\text{if } x>0 \end{cases} $$

Option C

$$ |x|= \begin{cases} -x&\text{if } x < 0\\ x&\text{if } x\geq 0 \end{cases} $$

share|improve this question
21  
They’re all correct: they all define exactly the same function. –  Brian M. Scott Oct 5 '12 at 13:07
2  
...that is, assuming $x\in\mathbb R$. If $x$ is complex, then the more appropriate definition is $\sqrt{(\Re x)^2+(\Im x)^2}$, where $\Re x$ and $\Im x$ are the real and imaginary parts of $x$. –  J. M. Oct 5 '12 at 13:11
1  
From a computer science point of view, Option C is better, because it requires one check and one operation for negative values. Option B is a scooch slower if $x=0$ –  Thomas Andrews Oct 5 '12 at 13:33
    
"The" correct definition is the one given previously in that book. –  GEdgar Oct 5 '12 at 14:15
2  
DISTANCE FROM ZERO –  Berci Oct 5 '12 at 14:36

4 Answers 4

up vote 12 down vote accepted

What about Option D? That is:

$$|x|=\begin{cases}-x & x<0\\ x^2 & x=0,x=1\\ x & \text{otherwise}.\end{cases}$$

In all seriousness, there are infinitely-many (seemingly) distinct ways to define $|x|$ piecewise, but in the end, they are precisely the same. All you've got to do is pick one.

share|improve this answer
    
So among others, when do you prefer your definition? –  stalking is prohibited Oct 5 '12 at 13:14
5  
@ガベージコレクタ: You don’t even need to define it piecewise: $|x|=\sqrt{x^2}$ also works. –  Brian M. Scott Oct 5 '12 at 13:15
2  
I don't prefer my definition. I was simply providing yet another alternative to illustrate the point. Quite frankly, if I had to pick one (though I can't think why I would), I'd probably go with Brian's excellent suggestion, just to avoid dealing with piecewise functions unnecessarily. –  Cameron Buie Oct 5 '12 at 13:21
    
Different functions which compute exactly the same thing over the same domains are not precisely the same. They do not express the computation in the same way. They are only the same in situations when you don't care what the formula looks like (because, say, you don't intend to manipulate it). –  Kaz Oct 5 '12 at 18:57
    
@Kaz: You're talking about computations and formulae, not about functions. –  Chris Eagle Oct 5 '12 at 19:11

There are many equivalent ways describing $|x|$ as a function of $x$, what about: $\max\{x,-x\}$?

It is important to remember that the way to describe a set is not important, what important is the set itself.

I can tell you to take three rights; or I could just tell you to take one left. The input is the same and the output is the same, and that is what matters.

In the context of the real numbers there are several ways to describe the absolute value, and they are all the same.

share|improve this answer

A function is both a rule and a domain on which that rule takes place. If, for two functions, the rule and the domain are the same, then the two functions are the same. Just to be clear, you gave several different rules, but they are all equivalent, i.e., they all agree for any $x$ you insert. And all of them have the same domain. So, they are all the same function. Which definition is best only depends on what you are working on.

For example, when you want to find the $\lim\limits_{x \to 0^-} \frac{|x|}{x}$, then any of your definitions will do just fine, and all work better than say $|x| = \max\{x, -x\}$ or $\sqrt{x^2}$.

$$\lim_{x \to 0^-} \frac{|x|}{x} = \lim_{x \to 0^-} \frac{-x}{x} = \lim_{x \to 0^-} -1 = -1$$

But, in other situations, maybe you'd prefer $\sqrt{x^2}$ for some reason.

share|improve this answer

Form C is the most elegant, because it breaks the problem into exactly the right cases: the subdomain of $x$ for which something has to be done to produce the absolute value, and a subdomain which is already identical to its absolute value. Only if $x$ is negative do we have to negate it, otherwise we leave it as is.

Option B is simply silly. Why include 0 in the domain that requires negating?

Option A is verbose, but it has a certain symmetry. In any case, it is better than B because at least it regards 0 as special (which it generally is, even if not specifically in this situation), rather than clumping it with the negatives.

share|improve this answer

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.