-2

Is there an equation f(x) for absolute value, that is defined for every defined value of x, without using separate equation for different ranges.

It should be defined without using a conditional check.

  • Why not just use the piecewise definition of $|x|$ ? – learner Jul 27 '16 at 19:00
  • 1
    @learner Apparantly, the OP does not like distincting the cases. – Peter Jul 27 '16 at 19:02
  • @Bye_World Sorry, updated the equation. I was thinking of a way to +1 and -1 alternately for a series and had abs(x)/x in my mind when I typed the question. I have updated the question with the actual equation, that I intended to write. – Joyce Babu Jul 27 '16 at 19:08
  • @Peter You are right, I have removed the equation all together. – Joyce Babu Jul 27 '16 at 19:11
  • 1
    I think the version $\sqrt{x^2}$ is the best possible way to define $|x|$ without distincting the cases, since |x| is only continous at $x_0=0$, but not differentiable. – Peter Jul 27 '16 at 19:13
  • @Peter Yes, that was the equation I had in mind. I couldn't recollect it once I started writing the question. I only remembered that it was not defined for zero. – Joyce Babu Jul 27 '16 at 19:20
  • 1
    @JoyceBabu That was unlucky. The first hits are confusing and misleading. – Peter Jul 27 '16 at 19:43
  • 2
    @JoyceBabu Time to "clean" the site. Let us delete unnecessary comments now. – Peter Jul 27 '16 at 19:45

3 Answers3

4

Because of the convention that $\sqrt{x}$ is always non-negative, we have $$|x|=\sqrt{x^2}$$ for all $x\in \mathbb R$.

You can also use $$|x|=x\cdot sign(x)$$ for all $x\in \mathbb R$.

Peter
  • 84,454
1

One equation for the absolute value functions is:

$$ f:\mathbb{R}\to\mathbb{R}_{\geq 0}, $$

given by

$$ f(x)= \begin{cases} \begin{aligned} x&\text { if }x\geq 0\\ -x&\text { if }x< 0 \end{aligned} \end{cases}. $$

So, for instance, $f(5)=5$ since $5\geq 0$, while $f(-4.7)=-(-4.7)=4.7$, since $-4.7<0$.

ervx
  • 12,208
1

An absolute value can be written as: $$|x|= \begin{cases} \begin{aligned} x&\text { if }x\geq 0\\ -x&\text { if }x< 0 \end{aligned} \end{cases}$$

OR

$$|x| = \sqrt{x^2}$$ = The above notation describes the principal root of $x^2$ (Positive)