Correlation Formula
The Pearson correlation coefficient is the covariance between two return series divided by the product of their standard deviations. It rescales covariance to a fixed range from -1 to +1, so two assets can be compared regardless of their volatility. Correlation is the central input to diversification: combining assets with low or negative correlation reduces portfolio risk.
Formula
Copy the exact expression or work through it step by step below.
rho(x,y) = Cov(x,y) / (sigma_x x sigma_y)
Cov(x,y) = (1/(n-1)) x sum_i (x_i - mean_x)(y_i - mean_y) Variables
Cov(x,y)
Covariance
Average product of the two series' deviations from their respective means. Its sign tells the direction of co-movement, but its magnitude depends on the assets' volatilities, which is why it must be normalized.
sigma_x, sigma_y
Standard deviations
Standard deviations of each series. Dividing covariance by their product strips out the scale, leaving a pure measure of linear association.
rho(x,y)
Correlation coefficient
Bounded between -1 (perfect inverse) and +1 (perfect direct), with 0 meaning no linear relationship. It measures only linear dependence, so nonlinear relationships can show low correlation despite strong structure.
n
Number of observations
Count of paired return periods. The n-1 divisor in the sample covariance gives an unbiased estimate.
Step By Step
- 1
Compute the mean of each return series.
Asset X mean 0.8%, asset Y mean 0.5% over the sample.
- 2
For each period multiply the two deviations from their means, sum, and divide by n-1 to get the covariance.
The sample covariance works out to 0.00018.
- 3
Compute each series' standard deviation.
sigma_X = 2.0%, sigma_Y = 1.5%.
- 4
Divide the covariance by the product of the two standard deviations.
0.00018 / (0.020 x 0.015) = 0.00018 / 0.0003 = 0.60.
Worked Example
Correlation between two assets being considered for a pair
Covariance(X, Y)
0.00018
sigma_X
2.0%
sigma_Y
1.5%
Denominator = sigma_X x sigma_Y = 0.020 x 0.015 = 0.00030. Correlation = 0.00018 / 0.00030 = 0.60.
Correlation of +0.60. The two assets move together more often than not but are far from lockstep, leaving meaningful diversification benefit when combined. Note correlation captures only linear co-movement and is notoriously unstable in crises, when correlations across risk assets tend to spike toward 1 just when diversification is needed most.
Common Variations
Try These Tools
Run the numbers next
Efficient Frontier Builder
Paste a multi-asset returns CSV. See the Markowitz mean-variance frontier, the minimum-variance portfolio, the max-Sharpe (tangency) portfolio.
Pair Trading Cointegration Tester
Paste two price series. Engle-Granger cointegration test: OLS hedge ratio, Augmented Dickey-Fuller on residuals, Ornstein-Uhlenbeck half-life, z-score.
Sources & References
- Note on Regression and Inheritance in the Case of Two Parents — Karl Pearson, Proceedings of the Royal Society of London (1895)
- Portfolio Selection — Harry Markowitz, Journal of Finance (1952)
Related Content
Keep the topic connected
Beta Formula
The beta formula: covariance of asset and market returns over market variance. The CAPM regression slope measuring systematic risk, with an example.
R-Squared Formula
The R-squared formula: the share of a portfolio's return variance explained by its benchmark. The squared correlation behind beta and alpha.
Information Coefficient Formula
The information coefficient formula: correlation between forecast and realized returns. How to measure quant forecasting skill, with a worked example.
Volatility
Volatility as the standard deviation of returns: realized vs implied, the annualization gotcha, and why volatility-of-volatility matters.