Sum of Products Calculator

Sum of Products Calculator

Emerging AI Skill PRO

Enter Calculation

Formula

Sum=∑i=1nai·bi\text{Sum} = \sum_{i=1}^{n} {a_i} \cdot {b_i}
Usage stats

Advertisement

Results

Sum of Products
32
Pairs multiplied 3

Report an error on this page

What Is a Sum of Products?

The sum of products is the total you get when you multiply each element of one list by the matching element of a second list and then add all those products together. Written compactly, it is \(S = \sum (a_i \times b_i)\). This operation is identical to the dot product of two vectors and appears everywhere from statistics and physics to finance and machine learning.

How to Use This Calculator

Enter your first list of numbers in List A and the matching list in List B, separating values with commas. The calculator pairs them position by position — the first of A with the first of B, the second with the second, and so on — multiplies each pair, and sums the results. If one list is longer, the extra trailing values are ignored so only complete pairs count.

The Formula Explained

For lists \(a = (a_1, a_2, \ldots, a_n)\) and \(b = (b_1, b_2, \ldots, b_n)\), the sum of products is:

$$S = a_1 \cdot b_1 + a_2 \cdot b_2 + \ldots + a_n \cdot b_n$$

Each term contributes its product, and the running total is the final answer. There are no division steps, so the result is defined for any numeric input.

Advertisement
Two aligned lists of numbers with each pair multiplied and the results added together
The sum of products multiplies aligned pairs \(a_i \cdot b_i\) and adds the results.

Worked Example

Suppose List A = 1, 2, 3 and List B = 4, 5, 6. Compute each product: \(1 \times 4 = 4\), \(2 \times 5 = 10\), \(3 \times 6 = 18\). Add them:

$$4 + 10 + 18 = 32$$

So the sum of products is 32, using 3 pairs.

Worked example showing two short vectors multiplied element-wise and summed
A worked example: pairwise products are summed into one final value \(S\).

More Worked Examples

Example 1: Weighted total (prices × quantities)

Three items cost $2.50, $4.00 and $1.25 each. You buy 3, 2 and 8 of them. List A holds the prices and List B holds the quantities: A = 2.5, 4, 1.25 and B = 3, 2, 8.

  1. Multiply the first pair: \(2.5 \times 3 = 7.5\)
  2. Multiply the second pair: \(4 \times 2 = 8\)
  3. Multiply the third pair: \(1.25 \times 8 = 10\)
  4. Add the products: \(S = 7.5 + 8 + 10 = \)25.5

The total cost of the purchase is $25.50.

Example 2: Negative numbers

Let A = 2, -3, 4 and B = 5, 6, -1.

  1. \(2 \times 5 = 10\)
  2. \((-3) \times 6 = -18\)
  3. \(4 \times (-1) = -4\)
  4. \(S = 10 + (-18) + (-4) = \)-12

The sum is negative because the pairs whose signs differ (the second and third) contribute more negative value (-22) than the positive pair contributes (10). A sum of products can therefore be positive, zero or negative, depending on how the signs and sizes of the terms line up.

Interpreting Your Result

The sum of products \(S = \sum a_i b_i\) is the dot product when the two lists are treated as vectors of equal length. Its meaning depends on the context.

Vectors and angles

The dot product is related to the angle \(\theta\) between the vectors by

$$\mathbf{a}\cdot\mathbf{b} = |\mathbf{a}|\,|\mathbf{b}|\cos\theta$$

  • S > 0: the angle is acute (less than 90°). The vectors point in broadly the same direction.
  • S = 0: the vectors are orthogonal (perpendicular), provided neither is the zero vector.
  • S < 0: the angle is obtuse (more than 90°). The vectors point in broadly opposite directions.

Weighted totals

When one list holds unit values (such as prices) and the other holds quantities, S is the total value, for example the total cost of an order.

Statistics

The quantity \(\sum x_i y_i\) is a building block for covariance, correlation and least-squares regression. Those measures also subtract the means and divide by the sample size.

Scale matters

S is not normalized. Doubling every value in one list doubles S. A large S does not by itself mean the lists are strongly aligned. To compare direction only, divide S by \(|\mathbf{a}|\,|\mathbf{b}|\) to get \(\cos\theta\).

Advertisement

Example Scenarios Compared

List A List B Sum of products S Relationship
1, 2, 3 4, 5, 6 32 Positive: the vectors point in broadly the same direction (acute angle)
1, 0 0, 1 0 Orthogonal: the vectors are perpendicular
1, 2, 3 -1, -2, -3 -14 Negative: the vectors point in opposite directions (angle of 180°)
1, 2, 3 1, 2, 3 14 Same list: S is the sum of squares, \(1 + 4 + 9\), which equals \(|\mathbf{a}|^2\)

Both lists must have the same number of entries, because each value is paired with the value at the same position in the other list.

FAQ

Is this the same as a dot product? Yes — for two vectors of equal length, the sum of products is exactly the dot product.

What if my lists are different lengths? Only matching pairs are used; extra values at the end of the longer list are ignored.

Can I use decimals or negative numbers? Absolutely. The calculator handles decimals and negatives, so products and the final sum may be negative or fractional.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators