Consider a measure space $(S, \Sigma, \mu)$ and the normed vector space $\mathcal{L}^2(\mu)$. Then for any measurable function $f: S \to \mathbb{R}$ with $f \in \mathcal{L}^2(\mu)$ the norm is defined as $$ ||f||_{\mathcal{L}^2(\mu)} := \left(\int_S f^2(x) \, \mu(dx)\right)^{1/2}, $$ and, as I understand it, this is exactly analogous to the "length" of $f$, just as the Euclidean norm is the "length" of a vector in $\mathbb{R}^n$.
Now consider a probability space $(\Omega, \mathcal{F}, P)$ and the normed vector space $\mathcal{L}^2(P)$. Let $X: \Omega \to \mathbb{R}$ be a random variable. Then for any such $X \in \mathcal{L}^2(P)$, we define the norm of $X$ $$ ||X||_{\mathcal{L}^2(P)} := \left( \int_{\Omega} X^2(\omega) \, P(d\omega)\right)^{1/2} = \left(E\left(X^2\right)\right)^{1/2}, $$ but this is not the "length" of $X$ unless $E(X) = 0$. Instead, we usually think of the standard deviation as the length of $X$ by subtracting $\mu := E(X)$ from $X$ first: $$ std(X) := \left(E\left(\left(X - \mu\right)^2\right)\right)^{1/2}. $$ This brings up two questions:
- Why must we subtract $\mu$ to interpret this as the "length"?
- I'm thinking of $\mathcal{L}^2(P)$ as a vector space over $\mathbb{R}$. Since $\mu \in \mathbb{R}$, what does $X - \mu$ mean? In Euclidean space, it doesn't make sense to write $\vec{x} - c$ for $\vec{x} \in \mathbb{R}^n$ and $c \in \mathbb{R}$.
Update I want to be able to apply the intuition of Euclidean geometry to visualize things like the correlation coefficient $\rho$ as the cosine of the angle between two random variables $X$ and $Y$, as explained here. In $\mathbb{R}^n$ the cosine of the angle between two vectors $\vec{x}$ and $\vec{y}$ is related to their inner product and lengths by $$ \cos \theta = \frac{\left<\vec{x}, \vec{y}\right>}{||\vec{x}||\cdot||\vec{y}||}. $$ If $||X||_{\mathcal{L}^2(P)}$ were indeed the "length" of $X$, then I feel like I should just be able to change the norms and inner products, but I can't because $$ \cos \theta = \frac{\left<X,Y\right>_{\mathcal{L}^2(P)}}{||X||_{\mathcal{L}^2(P)}\cdot||Y||_{\mathcal{L}^2(P)}} \neq \frac{\left<X - \mu_X, Y - \mu_Y\right>_{\mathcal{L}^2(P)}}{||X - \mu_X||_{\mathcal{L}^2(P)}\cdot||Y - \mu_Y||_{\mathcal{L}^2(P)}} = \frac{Cov(X,Y)}{std(X)\cdot std(Y)} = \rho $$
Update with picture Here's my intuition for conditional expectations in $\mathcal{L}^2$, as requested.
