# ISLR - Simplify Equation

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

• Welcome to Cross Validated. Please type your question as text, do not just post a photograph (see here). When you retype the question, please also add the [self-study] tag & read its wiki. – DeltaIV Dec 27 '17 at 23:13

The summation identity I needed to solve the equation was $C \cdot \sum_{i=1}^{n}f(x)~=~\sum_{i=1}^{n}C \cdot f(x)$. I believe I've solved it as: $$\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{x_i}{1} \right)\left( \frac{\sum_{i=1}^{n} x_{i'}y_{i'} }{\sum_{k=1}^n x^2_{k}} \right)$$ $$\hat{y_i}~=~\sum_{i=1}^{n} \left( \frac{x_i}{1} \right) \left( \frac{y_i}{1} \right)\left( \frac{\sum_{i=1}^{n} x_{i'} }{\sum_{k=1}^n x^2_{k}} \right)$$ $$\hat{y_i}~=~\sum_{i=1}^{n} \left( \frac{y_i}{1} \right)\left( \frac{\sum_{i=1}^{n} x_ix_{i'}}{\sum_{k=1}^n x^2_{k}} \right)$$
$$\hat{y_i}~=~\sum_{i=1}^{n} \left( \frac{\sum_{i=1}^{n} x_{i}x_{i'} }{\sum_{k=1}^n x^2_{k}} \right)y_{i'}$$ $$\hat{y_i}~=~\sum_{i=1}^{n} a_{i'}y_{i'}~~~where~~~ a_{i'}~=~\left( \frac{\sum_{i=1}^{n} x_ix_{i'} }{\sum_{k=1}^n x^2_{k}} \right)$$