[Tex/LaTex] LaTeX notation for summation over all combinations of two variables

math-operators

Is there a notation that expresses a summation over all order-independent combinations of two variables? I have a single set of objects and want to show the summation of the joint probabilities of each unordered pair of those objects. I want it to be clear I'm not counting duplicate pairs, because the order of the elements doesn't matter.

For example, if I have the set:

w = [dog, cat, bear]

I want to convey:

Z = P(dog, cat) + P(dog, bear) + P(cat, bear)

NOT

Z = P(dog, cat) + P(dog, bear) + P(cat, dog) + P(cat, bear) + P(bear, dog) + P(bear, cat)

summation

Best Answer

It looks like this has already been answered in the comments. As an alternative, if order doesn't matter, then you could impose some order on your indices to use fairly standard notation:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}
\[
    \sum_{\mathclap{a\leq i<j\leq b}}P(w_i,w_j)
\]
\[
    \sum_{\substack{i<j\\i,j\in A}} \!P(w_i,w_j)
\]

\end{document}

If you have a range of indices then the first option might be preferable, while if you have an arbitrary set of indices (or don't like the first option) then you might prefer the second.

Related Question