I am looking at the following equation:

$$\sum_{i=1}^n (a_i+b)^2 + \sum_{j=1}^m a_j$$

I am not sure what the convention for the order of operations for this would be.

Is it:

$$(\sum_{i=1}^n (a_i+b)^2) + \sum_{j=1}^m a_j$$


$$\sum_{i=1}^n ((a_i+b)^2 + \sum_{j=1}^m a_j)$$

Edit: If the plus sign was changed to a product, how would this be evaluated?

$$\sum_{i=1}^n (a_i+b)^2 \sum_{j=1}^m a_j$$

Like this:

$$(\sum_{i=1}^n (a_i+b)^2) \sum_{j=1}^m a_j$$


$$\sum_{i=1}^n ((a_i+b)^2 \sum_{j=1}^m a_j)$$

I suppose the general question I am trying to ask is twofold:

  • What is the order of operations for sums?
  • Searching "Order of operations" in Google doesn't help me find interesting results. What are the correct search terms?
  • 1
    $\begingroup$ I would say it applies to the first term, meaning it's your first interpretation. Specifically, that it fits strictly between multiplication and addition in the order of operations. I don't know how standard that is, though. $\endgroup$ – Arthur Oct 2 '18 at 18:27
  • 2
    $\begingroup$ Most people would interpret it as the first option. If you intend it to be the second option, I would use more parentheses or brackets to make sure that it is clear the second summation is a part of the summand of the first. As for where the squaring occurs, I would interpret it as each summand being squared. If you wanted the total squared, again use more parentheses to make it clear. $\endgroup$ – JMoravitz Oct 2 '18 at 18:28
  • 1
    $\begingroup$ I would have never ever taken the equation to mean the second option. If someone wrote the given expression, and meant the second interpretation, I would take it as almost intentionally misleading $\endgroup$ – JuliusL33t Oct 2 '18 at 18:30
  • 2
    $\begingroup$ With regards to the recent edit asking about $\sum\limits_{i=1}^n(a_i+b)^2\sum\limits_{j=1}^ma_j$, you will find that both of your following expressions are equal by recognizing summation is linear: $\sum_i\alpha a_i = \alpha \sum_i a_i$, but in cases where indices are mixed or more care needs to be used, I would interpret it as the first. $\endgroup$ – JMoravitz Oct 2 '18 at 18:36
  • $\begingroup$ Possible duplicate of Order of operations / Precedence in Sigma notation $\endgroup$ – leonbloy Oct 2 '18 at 18:50

As commented after the first paragraph of this answer to a related question, the expression

$$\sum_i c + d$$

is ambiguous. The usual convention is: if the second term don't depend on $i$ (the summation index) then the sum should not include it: $ (\sum_i c) + d$. Elsewhere (of course) it would include it: $ \sum_i (c + d)$.

In your example, this criterion would vote for your first interpretation - and I think this agrees with the way most people here would parse it:

$$\sum_{i=1}^n (a_i+b)^2 + \sum_{j=1}^m a_j = \left(\sum_{i=1}^n (a_i+b)^2\right) + \sum_{j=1}^m a_j$$

But it's better to avoid the ambiguity, and write it differently so that the precedence is clear.

See also here (actually, after seeing that, I'm wondering if this question should be closed as duplicated... )


For the whole expression the first interpretation is correct.

For the first expression, you can see what's happening if you write out the sum with an ellipsis: $$ \sum_{i=1}^n (a_i+b)^2 = (a_1 + b_1)^2 + (a_2 + b_2)^2 + \cdots + (a_n + b_n)^2 . $$

Writing sums with an ellipsis is often a good strategy for figuring out what is meant.

Edit (in response to comment). The squaring occurs for each sum because in conventional order of operations, the exponentiation takes precedence over the sum. Writing the sum as an ellipsis makes the structure clearer.

Edit in response to edited question. Most mathematicians would read the successive sums as parenthesized (your first opiton).

  • 2
    $\begingroup$ "For the first expression, you can see what's happening if you write out the sum with an ellipsis"... You can't rightly do that if you can't interpret it in the first place and aren't sure whether $\sum\limits_{i=1}^n (a_i+b)^2$ is to be interpreted as $\sum\limits_{i=1}^n((a_i+b)^2)$ or as $\left(\sum\limits_{i=1}^n(a_i+b)\right)^2$. The question is asking which of these two is meant. $\endgroup$ – JMoravitz Oct 2 '18 at 18:31
  • $\begingroup$ @JMoravitz Fair enough. I've edited the answer. $\endgroup$ – Ethan Bolker Oct 2 '18 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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