I have a vector $v \in \mathbb{R}^n$ and I am searching for a mathematical notation for a function that returns $1$ if at least one of the vector's elements is $0$ and $0$ otherwise. The analogue function for a set $S$ would be: $$ f = \begin{cases} 1 & \text{if } 0 \in S \\ 0 & \text{if } 0 \notin S \end{cases} $$ However I am struggling to find a similar notation for a vector. In particular, how do I write: "If any element in $v$ is $0$"?
Notation: Vector contains an element equal to 0
3.2k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 5 best solutions below
On
If $\prod_{i=1}^nv_i=0$, then $f(v)=1$ otherwise $f(v)=0$. For a compact representation, you can use the indicator function $\mathbf 1_E$ of an event $E$. Define the event $E$ to be the event that $\prod_{i=1}^n v_i=0$. Then $$f(v)=\mathbf 1_E$$
On
I agree with @Joonas Ilmavirta that it's probably better to write it in words.
Nevertheless, one can talk about the support of a vector, namely, $$\operatorname{supp}(v)=\{i\in[n]\, |\, v_i \neq 0\},$$ where $[n]=\{1,\ldots,n\}$. This is a widely accepted terminology.
In particular, $$\text{"If any element of $v$ is $0$"}$$ becomes $$\text{"If $\operatorname{supp}(v)\neq [n]$"}$$
On
There is a distinction between a vector and its coordinates. A vector doesn't have elements; while vectors are often represented by a tuple of numbers, those numbers are simply the projection of the vector onto various axes, not the "elements". Just because one of the coordinates is zero, that doesn't mean 0 is "in" v, it just means that one of the axes you chose is perpendicular to v. If you want to know whether a tuple contains zero, one way is to take the product; the product of a tuple containing zero will be zero. There is a term "sign function" (not to be confused with "sine") that returns zero if x = 0, -1 if x<0, and 1 if x>0. So if we denote the projection onto the ith axis with $\pi_i$, then
$f(\textbf{v}) = 1-|sgn(\prod_{i=1}^n \pi_i(\textbf{v}))|$
You could also write it as
$f= 1_{\{\textbf{u} : \exists i :\pi_i(\textbf{u})=0\}}$
Explanation:
$\{\textbf{u} : \exists i :\pi_i(\textbf{u})0\}$ means "The set of vectors for which at least one projection function results in zero when applied to the vector".
The notation $1_S$ represents a function that gives 1 if the argument is in the set S, and 0 otherwise. So $1_{\{\textbf{u} : \exists i :\pi_i(\textbf{u})=0\}}$ gives 1 if any of the coordinates are zero, and 0 otherwise.
Note that this depends on what the $\pi_i$ are; that is, what coordinate system you pick will affect whether there are any zeros in the vector's representation.
On
You might be interested in the $0$-norm, defined here as $\|\cdot\|_0 : \mathbb{R}^n \to \mathbb{R}$ given by
$$\|(x_1, \ldots, x_n)\|_0 = \text{ number of nonzero entries $x_i$} = \sum_{x_i \ne 0} 1$$
In this context, your function is given by
$$f = \chi_{\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\})}$$
where $\chi_{\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\})}$ is the indicator function of the set $$\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\}) = \{x \in \mathbb{R}^n : \|x\|_0 \le n-1\} = \{(x_1, \ldots, x_n) \in \mathbb{R}^n : x_i = 0 \text{ for some } i\}$$
You can write it even shorter:
$$f(x) = \operatorname{sign}(n-\|x\|_0)$$
It's best to write it in words: $$ f(v) = \begin{cases} 1&\text{when at least one component of $v$ is zero}\\ 0&\text{otherwise}. \end{cases} $$ This is perfectly valid mathematical notation. Using symbols doesn't make it better than using words. With words you can say directly what you want to say instead of taking an unnecessary detour.
If someone insists on using symbols (in order for the function to be implementable on a machine), you can replace "when at least one component of $v$ is zero" by "$0\in\{v_1,\dots,v_n\}$". That's still readable, but I think the version in words is best for communicating with people.