Let $ \rho\left(X,Y\right)=\dfrac{\text{Cov}\left(X,Y\right)}{\sqrt{\text{Var}[X]\text{Var[Y]}}}$. Prove that $$ |\rho\left(X,Y\right)|=1\iff\exists a,b\in\mathbb{R}:(\mathbb{P}[Y=aX+b]=1). $$
I prove the $ \Leftarrow $ direction. But I'm struggeling to prove the other direction.
Here's what I've tried:
Assume that $ |\rho\left(X,Y\right)|=1 $
Then
$ \left(\text{Cov}\left(X,Y\right)\right)^{2}=\text{Var}[X]\text{Var[Y]} $.
Now :
$ \require{cancel} \mathbb{E}^{2}[XY]+2\mathbb{E}[XY]\mathbb{E}[Y]\mathbb{E}[X]+\cancel{\left(\mathbb{\mathbb{E}}[X]\mathbb{E}[Y]\right)^{2}}=\mathbb{E}[X^{2}]\mathbb{E}[Y^{2}]-\mathbb{E}[X^{2}]\left(\mathbb{E}[Y]\right)^{2}-\left(\mathbb{E}[X]\right)^{2}\mathbb{E}[Y^{2}]+\cancel{\left(\mathbb{E}[X]\mathbb{E}[Y]\right)^{2}} $
So
$ \mathbb{E}^{2}[XY]+2\mathbb{E}[XY]\mathbb{E}[Y]\mathbb{E}[X]=\mathbb{E}[Y^{2}]\text{Var}[X]-\mathbb{E}[X^{2}]\left(\mathbb{E}[Y]\right)^{2} $
$ \mathbb{E}[Y^{2}]\text{Var}[X]=\mathbb{E}[\mathbb{E}^{2}[XY]+2\mathbb{E}[XY]\mathbb{E}[Y]X+\left(\mathbb{E}[Y]\right)^{2}X^{2}] $
$ \mathbb{E}[Y^{2}]=\mathbb{E}[\frac{\left(\mathbb{E}[XY]+\mathbb{E}[Y]X\right)^{2}}{\text{Var}[X]}] $
Define: $ b:=\frac{\mathbb{E}[XY]}{\sqrt{\text{Var}[X]}},\thinspace\thinspace\thinspace a:=\frac{\mathbb{E}[Y]}{\sqrt{\text{Var}[X]}} $
$ \mathbb{E}[Y^{2}]=\mathbb{E}[\left(aX+b\right)^{2}] $
$ \mathbb{E}\left(Y^{2}-\left(aX+b\right)^{2}\right)=0 $
I feel close because if the random variable in the expectation would have been non-negative I guess I could proceed from there, but it is not necessarily true.
Im looking for the most direct way to prove it, preferable without any tricks that I couldnt think of really fast (this is a question from an exam), is there a way to solve it using what I started?
Thanks in advance.
In the special case where $X$ and $Y$ each have variance $1$, the fact that their correlation is $1$ would imply $\operatorname{Cov}(X,Y)=1$, so that $$ \operatorname{Var}(X-Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)-2\operatorname{Cov}(X,Y)=1+1-2=0, $$ which implies $X-Y$ is constant.
In the general case, try to modify $X$ and $Y$ so they each have variance $1$. Now apply the previous (special) case.