The Problem: I'm working on a problem from the Conceptual exercises from chapter three of "An Introduction to Statistical Learning". The problem is asking to show how the top equation below can be rewritten as the bottom equation.
Self-Study Notes: This is not for a class, purely for my curiosity. The simplification below is my attempt at the problem, written using LaTex, not copied from another source.
$$\hat{y_i}~=~x_i\hat{\beta}~~~~~and~~~~~\hat{\beta}~=~\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i'=1}^n x^2_{i'}}$$$$\hat{y_i}~=~x_i\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i'=1}^n x^2_{i'}}$$$$\hat{y_i}~=~\left( \frac{x_i}{1} \right)\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i'=1}^n x^2_{i'}}$$$$\hat{y_i}~=~\sum_{i=1}^{n} \left( \frac{\sum_{i=1}^{n} x_{i'}x_i}{\sum_{i''=1}^n x^2_{i''}} \right)y_{i'}$$$$\hat{y_i}~=~\sum_{i=1}^{n} a_{i'}y_{i'}~~~where~~~ a_{i'}~=~\left( \frac{\sum_{i=1}^{n} x_{i'}x_i}{\sum_{i''=1}^n x^2_{i''}} \right)$$
Question #1: I understand everything up until how the third equation becomes the fourth. Why was the additional $\sum_{i=1}^{n}$ added and why was the $y_i$ changed to $y_{i'}$ and moved outside of the summation in the fraction? Why was the $x_i$ able to "move inside" (for lack of a better phrase) of the numerator $\sum_{i=1}^{n}$
$$\hat{y_i}~=~\left( \frac{x_i}{1} \right)\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i'=1}^n x^2_{i'}}$$$$\hat{y_i}~=~\sum_{i=1}^{n} \left( \frac{\sum_{i=1}^{n} x_{i'}x_i}{\sum_{i''=1}^n x^2_{i''}} \right)y_{i'}$$
Question #2: (This could be part of my lack of understanding of the problem) What is the distinction between $x_{i'}$ (with the apostrophe) stand for as opposed to $x_i$ (no apostrophe)? I understand that $x_i$ stands for the ith observation, but I don't know what the apostrophe adds to the meaning. I asked a specific question regarding this here but would like a more general answer as well
[self-study]
tag & read its wiki. $\endgroup$