Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write formally the following sentence:

The sequence $S$ contains elements of the set $A$. Probability value $P(a)$ for element $a$ is defined as a number of its occurences in the sequence $S$, divided by count of all its elements.

I can write it the following way:

$$ S = (s_1, s_2, ..., s_n) : s_i \in A $$ $$ P(a) = {{ \left| \lbrace i \in \lbrace 1, 2, ..., n \rbrace : s_{i} = a \rbrace \right| } \over {n}}, \text{ given } n > 0\text{ and }a \in A $$

It's, however, quite long and rather not elegant, is there a simpler way to write this?


There's always a solution, which involves breaking the formula to smaller parts:

$$ \text{Let } C(x) = \left| \lbrace i \in \lbrace 1, 2, ..., n \rbrace : s_i = x \rbrace \right| $$ $$ P(a) = {C(a) \over n} $$

It's more readable, but it's still not what I'm searching for...

share|cite|improve this question
up vote 3 down vote accepted
  1. If you are willing to use the "Iverson bracket notation", popularized by Knuth and others, you can say $$C(x) = \sum_{i=1}^n [s_i = x]$$

    Here $[\ldots]$ are the Iverson brackets. $[P]$ is defined to be 1 if $P$ is true, and 0 if it is false.

  2. People do sometimes use the Kronecker delta for this: $\delta_{ij}$ is defined to be 1 if $i=j$ and 0 if $i\ne j$, so you would have:

    $$C(x) = \sum_{i=1}^n \delta_{xs_i}$$ or $$C(x) = \sum_{i=1}^n \delta(x, s_i)$$

    but I think the Iverson bracket is more straightforward.

  3. Most straightforward would be to write

    Let $C(x)$ be the number of elements of $s_1,\ldots,s_n$ that are equal to $x$. Then…

    The idea that this is somehow less "formal" than something involving a bunch of funny symbols is a common misapprehension.

share|cite|improve this answer
You know, I guess, that your third solution will suit my needs. After all, my priority is that someone understands my notation - writing the sentences as formally as possible is not really as important. – Spook Mar 11 '13 at 7:46
Agreed. I think the third solution provided is optimal for readability. A very classical approach. – Adam Erickson Mar 9 at 8:07

It's also not quite correct. How about $|\{i\in\{1,\ldots,n\}\colon s_i=a\}|$ in the numerator? If you view the sequence $S$ as a function $S\colon\{1,\ldots,n\}\to A$, $i\mapsto s_i$, then you might even write $|S^{-1}(a)|$ for the numerator. And the denominator should simply be $n$ (which you implicitly defined for $S$). As $S$ is not (primarily) a set, $|S|$ looks strange.

share|cite|improve this answer
You're right about my notation, I corrected it. However, I don't like the solution with $S^{-1}$ much, that looks like redefining the sequence to simplify the notation. I thought rather of a mathematical construct corresponding to a 'count of' function. Isn't there one? – Spook Mar 10 '13 at 15:55
@Spook Actually, that normally isn't really redefining the ntotion of sequence. But nevertheless, isn't $|\{\ldots\}|$ what corresponds to a count function after all? All that matters is that you can define your frequency notion clear and unambiguously, not necessarily with less then five symbols ... – Hagen von Eitzen Mar 11 '13 at 7:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.