# Summation of a fraction containing a summation operator

I came across a proof which had the following sequence:

$$\sum_{i=1}^n k_i y_i = \sum_{i=1}^n \frac{(x_i - \bar x)y_i}{\sum_{j=1}^n (x_j - \bar x)^2}$$

where

$$k_i = \frac{(x_i - \bar x)}{\sum_{j=1}^n (x_j - \bar x)^2}.$$

(Whatever the value of i, the denominator of $k_i$ is the same). Now,

\begin{align} \sum_{i=1}^n k_i^2 & = \sum_{i=1}^n\left[\frac{(x_i - \bar x)}{\sum_{j=1}^n (x_j - \bar x)^2}\right]^2 = \frac{1}{\sum_{j=1}^n (x_j - \bar x)^2}. \end{align}

I'm not quite sure how this inference is made. Could somebody show me (slowly) the steps in between? I am particularly confused about how the summation operators work in this situation.

## 1 Answer

If you have a term in a sum which is independent of the index then it's constant and you can simply factor it out of the sum. Do that with the denominator inside the square brackets:

\begin{align} \sum_{i=1}^n\left[\frac{(x_i - \bar x)}{\sum_{j=1}^n (x_j - \bar x)^2}\right]^2 &= \sum_{i=1}^n \frac{(x_i - \bar x)^2}{\left(\sum_{j=1}^n (x_j - \bar x)^2\right)^2} \\ &= \frac{1}{\left(\sum_{j=1}^n (x_j - \bar x)^2\right)^2} {\sum_{i=1}^n (x_i - \bar x)^2} \\ &= \frac{\sum_{i=1}^n (x_i - \bar x)^2}{\left(\sum_{i=1}^n (x_i - \bar x)^2\right)^2} \\ &= \frac{1}{\sum_{i=1}^n (x_i - \bar x)^2}. \end{align}