44

I remember once hearing offhandedly that in set builder notation, there was a difference between using a colon versus a vertical line, e.g. $\{x: x \in A\}$ as opposed to $\{x\mid x \in A\}$. I've tried searching for the distinction, but have come up empty-handed.

Kevin Long
  • 5,159

5 Answers5

53

There is no difference that I've ever heard of. I do strongly prefer "$\vert$" to "$\colon$", though, because I'm often interested in sets of maps, and e.g. $$\{f \mid f\colon \mathbb{R}\rightarrow\mathbb{C}\text{ with $f(6)=24$}\}$$ is easier to read than $$\{f: f\colon \mathbb{R}\rightarrow\mathbb{C}\text{ with $f(6)=24$}\}$$.

EDIT: Note that as Mike Pierce's answer shows, sometimes "$:$" is clearer. At the end of the day, use whichever notation is most clear for your context.

Noah Schweber
  • 245,398
  • 25
    Except perhaps if the conditions require absolute values… – Bernard Oct 28 '15 at 02:05
  • @Bernard Certainly neither is perfect. (I rarely deal with absolute values, though.) I've seen a period, ".", used, and I like it - but I've never seen that used in a publication, so I wouldn't use it. – Noah Schweber Oct 28 '15 at 02:09
  • Ah, thank you. Perhaps I just confused logical distinction with grammatical clarity. – Kevin Long Oct 28 '15 at 02:11
  • 2
    As an example where the colon might be preferable, take a set where membership is defined by divisibility conditions: ${ d \in \mathbb{Z}^+: d|m ; \land ; d|n}$. – Chester Oct 28 '15 at 12:25
  • 2
    ${f \colon \mathbb{R} \to \mathbb{C} : f(6) =24 }$ is also readable - double colon, but no double "f" – Carl Mummert Oct 28 '15 at 16:25
  • 2
    Oh, boy -- finally a legitimate excuse for me to drag out those $f \in { \mathbb{R} \to \mathbb{C} }$ or $f \in \mathbb{C}^\mathbb{R}$ notations! (Admittedly the former involves adding more brackets, but for some reason it doesn't bother me in the least, I guess because the nesting is so shallow (edit: and because the enclosed expression is tiny).) – Vandermonde Oct 28 '15 at 19:15
35

There is no difference. The bar is just often easier to read than the colon (like in the example in Noah Schweber's answer). However in analysis and probability, the bar is used in other notation. In analysis it is used for absolute value (or distance or norms) and in probability it is used in conditional statements (the probability of $A$ given $B$ is $\operatorname{P}(A \mid B)$). So looking at bar versus colon in sets with these notations $$ \{x \in X \mid ||x|-|y_0||<\varepsilon\} \quad\text{vs}\quad \{x \in X : ||x|-|y_0||<\varepsilon\} $$ $$ \{A \subset X \mid \operatorname{P}(B \mid A) > 0.42\} \quad\text{vs}\quad \{A \subset X : \operatorname{P}(B \mid A) > 0.42\} $$ it can be better to use the colon just to avoid overloading the bar.

Mike Pierce
  • 18,938
  • 5
    In such cases I use different sizes of the vertical bar, e.g. $$\Big{x\in X \ \Big|\ \big||x|-|y_0|\big| < \varepsilon \Big}.$$ – dtldarek Oct 29 '15 at 14:29
  • 3
    @dtldarek, yeah, yours is clear to read (and I think looks better than with a colon). My only problem is that by making the bar taller, you can't really have this typed in-line or else the line-spread will start to look weird (like what happens when you see sums or products with $\sum$ or $\prod$ typed in-line). – Mike Pierce Oct 29 '15 at 14:59
10

It seems many good answers and examples have been provided, but I didn't see it mentioned above that regardless of which symbol you choose to use, in the set builder context both would be read aloud as "such that".

As for my example of preference, I am often working in number theory so I use the colon, ":", to avoid the bar being misinterpreted as "divides", or aesthetic reasons if I am also going to use the bar to mean divides in the specification of the set.

Prince M
  • 3,893
3

Both are acceptable means and practices within the community. Most people I know prefer the line method because it provides a clear separation and can be used if you are defining your set on multiple lines of scratch work.

2

I recently realized I read them differently. To me | acts more like a "filter" over a larger set, whereas : acts more like a "generator" from a smaller expression.
This isn't 100% accurate though. I'm usually fine with : acting like a filter as well... but less so with | acting like a generator.

For example, this looks jarring to me:

\begin{align} t^* = \max \left\{ t_i\ \middle|\ \frac{\partial f_i}{\partial x_i} = 0 \right\} \end{align}

whereas this looks fine to me:

\begin{align} t^* = \max \left\{ t_i : \frac{\partial f_i}{\partial x_i} = 0 \right\} \end{align}

This is because when I read $t_i\ |\ \ldots$ I expect the right-hand side to contain some constraints on the possible values of $t_i$, which I otherwise assume to be all reasonable values (e.g. all real numbers).
But when I read $t_i : \ldots$ I expect to see an expression that tells me how to generate the set of $t_i$, and that need not involve $t_i$ itself at all.

I don't know if everyone reads them like this, but for me they are not quite always interchangeable, even though they frequently are.

user541686
  • 13,772
  • 5
    Both look jarring, since $t_i$ is not even a variable in the RHS statement. – Asaf Karagila Mar 03 '17 at 06:59
  • 1
    @AsafKaragila: Aw really? How would you have written it...? – user541686 Mar 03 '17 at 07:09
  • 3
    I don't know what you're trying to write, so I can't quite tell you. – Asaf Karagila Mar 03 '17 at 09:18
  • 1
    @AsafKaragila: I already have $t_1, \ldots, t_n$ and I have $f_i, \ldots, f_n$ and I have $x_1, \ldots, x_n$ (with the obvious correspondence across the sequences based on the indices). I'm trying to say "the $\max$ of all $t$'s corresponding to the $f$'s whose partial derivatives with respect to the corresponding $x$'s are zero". How would you say that? – user541686 Mar 03 '17 at 10:14
  • Perhaps you could split it up: $\quad S = {i \in 1..n : \frac{\partial f_i}{\partial x_i} = 0}, \quad t^* = \underset{i \in S}{\max} \ t_i. \quad$ It makes sure $\max$ is used in the traditional way. But looking here, it looks like there's a few different notations you could use depending on the domain... – Mateen Ulhaq Oct 18 '20 at 08:23
  • I'm not sure I understand what you mean by "generator". They both seem to "filter" over the domain. – Mateen Ulhaq Oct 18 '20 at 08:29