Solution
= Solution
\b[Perfect correlation means an affine relation almost surely:] there are constants $a\ne0,b$ such that $Y=aX+b$ almost surely. The sign of $a$ is the sign of the <correlation coefficient>. More precisely, equality in the <Cauchy-Schwarz inequality> gives
$$
\boxed{\frac{Y-EY}{\sqrt{\operatorname{Var}Y}}
=\rho(X,Y)\frac{X-EX}{\sqrt{\operatorname{Var}X}}\quad\text{almost surely}.}
$$