Understanding the sum of products calculator — concept and principle
This calculator multiplies two lists value by value and adds the results, Σxᵢyᵢ. It also gives the individual products, Σx, Σy, the corrected sum of products and the sample covariance. Use it for dot products, totals of quantity × price, weighted sums, and as a step toward correlation and regression.
How it is calculated
- Sum of products: Σxᵢyᵢ = x₁y₁ + x₂y₂ + … + xₙyₙ.
- Corrected sum of products: SP = Σ(x − x̄)(y − ȳ) = Σxy − (Σx)(Σy) ÷ n.
- Sample covariance = SP ÷ (n − 1).
- Mean of the products = Σxy ÷ n.
Both lists must have the same length.
The principle
The raw sum of products is the dot product of two vectors: it combines two lists into one number by pairing their entries. On an invoice it is the total cost, Σ quantity × price. In statistics, what matters is how x and y move together around their means. SP multiplies each pair of deviations: when large x values go with large y values, most products are positive and SP is positive. SP is the numerator of the covariance, the correlation coefficient and the regression slope. The shortcut Σxy − (Σx)(Σy)/n gives the same value without computing deviations.
Worked example
Default lists: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5.
- Products: 1×2 = 2, 2×4 = 8, 3×5 = 15, 4×4 = 16, 5×5 = 25.
- Sum of products: 2 + 8 + 15 + 16 + 25 = 66.
- Σx = 15, Σy = 20, n = 5.
- SP = 66 − 15 × 20 ÷ 5 = 66 − 60 = 6.
- Sample covariance = 6 ÷ 4 = 1.5; mean of the products = 66 ÷ 5 = 13.2.
How to read the result
The raw sum is meaningful as a total (for example, money) or as a dot product. For relationships, look at SP or the covariance: positive means x and y tend to rise together, negative means one tends to fall as the other rises, and near 0 means no linear pattern. The size of the covariance depends on the units, so use the correlation coefficient to judge strength.
Common mistakes
- Using lists of different lengths or in mismatched order.
- Confusing Σxy with (Σx)(Σy); here 66 versus 300.
- Dividing SP by n when the sample covariance needs n − 1.
- Judging the strength of a relationship from the covariance alone.
Frequently asked questions
Is the sum of products the same as the dot product?
Yes, for two lists treated as vectors.
How is SP used in regression?
The least-squares slope is SP divided by the sum of squared x deviations.
Can I use it for a weighted total?
Yes. Put the quantities in one list and the weights or prices in the other.
Sources: OpenStax, Introductory Statistics 2e (2023), Chapter 12 Linear Regression and Correlation