# Square brackets instead of parens for functions?

Why are sometimes square brackets used to apply parameters to functions instead of the usual round parentheses?

For instance, in my probability course, they use $\text{P}[X]$ to denote the probability that some event in the set $X$ comes to pass.

$$\text{P}[X] = \sum_{x \in X} p(x)$$

Is there any rule as to when to use square brackets instead of parens or is this arbitrary?

-
Who knows? As far as I can tell, it's arbitrary. I would avoid square brackets in general. –  Qiaochu Yuan Feb 26 at 19:14
I use brackets for stylistic reasons, with no different meaning from parentheses, whenever I judge that too many nested parentheses would look confusing/ugly; for instance I might write $f[g(x)]$ instead of $f(g(x))$. –  user7530 Feb 26 at 19:14
I used to distinguish between $\mathbb{P}[\cdots]$ and $\mathbb{P}(\cdots)$: in the former, the description of the set to be measured goes between the brackets, and in the latter, the set to be measured goes between the parentheses. So, for example, $\mathbb{P}[X = x]$ but $\mathbb{P}(\{ x \})$. –  Zhen Lin Feb 26 at 19:16
In Jech & Hrbacek's Introduction to Set Theory, the author adopt this notation to avoid confusion about images of sets and images of elements contained in such sets. For instance, is quite common denote $f^{-1}(\{x\})$ by $f^{-1}(x)$; in the square brackets notation we'd write $f^{-1}[x]$, which is more clean than $f^{-1}(\{x\})$ and not so abusive as $f^{-1}(x)$. Other reason is sets of sets: if we consider a set $A = \{A_1,\dots, A_n\}$ and a function $f:A\to B$ it would not be didactic to write $f(A')$ for some $A'\subseteq A$, for the elements of $A$ is also denoted by capital letters.