How to define a set of $n$ such that $\mathbf{X}_{n,m}=1$ for at least one $m$?

40 Views Asked by At

Given a matrix $\mathbf{X}\in\{0,1\}^{N\times M}$, what is the set notation I should use to define this: the set of all $n\in\{1,\ldots,N\}$ such that there exists at least $m\in\{1,\ldots,M\}$ where $\mathbf{X}_{n,m}=1$.

I write it as: $$\{n:\mathbf{X}_{n,m}=1,m\in\{1,\ldots,M\}\}, (1)$$ but it seems that would find all $n\in\{1,\ldots,N\}$ such that $\mathbf{X}_{n,m}=1$ for all $m\in\{1,\ldots,M\}$, which only finds the rows that have all ones.

If I write it as: $$\{n:\exists m\in\{1,\ldots,M\} : \mathbf{X}_{n,m}=1\},(2)$$ it seems ok but I used two ``such that'' in the defined set, which is ugly and maybe wrong.

Example: $N=3$, $M=4$, and

$$\mathbf{X}=\begin{pmatrix}1 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 1 & 1 & 1 & 1\end{pmatrix}.$$ I want the set $\{1, 3\}$ because row 1 has at least one nonzero element and row 3 has at least one nonzero element but row 2 in zero.

With $(1)$, the set is $\{3\}$, isn't it?

2

There are 2 best solutions below

1
On

My suggestion is $$\{n: \left|\{m: X_{n,m} = 1\}\right| \geq 1 \}$$

0
On

Since the values of the matrix are $0$ and $1$, you can write

$$ \{n: \sum_{m=1}^M X_{n,m}\geq 1 \} $$

This seems artificial but, if you don't mind introducing some notations, you can write the sum as a product of matrices so we stay in the realm of linear algebra: let $U$ the $M\times 1$ matrix whose entries are all $1$ and for $n\in\{1,\dots,M\}$, $e_n$ be the $N\times 1$ matrix whose values are all $0$, except the $n$th one which is equal to $1$. Then $XU$ is the sum of all columns of $X$, so

$$ e_nXU = \sum_{m=1}^M X_{n,m} $$


With (1), the set is ${3}$, isn't it?

Actually, the meaning of $(1)$ is unclear since we don't know what $m$ is. Is supposed to be "for every $m\in \{1,\dots,M\}$" or "for some $m\in \{1,\dots,M\}$"?