Pattern Recognition, Bishop - MLE and Least squares section 3.1
We have 

$$\frac12 [(1+2)+(3+5)]=\frac12(1+3)+\frac12(2+5)$$

We can swap the order of summation of the LHS since addition is commutative and associative. 

After we decided how to pair them up, we just distribute $\frac12$ into them using distributive law.

\begin{align}
\frac1N \sum_{n=1}^N \sum_{j=1}^{M-1}w_j \phi_j (x_n) &amp;=\frac1N \sum_{j=1}^{M-1}\sum_{n=1}^N w_j \phi_j (x_n) \\
&amp;= \sum_{j=1}^{M-1}\frac1N\sum_{n=1}^N w_j \phi_j (x_n) \\
\end{align}

where the first equality is due to we are dealing with finite sum, and hence we can swap the order of additions, that is summing up the row first or column first doesn't matter. 

After which, we use distributive law to bring $\frac1N$ inside the first summation.