# $\#$ vs $\lvert \cdot \rvert$ for set cardinality notation

I have seen two different common notations for the cardinality of a set:

$\lvert A\rvert$, and $\#A$.

Is there a context in which one is more appropriate than the other? Personally I prefer the latter notation because I think it improves readability when the set in question takes a lot of space to write down:

\begin{align*} \lvert\{x\in X: \exists y\in Y\, \lvert x-y\rvert < 100\}\rvert \\ \#\{x\in X: \exists y\in Y\, \lvert x-y\rvert < 100\} \end{align*}

But I also think that it is more intuitive and helps with reducing ambiguity like in the above expression where $\lvert\cdot\rvert$ is being both used as the absolute value and as set cardinality. Is there any reason to use one over the other? I have noticed that the $\#$ notation appears frequently in number theory texts but that is the extent of my exposure to these notations.

• $|\cdot|$ is also used for Lebesgue measure, so in that context $\#$ might be more appropriate. – Jonatan B. Bastos Dec 16 '17 at 5:30
• I've also seen $\bar{\bar A}$ and $\operatorname{card} A$ but those seem to have gone out of fashion. – bof Dec 16 '17 at 5:36

The notation $\lvert\cdot\rvert$ seems to have the favour of an overwhelming majority of researchers in combinatorics and is also frequently used in number theory.

I am afraid I disagree with your argument that the $\#$ notation reduces ambiguity. Try to convert the following standard formulas using the $\#$ notation: $$\lvert A \cup B\rvert + \lvert A \cap B\rvert = \lvert A \rvert + \lvert B\rvert \qquad \lvert A \times B\rvert = \lvert A \rvert \lvert B\rvert \qquad \lvert A^B\rvert = {\lvert A \rvert}^{\lvert B\rvert}$$ Writing the first formula as $\# A \cup B + \# A \cap B = \# A + \# B$ would clearly be ambiguous, so you would have to write $\# (A \cup B) + \#(A \cap B) = \# A + \# B$ or even $\# (A \cup B) + \#(A \cap B) = \#(A) + \#(B)$. Thus, in this instance, not only the $\#$ notation is more ambiguous than the $\lvert\cdot\rvert$ notation, but if you use brackets to disambiguate, you lose concision: the $\#$ notation now requires more symbols than the $\lvert\cdot\rvert$ notation.

A last comment on your example \begin{align*} \lvert\{x\in X: \exists y\in Y\, \lvert x-y\rvert < 100\}\rvert \\ \#\{x\in X: \exists y\in Y\, \lvert x-y\rvert < 100\} \end{align*} Whatever notation you choose, it would probably be more appropriate to write something like:

Let $E(X,Y) =\{x\in X \mid \exists y\in Y \text{ such that }\lvert x-y\rvert < 100\}$. Then $\lvert E(X,Y)\rvert$ (or $\# E(X,Y)$) satisfies the formula...