Sum of Products Calculator

Enter paired X and Y data to compute the statistical sum of products (SP = ΣXY − (ΣX)(ΣY)/n), plus the covariance and Pearson correlation coefficient it produces.

Quick Facts

Sum of products formula
SP = Σ(X−X̄)(Y−Ȳ) = ΣXY − (ΣX)(ΣY)/n
Measures how paired variables move together before scaling.
Covariance
Cov = SP / (n−1) sample, SP / n population
SP scaled by the number of data points (or degrees of freedom).
Correlation coefficient
r = SP / √(SSx · SSy)
Always falls between −1 and 1; SSx and SSy are the sums of squared deviations.
Regression slope
b = SP / SSx
The least-squares slope of Y on X is built directly from SP.

Your Results

Calculated
Sum of Products (SP)
-
Σ(X−X̄)(Y−Ȳ)
Sum of XY (ΣXY)
-
Raw sum of each X times its paired Y
Covariance
-
SP scaled by sample or population size
Correlation coefficient (r)
-
Pearson r, from −1 to 1

Ready

Enter matching lists of X and Y values, then press Calculate.

How the Sum of Products (SP) Works

In statistics, the sum of products (SP), also called the sum of products of deviations, is a building-block statistic used to describe how two paired variables, X and Y, vary together. For each pair of values, it measures how far X is from its own mean and how far Y is from its own mean, then multiplies those two deviations and adds the results across every pair: SP = Σ(Xi − X̄)(Yi − Ȳ). When both variables tend to be above (or both below) their means at the same time, the products are positive and SP is large and positive. When one variable tends to be high while the other is low, the products are negative and SP is negative. SP near zero suggests little linear relationship.

Deviation formula vs. computational formula

Computing the deviation formula directly requires finding X̄ and Ȳ first, then subtracting them from every value. In practice this calculator (and most textbooks) uses the algebraically equivalent computational formula, which needs only running totals: SP = ΣXY − (ΣX)(ΣY)/n, where n is the number of pairs, ΣXY is the sum of each X times its paired Y, and ΣX and ΣY are the simple sums of each list. Both formulas always give the same number — the computational version is just easier to calculate by hand or in a single pass through the data.

From SP to covariance, correlation, and regression

SP rarely stands alone — it is the numerator in several related statistics. Dividing SP by n − 1 gives the sample covariance; dividing by n gives the population covariance. Dividing SP by the square root of the product of the sums of squares, r = SP / √(SSx · SSy) — where SSx = ΣX² − (ΣX)²/n and SSy = ΣY² − (ΣY)²/n — gives the Pearson correlation coefficient r, a unit-free number between −1 and 1. And dividing SP by SSx alone gives the slope of the least-squares regression line of Y on X.

Common mistakes

  • Mismatched list lengths: X and Y must have exactly the same number of values, entered in the same order, since each pair is (Xi, Yi).
  • Confusing SP with ΣXY: ΣXY is just the raw sum of products; SP subtracts off the part explained by the two means, so the two numbers are usually quite different.
  • Too few data points: SP, covariance, and correlation all need at least two pairs — a single point has no variation to measure.
  • Ignoring zero variance: if every X value (or every Y value) is identical, its sum of squares is zero and the correlation coefficient becomes undefined, even though SP itself may still be computable.

Real-world applications

  • Computing the Pearson correlation coefficient between two variables in a statistics or research report.
  • Finding the slope of a least-squares regression line, since b = SP/SSx is the standard textbook formula.
  • Estimating covariance between two assets or measurements as an intermediate step before further analysis (such as portfolio variance).
  • Classroom and homework exercises that build correlation and regression from first principles rather than a single "black box" formula.

Frequently Asked Questions

What is the "sum of products" in statistics?
The sum of products (SP) measures how two paired variables X and Y vary together before scaling. It is defined as SP = Σ(Xi − X̄)(Yi − Ȳ), and is computed in practice with the equivalent computational formula SP = ΣXY − (ΣX)(ΣY)/n, which avoids computing the means first.
How is SP different from just adding up X times Y (ΣXY)?
ΣXY is simply the sum of each X times its paired Y. SP subtracts off the part of that sum explained by the two variables' overall averages, ΣXY − (ΣX)(ΣY)/n, so it reflects only the products of each point's deviation from its own mean — the quantity that actually drives covariance and correlation.
How do I turn SP into a correlation coefficient?
Divide SP by the square root of the product of the sum of squares of X and Y: r = SP / √(SSx · SSy), where SSx = ΣX² − (ΣX)²/n and SSy = ΣY² − (ΣY)²/n. This Pearson correlation coefficient r always falls between −1 and 1.
Why do I need at least two data points, and what happens if X or Y never changes?
With fewer than two pairs there is no variation to measure. If every X value (or every Y value) is identical, its sum of squares SSx (or SSy) is zero, making the correlation coefficient undefined (division by zero) even though SP and covariance can still be computed.