How to mathematically express the minimum difference between a number and an interval of numbers?

57 Views Asked by At

Suppose $x \in \mathbb{R}$, and $y \in [a, b]$, where $a, b \in \mathbb{R}$. I want to minimize the difference between $x$ and $y$ but am not sure how to write it in mathematical notation.

For example, if $x = 10$, and $y \in [11, 35]$, then the minimum difference between $x$ and $y$ is 1.

The way that I came up with is: $min\{|x - y|\}$. Is this correct?

2

There are 2 best solutions below

0
On BEST ANSWER

Add a specification to your set to identify the possible values of $y$:

$$ \min\{ |x - y|\ |\ y \in [a, b]\}. $$

But as in Kevin's comment above, you may want to replace the minimum by the infimum. In the case you are describing, they are equivalent, but if you want to find the distance from a point to an open interval, say, the minimum distance may be undefined. For example, $\min\{ |10 - y|\ |\ y \in (11, 35)\}$ is undefined, while $\inf\{ |10 - y|\ |\ y \in (11, 35)\} = 1$.

0
On

For any interval which has a real midpoint $m$ and a non-negative length $l$, $$\left(\frac{2m\ -\ l\ -\ 2x}{2}\right)\ H\left(\frac{2m\ -\ l\ -\ 2x}{2}\right)\ +\ \left(\frac{2x\ -\ 2m\ -\ l}{2}\right)\ H\left(\frac{2x\ -\ 2m\ -\ l}{2}\right)$$ where $H()$ is the Heaviside function should return this distance as a function of $x$.