Suppose X and Y are random variables such that $Y=aX+b$ and $a$ and $b$ are constants. Show that $Cor(X,Y) = \begin{cases} +1 &\mbox{if } a > 0 \\ -1 & \mbox{if } a < 0. \end{cases}$
For this, I am using the formula for correlation provided in my book:
$$Cor(X,Y) = \frac{Cov(X,Y)}{\sqrt{Var(X)Var(Y)}} = \frac{E(XY) - E(X)E(Y)}{\sqrt{(E(X^2) - E(X)^2)(E(Y^2) - E(Y)^2)}}$$.
I substitute in the values of X and Y=aX+b to get:
$$Cor(X,aX+b) = \frac{E(X(aX+b)) - E(X)E(aX+b)}{\sqrt{(E(X^2) - E(X)^2)(E((aX+b)^2) - E(aX+b)^2)}}$$
I know that I can pull out constants and use the sum rule, but using those just gets really messy and I don't think leads anywhere.
I know how to show this would be between -1 and 1, but I must show it is exactly -1 OR exactly 1. I assume that this would involve squaring this value, but I am lost with where to go from here. Anything I do just makes the equation monstrous. I have been told this is an "easy" proof.
Any tips on how to proceed?
Hint: Use the first part of your $Cor(X, Y)$ expression: $$ Cor(X, Y)=\frac{Cov(X, Y)}{\sqrt{Var(X)Var(Y)}} $$ and replace $Y$ by $Y=aX+b$. Use the rules for covariances and variances to simplify.