Dot Product vs. Inner Product

In the previous lessons, we described a (typical) vector as a collection of ordered sequences of numbers. In contrast, a generalized vector can be any object that is an element of a vector space. The dot product (also known as the scalar product) is defined for a pair of typical vectors, whereas the inner product is defined for generalized vectors. The result of both operations is a scalar.

Dot product

A dot product, xy\bold{x} \cdot \bold{y} of two vectors, x,yRn\bold{x}, \bold{y} \in \R^n may be defined algebraically and geometrically.

Algebraic definition

Algebraically, a dot product is defined as:

xy=j=0nxi×yi\bold{x} \cdot \bold{y} = \sum_{j=0}^{n} x_i\times y_i

Example

Consider two vectors x,yR2\bold{x}, \bold{y} \in \R^2 are x=[52]\bold{x}=\begin{bmatrix}5 \\ 2\end{bmatrix} and y=[31]\bold{y}=\begin{bmatrix}3 \\ -1\end{bmatrix}. Their dot product is

5×3+2×1=135\times3+2\times -1=13

Geometric definition

Geometrically, a dot product is defined as

xy=xycosθ\bold{x}\cdot \bold{y} = |\bold{x}||\bold{y}|\cos \theta

where, x|\bold{x}| and y|\bold{y}| are the magnitudes of vector x\bold{x} and y\bold{y}, respectively. This definition is useful to calculate the angle between two vectors.

Magnitude of a vector

The magnitude (also known as length) of a vector, vRn\bold{v} \in \R^n, is defined as:

v=vv=ivi2|\bold{v}| = \sqrt{\bold{v} \cdot \bold{v}}=\sqrt{\sum_i v_i^2}

Example

Consider the vector x=[52]R2\bold{x} =\begin{bmatrix}5 \\ 2\end{bmatrix} \in \R^2. The magnitude of x\bold{x} is

x=52+22=25+4=29|\bold{x}| = \sqrt{5^2+2^2} = \sqrt{25+4}= \sqrt{29}

Angle between two vectors

The geometric definition of a dot product can be used to find the angle, θ\theta, between two vectors, x,yR2\bold{x}, \bold{y} \in \R^2, as follows:

θ=arccosxyxy\theta = \arccos{\frac{\bold{x}\cdot \bold{y}}{|\bold{x}||\bold{y}|}}

Example

Consider two vectors, x,yR2\bold{x}, \bold{y} \in \R^2 are x=[52]\bold{x}=\begin{bmatrix}5 \\ 2\end{bmatrix} and y=[31]\bold{y}=\begin{bmatrix}3 \\ -1\end{bmatrix}, which have the magnitudes, x=29|\bold{x}|=\sqrt{29}, y=10|\bold{y}|=\sqrt{10}. The angle between them is

θ=arccos13290=40.236\theta = \arccos{\frac{13}{\sqrt{290}}}= 40.236

Get hands-on with 1200+ tech skills courses.