Sum of Products Calculator
Enter two comma-separated lists of numbers and this calculator multiplies each pair of corresponding values, sums those products, and shows every step of the working. You also get the weighted average (when Series A holds values and Series B holds weights), the number of pairs, and an instant check on whether the datasets are the same length.
Formula
Worked example
With Series A = [2, 4, 6, 8] and Series B = [1, 3, 5, 7]: products are 2x1=2, 4x3=12, 6x5=30, 8x7=56. SOP = 2+12+30+56 = 100.
What is the sum of products?
The sum of products (SOP) multiplies each pair of corresponding values from two series and adds the results together. If Series A = [a1, a2, ..., an] and Series B = [b1, b2, ..., bn], then SOP = a1xb1 + a2xb2 + ... + anxbn. It is sometimes called a dot product or inner product in linear algebra, and it appears in statistics (as the numerator of covariance and Pearson's correlation), finance (as a weighted portfolio return), signal processing (as a convolution step), and machine learning (as the core of every neuron in a neural network). The key requirement is that both series must have the same length: each element in Series A is paired with exactly one element in Series B.
How to calculate the sum of products step by step
Step 1: write both series side by side and confirm they are the same length. Step 2: for each position i, multiply a_i by b_i to get the product. Step 3: add all the products together. For example, with A = [3, 5, 2] and B = [4, 1, 6]: the products are 3x4=12, 5x1=5, 2x6=12, and the SOP is 12+5+12 = 29. The calculator shows every one of these multiplication steps in the "Show your work" panel so you can verify each pair.
Weighted average using sum of products
A weighted average is a special use of the SOP formula. When Series A holds the values and Series B holds their weights, the weighted average is SOP / sum(B). For instance, if a student scores 80, 90, and 70 on tests worth 3, 4, and 3 credits respectively, the SOP is 80x3+90x4+70x3 = 240+360+210 = 810, and the weighted average is 810 / (3+4+3) = 81. This correctly gives more influence to the 4-credit test than to the 3-credit ones. The "Weighted average" mode in this calculator performs that division for you automatically.
Covariance and the mean-centred SOP
Covariance measures how two variables move together. The sample covariance formula is: cov(A, B) = sum((a_i - mean_A)(b_i - mean_B)) / (n - 1). The numerator of that expression, sum((a_i - mean_A)(b_i - mean_B)), is the mean-centred sum of products. Selecting "Covariance component" mode returns that numerator. A positive value means the two series tend to rise and fall together; a negative value means they tend to move in opposite directions; zero means no linear relationship. To obtain the full sample covariance, divide the result by (n - 1).
Sum of products in common formulas
| Formula | How SOP appears | Divide by |
|---|---|---|
| Dot product (linear algebra) | SOP = sum(a_i x b_i) | Nothing (SOP is the result) |
| Weighted average | SOP = sum(value_i x weight_i) | sum(weights) |
| Sample covariance | SOP of mean-centred values | n - 1 |
| Pearson correlation | SOP of z-scored values | n - 1 |
| Portfolio return (WACC) | SOP = sum(return_i x weight_i) | sum(weights) = 1 |
| Least-squares regression slope | SOP of (x - x-bar)(y - y-bar) | SOP of (x - x-bar)^2 |
Many standard statistical and financial formulas rely on the SOP as a building block.
Frequently asked questions
What happens if the two series are different lengths?
Only the overlapping pairs (up to the length of the shorter series) are used. The calculator displays a warning in the "Length check" output so you can spot the mismatch and fix it. If you intended to include all elements, pad the shorter series with zeros.
Can I use negative numbers or decimals?
Yes. Any finite number is accepted, including negatives, decimals, and fractions entered as decimals (e.g. 0.5). If any product is negative, it reduces the running total; if positive, it increases it. The final SOP can therefore be negative, zero, or positive depending on the mix of signs.
What does a sum of products of zero mean?
A SOP of zero can arise in two ways: either at least one series consists entirely of zeros, or the positive and negative products cancel each other exactly. In a statistical context, a mean-centred SOP of zero signals no linear relationship (zero covariance) between the two variables.
How does this relate to the dot product in linear algebra?
They are the same operation. In linear algebra the dot product of two vectors a and b is defined as the sum of the element-wise products, which is exactly what this calculator computes. The dot product is positive when the angle between the vectors is less than 90 degrees, zero when they are perpendicular (orthogonal), and negative when the angle exceeds 90 degrees.
Can I extend the sum of products to three or more series?
The classic two-series formula does not generalise directly to three series in a single scalar result (a triple product would require a different definition). The most common approach is to compute the SOP of two series, then use that result as one series in a further computation. For example, to weight values by two criteria, compute the combined weight first.
What is the difference between weighted average mode and standard SOP?
Standard SOP mode returns the raw total, sum(a_i x b_i). Weighted average mode divides that total by the sum of the weights (Series B), giving the mean value with Series A values weighted by Series B. Use weighted average when the weights represent proportions or importance scores and you want a single representative value rather than a raw total.