A step in an equation simplification I don't understand how it is possible

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
I'm not too sure what the controversy is all about.

\(
N \sum_{n=1}^{N} x^2_n \; - \left(N\bar{x}\right)^2
\)

There doesn't appear to be any issue with rewriting this as

\(
N^2 \left( \frac{1}{N} \left( \sum_{n=1}^{N} x^2_n \right) \; - \bar{x}^2 \right)
\)

I'm putting in an extra parens to make clear what is in the summation and what is not.

This can then be written as

\(
N^2 \left( \frac{1}{N} \left(\sum_{n=1}^{N} x^2_n \right) \; - \; 2\bar{x}^2 \; + \; \bar{x}^2 \right)
\)

\(
N^2 \left( \frac{1}{N} \left(\sum_{n=1}^{N} x^2_n \right) \; - \; 2 \bar{x} \bar{x} \; + \; \bar{x}^2 \right)
\)

\(
N^2 \left( \frac{1}{N} \left(\sum_{n=1}^{N} x^2_n \right) \; - \; 2 \bar{x} \bar{x} \; + \; \frac{N}{N}\bar{x}^2 \right)
\)

There doesn't appear to be any issue with

\(
\bar{x} \; = \; \frac{1}{N} \sum_{n=1}^{N}x_n
\)

and there shouldn't be a problem with

\(
N \; = \; \frac{1}{N} \left( \sum_{n=1}^{N}1 \right)
\)

So that gets us to

\(
N^2 \left( \frac{1}{N} \left(\sum_{n=1}^{N} x^2_n \right) \; - \; 2 \bar{x} \frac{1}{N} \left( \sum_{n=1}^{N}x_n \right) \; + \; \frac{\left( \sum_{n=1}^{N}1 \right)}{N}\bar{x}^2 \right)
\)

We can now factor out the 1/N from the last two terms

\(
N^2 \left( \frac{1}{N} \left[ \left(\sum_{n=1}^{N} x^2_n \right) \; - \; 2 \bar{x} \left( \sum_{n=1}^{N}x_n \right) \; + \; \left( \sum_{n=1}^{N}1 \right) \bar{x}^2 \right] \right)
\)

Now we can take constants into the summations

\(
N^2 \left( \frac{1}{N} \left[ \left(\sum_{n=1}^{N} x^2_n \right) \; - \; \left( \sum_{n=1}^{N} 2 \bar{x} x_n\right) \; + \; \left( \sum_{n=1}^{N} \bar{x}^2 \right) \right] \right)
\)

Since the summations are all over the same limits, they can be combined:

\(
N^2 \left( \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x^2_n \; - \; 2 \bar{x} x_n \; + \; \bar{x}^2 \right) \right] \right)
\)

The summand now reduces to

\(
N^2 \left( \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x_n \; - \; \bar{x} \right)^2 \right] \right)
\)

Which, after removing some unnecessary parens, agrees with their result

\(
N^2 \cdot \frac{1}{N} \sum_{n=1}^{N} \left( x_n \; - \; \bar{x} \right)^2
\)
That is definitely an elegant proof. Thank you! I doubt I would have ever been able to come up with that, well done.
 

MrSalts

Joined Apr 2, 2020
2,767
It's often easiest to figure out the steps by working backwards:

\(
N^2 \cdot \frac{1}{N} \sum_{n=1}^{N} \left( x_n \; - \; \bar{x} \right)^2
\)

\(
N^2 \cdot \frac{1}{N} \sum_{n=1}^{N} \left( x_n^2 \; - \; 2 x_n \bar{x} \; + \; \bar{x}^2 \right)
\)

\(
N^2 \cdot \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x_n^2 \right) \; - \; \sum_{n=1}^{N} \left( 2 x_n \bar{x} \right) \; + \; \sum_{n=1}^{N} \left( \bar{x}^2 \right) \right]
\)

\(
N^2 \left( \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x_n^2 \right) \; - \; \sum_{n=1}^{N} \left( 2 x_n \bar{x} \right) \; + \; \sum_{n=1}^{N} \left( \bar{x}^2 \right) \right] \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x} \frac{\sum_{n=1}^{N} }{N} \right) \; + \; \left( \frac{\bar{x}^2}{N}\sum_{n=1}^{N}1 \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x} \bar{x} \right) \; + \; \left( \frac{\bar{x}^2}{N}N \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x}^2 \right) \; + \; \left( \bar{x}^2 \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \left( \bar{x}^2 \right) \right)
\)

\(
N^2 \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \; - \bar{x}^2 \right)
\)

Here is the starting point, now just walk upward to the ending point.
Thanks for taking the time to do that.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
It's often easiest to figure out the steps by working backwards:

\(
N^2 \cdot \frac{1}{N} \sum_{n=1}^{N} \left( x_n \; - \; \bar{x} \right)^2
\)

\(
N^2 \cdot \frac{1}{N} \sum_{n=1}^{N} \left( x_n^2 \; - \; 2 x_n \bar{x} \; + \; \bar{x}^2 \right)
\)

\(
N^2 \cdot \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x_n^2 \right) \; - \; \sum_{n=1}^{N} \left( 2 x_n \bar{x} \right) \; + \; \sum_{n=1}^{N} \left( \bar{x}^2 \right) \right]
\)

\(
N^2 \left( \frac{1}{N} \left[ \sum_{n=1}^{N} \left( x_n^2 \right) \; - \; \sum_{n=1}^{N} \left( 2 x_n \bar{x} \right) \; + \; \sum_{n=1}^{N} \left( \bar{x}^2 \right) \right] \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x} \frac{\sum_{n=1}^{N} }{N} \right) \; + \; \left( \frac{\bar{x}^2}{N}\sum_{n=1}^{N}1 \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x} \bar{x} \right) \; + \; \left( \frac{\bar{x}^2}{N}N \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \; \left( 2\bar{x}^2 \right) \; + \; \left( \bar{x}^2 \right) \right)
\)

\(
N^2 \left( \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \right) \; - \left( \bar{x}^2 \right) \right)
\)

\(
N^2 \left( \frac{1}{N} \sum_{n=1}^{N} x_n^2 \; - \bar{x}^2 \right)
\)

Here is the starting point, now just walk upward to the ending point.
Thanks! Another way I figured out how to do this was to set the two expressions equal to each other and check what value of x bar meets the equality:

\(
N^{2}\left(\frac{1}{N}\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}\right)=N^{2}\frac{1}{N}\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Cancel like terms:

\(
\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}=\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Expand the right hand side:

\(
\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}=\sum_{n=1}^{N}x_{n}^{2}+\overline{x}^{2}-2x_{n}\overline{x}
\)

Distribute the summations:

\(
\sum_{n=1}^{N}x_{n}^{2}-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}x_{n}^{2}+\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Cancel like terms:

\(
-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Re-arrange terms:

\(
2\sum_{n=1}^{N}\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Convert left side from summation to product:

\(
2N\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Divide both sides by 2*N*x(bar):

\(
\overline{x}=\sum_{n=1}^{N}x_{n}
\)

Completes the verification.
 
Last edited:

WBahn

Joined Mar 31, 2012
30,088
Thanks! Another way I figured out how to do this was to set the two expressions equal to each other and check what value of x bar meets the equality:

\(
N^{2}\left(\frac{1}{N}\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}\right)=N^{2}\frac{1}{N}\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Cancel like terms:

\(
\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}=\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Expand the right hand side:

\(
\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}=\sum_{n=1}^{N}x_{n}^{2}+\overline{x}^{2}-2x_{n}\overline{x}
\)

Distribute the summations:

\(
\sum_{n=1}^{N}x_{n}^{2}-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}x_{n}^{2}+\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Cancel like terms:

\(
-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Re-arrange terms:

\(
2\sum_{n=1}^{N}\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Convert left side from summation to product:

\(
2N\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Divide both sides by 2*N*x(bar):

\(
\overline{x}=\sum_{n=1}^{N}x_{n}
\)

Completes the verification.
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
 
Last edited:

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
I agree with the typo, but the mistake was only on the last and final step, not that early on:

1669504015378.png
I fixed it here, I just forgot to divide the right hand side by N just like I divided the left hand side by N.
Nice catch.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
True, I examined the first step. My mistake was assuming the summation applied to the entire expression when it does not.
I will rework it.
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
Here is my work (corrected). Please check:

Take the equality

\(
N^{2}\left(\frac{1}{N}\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}\right)=N^{2}\frac{1}{N}\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Divide through by N squared

\(
\frac{1}{N}\sum_{n=1}^{N}x_{n}^{2}-\overline{x}^{2}=\frac{1}{N}\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Multiply both sides by N

\(
\sum_{n=1}^{N}x_{n}^{2}-N\overline{x}^{2}=\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Which can be rewritten as

\(
\sum_{n=1}^{N}x_{n}^{2}-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}\left(x_{n}-\overline{x}\right)^{2}
\)

Carry out the multiplication on the right

\(
\sum_{n=1}^{N}x_{n}^{2}-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}\left(x_{n}^{2}+\overline{x}^{2}-2x_{n}\overline{x}\right)
\)

Distribute the summation on the right

\(
\sum_{n=1}^{N}x_{n}^{2}-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}x_{n}^{2}+\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)


Cancel like terms

\(
-\sum_{n=1}^{N}\overline{x}^{2}=\sum_{n=1}^{N}\overline{x}^{2}-2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Re-arrange

\(
2\sum_{n=1}^{N}\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Re-express left side as a multiplication being that is all it is

\(
2N\overline{x}^{2}=2\overline{x}\sum_{n=1}^{N}x_{n}
\)

Divide both sides by 2*N*x(bar)

\(
\overline{x}=\frac{1}{N}\sum_{n=1}^{N}x_{n}
\)
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
There's a problem here. Your final line claims that

\(
\bar{x}=\sum_{n=1}^{N}x_{n}
\)

But it doesn't. The left hand side is the mean while the right hand side is just the total sum of all the samples.

\(
\bar{x}=\frac{1}{N} \sum_{n=1}^{N}x_{n}
\)

The problem is that, early on, you distributed the summations, but summation is not distributive (although enough people think that it is that people get very sloppy with it). That is why the best policy is to be explicit wherever there is the possibility for ambiguity.

In this case, we can look at the original equation and see that the summation is NOT distributed there by considering the behavior of N.

\(
N \sum_{n=1}^{N} x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2}
\)

The question is whether this should be interpreted as

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

or

\(
\left( N \sum_{n=1}^{N} x_{n}^{2} \right) \; - \; \left( N \bar{x} \right)^{2}
\)

First, we can ask whether it makes sense to have the total number of samples inside a summation term. Generally, the answer would be no.

But now imagine that N has units (doesn't matter what). The summand in the first case has no N on the first term but has N² on the second, so there is a mismatch. But in the second case, the first term has N² (the explicit factor of N and then another N picked up by the summation operation), which matches the N² in the second term.

Then consider going from the first equation to the second equation. If the summation distributes, you would have

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; \left( N \bar{x} \right)^{2} \right)
\)

\(
N \sum_{n=1}^{N} \left( x_{n}^{2} \; - \; N^2 \bar{x}^{2} \right)
\)

There's no way to get that N² out of the summation without having to divide the first term by N² in the process.

These both argue strongly that the author of those equations does not distribute summations over addition/subtraction.

By distributing the summation on the left hand side, you picked up another factor of N, which is why your result for the mean was off by a factor of N.

EDIT: Fixed typos.
That got me thinking is this the correct way to interpret a summation to always consider it this way:

\(
\sum_{n=1}^{N}a_{n}+b=\left(\sum_{n=1}^{N}a_{n}\right)+b
\)

If you want it to apply to the entire expression you need to use parenthesis, correct?

\(
\sum_{n=1}^{N}(a_{n}+b)=\sum_{n=1}^{N}a_{n}+\sum_{n=1}^{N}b
\)

Being that math is typically an exact science, there has to be a correct way to express it?
 

WBahn

Joined Mar 31, 2012
30,088
That got me thinking is this the correct way to interpret a summation to always consider it this way:

\(
\sum_{n=1}^{N}a_{n}+b=\left(\sum_{n=1}^{N}a_{n}\right)+b
\)

If you want it to apply to the entire expression you need to use parenthesis, correct?

\(
\sum_{n=1}^{N}(a_{n}+b)=\sum_{n=1}^{N}a_{n}+\sum_{n=1}^{N}b
\)

Being that math is typically an exact science, there has to be a correct way to express it?
I'm not aware of any universally accepted rule for whether summation distributes over addition or not, but the vast majority of the texts and resources that I consider reliable maintain that it does not.

If you were to write

\(
\sum_{n=1}^{N} 1 + n
\)

Virtually everyone would assume that the summand was (1+n).

But if you were to write

\(
\sum_{n=1}^{N} n + 1
\)

Sum would think that the summand is (n+1) and others would think that it is just (n).

Because there is a real chance for ambiguity, it is best to write equations such that there is no possibility of mistaking the intent.
 

xox

Joined Sep 8, 2017
838
I'm not aware of any universally accepted rule for whether summation distributes over addition or not, but the vast majority of the texts and resources that I consider reliable maintain that it does not.

If you were to write

\(
\sum_{n=1}^{N} 1 + n
\)

Virtually everyone would assume that the summand was (1+n).

But if you were to write

\(
\sum_{n=1}^{N} n + 1
\)

Sum would think that the summand is (n+1) and others would think that it is just (n).

Because there is a real chance for ambiguity, it is best to write equations such that there is no possibility of mistaking the intent.
Also, if in doubt, look at is the baseline of the symbols. Terms within the summation will generally appear to be somewhat elevated relative to the symbols which follow if they are indeed to be separate. Otherwise it is probably safe to assume that the entire expression is to be carried out within the summation.
 
Top