# What is the correlation if the standard deviation of one variable is 0?

As I understand, we can get correlation by normalizing covariance using the equation

where $\sigma_i=\sqrt{E[(X_i-\mu_i)^2]}$ is the standard deviation of $X_i$.

My concern is what if the standard deviation equals zero? Is there any condition that guarantees it cannot be zero?

Thanks.

It’s true that, if one of your SD’s is 0, that equation is undefined. However, a better way to think about this is that if one of your SD’s is 0, there is no correlation. In loose conceptual terms, a correlation is telling you about how one variable moves around as the other variable moves around. An SD of 0 implies that variable is not ‘moving around’. You would have to have a vector of a constant, such as rep(constant, n_times).