# Notation for a sum over a set of variables

I have a vector of variables $y=(y_1, \ldots, y_n)$ whose elements are either zero or one. I would like to express the sum over all variables belonging to a subset $S$. For example, if $n=4$ and $S=\{2, 3\}$, I would like to express

$$\sum_{y_2\in\{0,1\}}\sum_{y_3\in\{0,1\}} f[y] = f[(y_1, 0, 0, y_3)] + f[(y_1, 1, 0, y_3)] + f[(y_1, 0, 1, y_3)]+ f[(y_1, 1, 1, y_3)]$$

more concisely. Does standard notation exist?

For context, I am concerned with marginalisation of a subset of a binary likelihood.

• I'm not sure I fully understand the equation in your question, but would you not simply write: $\sum_{s\in S} y_s$ as the sum of the variables whose indices are in $S$? – Pete Caradonna Jun 28 '16 at 16:01
• $\sum_{s\in S} y_s$ would sum over the fixed values of $y$ indicated by $S$. In my example, $\sum_{s\in S} y_s=y_3+y_6+y_7$. Instead, I want to sum over the domain of each binary variable. – Till Hoffmann Jun 28 '16 at 16:04
• This is why I was unsure; if $\forall i \le n$, $y_i \in \{0,1\}$, then $1 = \sum_{j\in \{0,1\}} j$, no? Then perhaps a more useful notation would just be $|S|$? – Pete Caradonna Jun 28 '16 at 16:05
• I don't quite follow your comment but will extend my question with a more explicit example to clarify. – Till Hoffmann Jun 28 '16 at 16:08

If I understand your question correctly, you could write

$$\sum_{s \in S}\sum_{y_s\in\{0,1\}}.$$

I'm not aware of any conventional method of writing this. That said, if the application is such that it is important that this be able to be written in one expression, I'd suggest doing it in two steps:

First, let $S' \subset \{0,1\}\times S$. Define $\hat{y}_{S'}$ as the vector whose $i$th component is $y_i$ if $i \not \in S$, and $\pi_i(S')$ if $i\in S$ (where $\pi_i$ denotes the projection onto the $i$-coordinate of $S'$). In other words, just the resulting vector one gets by replacing the components of $y$ with indices in $S$ with the values in $S'$.

Then what you're looking for can be written as:

$$\sum_{T \subseteq \{0,1\} \times S} \hat{y}_{T}.$$

• Thank you for the suggestion. I think I will go for a more elaborate description over a concise one given that standard notation doesn't seem to exist. – Till Hoffmann Jun 28 '16 at 22:27