Correlation $=\pm 1$ iff $Y = a +bX$ for constants a and b. I need a bit of help proving the following:
$$Cor(X,Y) = \pm 1 \Leftrightarrow  Y = a +BX$$ with probability 1, for some constants a and b. Here $Cor(X,Y)$ is the Correlation of $X$ and $Y$.
I can manage to prove one way, that is if $Y = a +bX$, then $Cor(X,Y) = \pm1$, however I'm having trouble proving the opposite way. Any help is appreciated.  
 A: Following @Did's hint: 
Step 1:
Let $X' = X - E(X), Y' = Y - E[Y]$ (I suppose I'm assuming here that they actually have expected values...). Then 
$$
Cor(X', Y') = Cor(X, Y)
$$
If we can show that $Y' = c X'$, then we have
$$
Y = E[Y] - cE[X] + cX 
$$
so letting 
$$
a = E[Y] - c E[X] \\
b = c
$$
we then have $Y = a + bX$ as needed. In short: we need only consider the case where $X$ and $Y$ have mean zero. 
Step 2: 
Let's examine the case where the correlation is $+1$. (The $-1$ case is very similar, and I leave it to you).
By definition of the correlation, we have 
$$
\frac{E(X'Y')}{\sigma_X' \sigma_Y'} = 1
$$
so that
$$
E(X'Y') = \sqrt{E(X'^2) E(Y'^2)}
$$
Now noting that $\langle <X', Y'> \rangle = E(X'Y')$ is an inner product on the space of mean-zero random variables, the Cauchy-Schwarz-Bunyakovsky inequality tells us that in general, 
$$
E(X'Y') \le \sqrt{E(X'^2) E(Y'^2)}
$$
with equality only in the case where $Y'$ is a multiple $cX'$ of $X'$. 
I'm being a little sloppy here: what's really required is that $Y'$ and $X'$ are linearly dependent, but since $X'$ is nonzero, that's the same as $Y'$ being a multiple of $X'$. I'm being sloppy in another way: if you change the value of $X'$ or $Y'$ on a set of probability zero, then equality still holds. So what I can really conclude is that 
$$
P(Y' - cX' \ne 0) = 0.
$$
But that's exactly what we needed to prove that 
$$
Pr (Y = a + bX) = 1.
$$ 
(I'm pretty sure that the sloppiness here will offend some folks, but it gets across the main ideas, I believe; in the case where the domain of the random variables $X$ and $Y$ is finite, and where there are no massless atoms, what I've said is correct.)
A: WLOG, assume $\mathbb{E}X=\mathbb{E}Y=0,\mathbb{E}X^2=\mathbb{E}Y^2=1,\text{Corr}[X,Y]=1$. 


*

*Then $\text{Cov}[X,Y]=\mathbb{E}XY=1$.

*Now note $\mathbb{E}(X-Y)^2=\mathbb{E}X^2-2\mathbb{E}XY+\mathbb{E}Y^2=1-2+1=0$.

*As $(X-Y)^2\ge0$, we can infer that $(X-Y)^2\equiv0$ a.s., i.e. $Y=X$.
So, in generality, $\text{Corr}[X,Y]=1$ implies that the rescaled  versions of $X,Y$ are equal, i.e. $Y=a+bX$ for some $b>0$.
For $\text{Corr}[X,Y]=-1$, one follows the same line of reasoning with $(X+Y)^2$ in place of $(X-Y)^2$.
