Why define $|x|$ by a piecewise function?

276 Views Asked by At

So I was recently solving a question about the derivative of $|\sin(x)|$ and the answer above me used a piecewise function to solve the problem.

I used the definition $|x|=\sqrt{x^2}$, and the problem became incredibly easy to solve. So, I guess what I am wondering, is why people define $|x|$ by a piecewise function like:

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

Because it is harder to differentiate and the only possible application is integration. Plus, my definition is easier to prove:

Proof:

The absolute value of a real number is defined as the magnitude of the real number.

The magnitude of a complex number $a+bi$ is $\sqrt{a^2+b^2}$, and if $b$ is $0$ because the number is real, then $|a|=\sqrt{a^2}$.

So, in conclusion, I want to know how this piecewise definition came about, and why I never see my definition. If possible, I would like to know the flaws with my definition.

2

There are 2 best solutions below

0
On BEST ANSWER

I'm not sure if there is a good answer to this question. Both definitions have their merits. Your definition is just a special case of the definition of the standard metric on $\mathbf{R}^n$. Namely, $$ d_E(x,y)=\sqrt{\sum_{i=1}^n(x^i-y^i)^2}$$ where $x=(x^1,\ldots, x^n)$ and $y=(y^1,\ldots y^n)$. In this case, $\lvert x\rvert $ is simply the Euclidean distance of $x$ from the origin in $\mathbf{R}$. That is, $$ \lvert x\rvert=\sqrt{x^2}.$$ On the other hand, sometimes it is nice to regard $\lvert x\rvert$ as two lines. That is, $$ \lvert x\rvert=\begin{cases} x&x\ge 0\\ -x&x<0. \end{cases}$$ In the latter case, we just know that we can pretend $\lvert x\rvert$ is either $x$ or $-x$ depending on which side of the origin we are on. In short, both of these definitions are fundamental and equally valid.

3
On

The definition for $|x|$ is naturally stated in terms of diferent conditions, depending whether $x \geq 0$ or $x<0$ because $|x|$ is distance from $0$ to $x$ and we agree that distance is always $\geq 0$.

The definition $|x|=\sqrt {x^2}$ is also fine because when we talk about square root we agree that square root of nonnegative real number is nonnegative itself so $\sqrt {x^2}$ is never a negative number and it equals $|x|$ because of $(-x)^2=x^2$.

The way in which you arrived at "your" definition is kind of not practical because you use complex numbers to define distance on the real line and they are certainly not needed to do that.