6

Why is the absolute value function or modulus function $|x|$ used ? What are its uses?

For example the square of a modulus number will always be positive, but why is it used when for example the square of any number whether positive or negative is always positive ? For example, $X^2$, will give a positive number whether negative or positive where $X$ is any number positive or negative.

Dan
  • 1,649

5 Answers5

14

One use of it is to define the distance between numbers. For example, in Calculus, you may want to say "the distance between $x$ and $y$ is less than $1$". The way to write that mathematically is $|x-y|<1$. And you want to write it mathematically so you can work with it mathematically.

amWhy
  • 209,954
Ovi
  • 23,737
11

The notation $\vert x\vert$ for absolute value of $x$ was introduced by Weierstrass in 1841:

K. Weierstrass, Mathematische Werke, Vol. I (Berlin, 1894), p. 67.

Quoted from [1]

...There has been a real need in analysis for a convenient symbolism for "absolute value" of a given number, or "absolute number," and the two vertical bars introduced in 1841 by Weierstrass, as in $\vert z\vert$, have met with wide adoption;...

Extra information: Absolute is from the Latin absoluere, "to free from"; hence suggesting, to free from its sign.

[1] Florian Cajori, A History of Mathematical Notations (Two volumes bound as one), Dover Publications, 1993.


My take on a usage example of absolute value: $$ \min(x,y)=\frac{1}{2}(|x+y|-|x-y|) $$ $$ \max(x,y)=\frac{1}{2}(|x+y|+|x-y|) $$

Sebastiano
  • 7,649
7

In the context of real numbers the absolute value of a number is used in many ways but perhaps very elementarily it is used to write numbers in a canonical form. Every real number $a\ne 0$ is uniquely equal to $\pm \left |a\right|$. So if we define the sign function $s\colon \mathbb R\setminus\{0\}\to \{+,-\}$ given by $s(a)=+$ if $a>0$ and $s(a)=-$ if $a<0$, then: for all $a\ne 0$ in $\mathbb R$ we have $a=sign(a)\cdot \left | a \right |$. In a sense this is a way to build all the reals from the positive ones. This is all just a special case of the polar representation of complex numbers, a representation of utmost importance.

Ittay Weiss
  • 79,840
  • 7
  • 141
  • 236
2

Because both of them are useful.

You explicitly mentioned the square function. Therefore, I want to give some examples. The main idea is that the non-differentiability of $|\cdot|$ is useful in minimization problem.

Estimators

We know that the arithmetic mean $\hat{\mu}=\sum_{i=1}^n x_i$ gives

$$\min_{\mu} \,(x_i-\mu)^2$$

but it is less well-known that the median gives

$$\min_{\mu} \, |x_i-\mu|.$$

Signal Processing

Let's use image processing as an example. Suppose $g$ is a given, noisy image. We want to find some smoother image $f$ which looks like $g$.

The Harmonic L$^2$ minimization model solves

$$-\bigtriangleup f + f = g $$

and it turns out to be equivalent to solving a minimization problem:

$$\min_{f} \,(\int_{\Omega} (f(x,y)-g(x,y))^2 dxdy + \int_{\Omega} |\nabla{f(x,y)}|^2 dxdy).$$

An enhanced version is the ROF model. It solves

$$\min_{f} \,(\frac{1}{2} \int_{\Omega} (f(x,y)-g(x,y))^2 dxdy + \lambda \int_{\Omega} |\nabla{f(x,y)}| dxdy).$$

Notice that for appropriate $\lambda$, these two models only differ by a square. Another remark is that $|\cdot|$ gives the Euclidean norm when the argument is a vector. However, the idea still applies since the norm is non-zero

Model Selection

In classical model selection problem, we are given a set of predictors and a response (in vector form). We want to decide which predictors are useful. One way is to choose a "good" subset of predictors. Another way is to shrink the regression coefficients.

The classical regression model solves the following minimization problem:

$$\min_{\beta_0,...,\beta_p} \sum_{i=1}^n (y_i-\beta_0-\sum_{j=1}^p \beta_j x_{ij})^2$$

The Ridge Regression solves the following:

$$\min_{\beta_0,...,\beta_p} \sum_{i=1}^n (y_i-\beta_0-\sum_{j=1}^p \beta_j x_{ij})^2+\lambda \sum_{j=1}^p {\beta_j}^2$$

, so that larger $\beta_j$ gives penalty.

Another version is Lasso, which solves

$$\min_{\beta_0,...,\beta_p} \sum_{i=1}^n (y_i-\beta_0-\sum_{j=1}^p \beta_j x_{ij})^2+\lambda \sum_{j=1}^p |\beta_j|.$$

0

In computer science, it can be useful for computing vectors.

Let x be a projection of a vector into 1 dimension such that it has a direction (plus or minus), and a magnitude.

If I want to square the vector but preserve its direction (say, to find air resistance from velocity), then I can take: $$ a = x^2 \frac{|x|}{x} $$ or simplified: $$ x|x| $$ This gives me the same direction, but the magnitude is squared. Therefore, the vector I am calculating acts in the correct direction.