*75*

This tutorial explains how to calculate the dot product in Google Sheets.

**What is the Dot Product?**

Given vector *a* = [a_{1}, a_{2}, a_{3}] and vector *b* = [b_{1}, b_{2}, b_{3}], theÂ **dot product**Â of vector a and vector b, denoted asÂ **a Â· b**, is given by:

**a Â· b**Â = a_{1}Â * b_{1}Â + a_{2}Â * b_{2}Â + a_{3}Â * b_{3}

For example, if *a* = [2, 5, 6] and *b* = [4, 3, 2], then the dot product of *a* and *b* would be equal to:

**a Â· b =Â **2*4 + 5*3 + 6*2

**a Â· b =Â **8 + 15 + 12

**a Â· b =Â **35

In essence, theÂ **dot productÂ **is the sum of the products of the corresponding entries in two vectors.

**How to Find the Dot Product in Google Sheets**

To find the dot product of two vectors in Google Sheets, we can use the followings steps:

**1. Enter the data**.

First, enter the data values for the first vector in one column and the data values for the second vector in the second column:

**2. Calculate the dot product.**

To calculate the dot product, we can use the **SUMPRODUCT() **function, which uses the following syntax:

**SUMPRODUCT(array1, [array2], â€¦)**

**arrayÂ**â€“ the first array or range to multiply, then add.**array2Â**â€“ the second array or range to multiply, then add.

The following image shows how to use this function to calculate the dot product between these two vectors:

This produces the valueÂ **35**, which matches the answer we got by hand.

Note that theÂ **SUMRRODUCT()Â **function works for vectors of any length. For example, we could use this function to calculate the dot product between two vectors both of length 20:

**Potential Errors in Calculating the Dot Product**

The functionÂ **SUMPRODUCT()Â **will return a **#VALUE!** error if the vectors do not have equal length.

For example, if the first vector has length 20 and the second vector* *has length 19, then the formulaÂ **=SUMPRODUCT(A1:A20, B1:B19)** will return an error.

The two vectors need to have the same length in order for the dot product to be calculated.