# Combining set builder and summation notation

What's the best notation for the sum of a subset?

Given $S = \{1,2,3,4,5,6,7\}$, let's say I want to find the sum of the squares of elements less than 4.

Initially I used the following notation: $$\sum_{\{i \in S:i<4\}}i^2$$

But I thought there is missing information, since only the set is provided. Here's alternative #1: $$\sum_{i\in\{x \in S:x<4\}}i^2$$

That seems verbose, so here's alternative #2, with some reordering: $$\sum\{i^2:i \in S:i <4\}$$

Which of the above is best, and is there an even better notation?

• If you use this sum more than once or twice, you should consider defining $T=\{x\in S:x<4\}$. Then your sum can be over $i\in T$. Also, your alternative#2 with the double colons, is highly nonstandard. – vadim123 Dec 14 '13 at 19:24
• It's only used once in my case, but that is a good idea, thanks. – imsky Dec 14 '13 at 19:29
• Yes, instead of $\{i^2 : i\in S : i< 4\}$, you should write $\{i^2 : i\in S\text{ and }i<4\}$. – Alex Kruckman Dec 14 '13 at 22:08

It's pretty common to see notation like $$\sum_{\substack{i \in S \\ i < 4}} i^2$$
Here the $i<4$ is a condition you're imposing on the $i$ appearing in the sum (in addition to $i\in S$).