Proof that Correlation is between -1 and 1 and Linear Relationship

Let’s examine the range of Corr(X,Y)Corr(X,Y)

Let X,YX^*, Y^* be XX and YY in standard units, that is,

X=Xμxσx,Y=YμyσyX^* = \frac{X-\mu_x}{\sigma_x}, Y^* = \frac{Y-\mu_y}{\sigma_y}

Then XX^* and YY^* would have the following property

E(X)=E(Y)=0,SD(X)=SD(Y)=1\mathbb{E}(X)=\mathbb{E}(Y)=0, SD(X)=SD(Y)=1

And

Corr(X,Y)=Cov(X,Y)=E(XY)Corr(X,Y)=Cov(X^*,Y^*)=E(X^*Y^*)

So we know that

E[(XY)2]=1+12E(XY)0E(XY)1\mathbb{E}[(X^*-Y^*)^2]=1+1-2\mathbb{E}(X^*Y^*) \ge 0 \\ \mathbb{E}(X^*Y^*) \le 1
E[(X+Y)2]=1+1+2E(XY)0E(XY)1\mathbb{E}[(X^*+Y^*)^2]=1+1+2\mathbb{E}(X^*Y^*)\ge0 \\ \mathbb{E}(X^*Y^*) \ge -1

Therefore,

1Corr(X,Y)1-1 \le Corr(X,Y) \le 1

Moreover, if Corr(X,Y)=±1Corr(X,Y)=\pm 1, then either

E[(XY)2]=0\mathbb{E}[(X^*-Y^*)^2]=0

or

E[(X+Y)2]=0\mathbb{E}[(X^*+Y^*)^2]=0

That means every time either X=YX^*=Y^* or X=YX^*=-Y^*

So we can conclude that

Y=aX+bY=aX+b

and the sign of aa is determined by the sign of the correlation.