Book contents
Contents
raw Math

The dot product (also called inner product or scalar product) of two vectors \(\mathbf{a}\) and \(\mathbf{b}\) is the central operation that links geometry and algebra: it encodes angle and length information in a single scalar and yields a coordinate formula used throughout linear algebra, geometry, and physics.

Definition

Geometrically, for the angle \(\theta\) between \(\mathbf{a}\) and \(\mathbf{b}\),

\[ \boxed{\mathbf{a}\cdot\mathbf{b}=\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta}. \]

In 2D, for \( \mathbf{N}=\begin{bmatrix}a\\b\end{bmatrix} \) and \( \mathbf{X}=\begin{bmatrix}x\\y\end{bmatrix} \), the coordinate definition is simply

\[ \mathbf{N}\cdot\mathbf{X} = \begin{bmatrix}a\\b\end{bmatrix}\cdot\begin{bmatrix}x\\y\end{bmatrix} =ax+by. \]

From the Law of Cosines to the Coordinate Formula

Vectors \(\mathbf{a}\), \(\mathbf{b}\), and \(\mathbf{b}-\mathbf{a}\) forming a triangle.

Let \(\mathbf{c}=\mathbf{b}-\mathbf{a}\). In the triangle formed by \(\mathbf{a}\), \(\mathbf{b}\), and \(\mathbf{c}\), the law of cosines gives

\[ \begin{array}{rrl} & \|\mathbf{b}-\mathbf{a}\|^2 &= \|\mathbf{a}\|^2+\|\mathbf{b}\|^2-2\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta \\ \Leftrightarrow & \|\mathbf{c}\|^2 &= \|\mathbf{a}\|^2+\|\mathbf{b}\|^2-2(\mathbf{a}\cdot\mathbf{b}) \\ \Leftrightarrow & \mathbf{c}\cdot\mathbf{c} &= \mathbf{a}\cdot\mathbf{a}+\mathbf{b}\cdot\mathbf{b}-2\,\mathbf{a}\cdot\mathbf{b} \\ &&= (\mathbf{a}-\mathbf{b})\cdot(\mathbf{a}-\mathbf{b}). \end{array} \]

Rearranging the first line:

\[ -2\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta = \|\mathbf{b}-\mathbf{a}\|^2-\|\mathbf{a}\|^2-\|\mathbf{b}\|^2. \]

Write vectors in coordinates and expand:

\[ \begin{array}{rl} -2\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta =& (a_1-b_1)^2+(a_2-b_2)^2+\dots \\ &\; - (a_1^2+a_2^2+\dots) - (b_1^2+b_2^2+\dots) \\ =& -2a_1b_1-2a_2b_2-\dots \end{array} \]

Dividing by \(-2\) gives the algebraic (coordinate) expression of the dot product:

\[ \boxed{\mathbf{a}\cdot\mathbf{b}=\sum_{i=1}^d a_i b_i=\mathbf{a}^{\mathsf T}\mathbf{b}}. \]

Coordinate Proof via an Orthonormal Basis

As an alternative proof, let \(\{\mathbf{e}_i\}_{i=1}^d\) be orthonormal, \(\mathbf{a}=\sum_i a_i\mathbf{e}_i\), and \(\mathbf{b}=\sum_j b_j\mathbf{e}_j\). Since \(\mathbf{e}_i\cdot\mathbf{e}_j=\delta_{ij}\), only diagonal terms at \(i=j\) remain.

Therefore

\[ \mathbf{a}\cdot\mathbf{b} = \Big(\sum_i a_i\mathbf{e}_i\Big)\cdot\Big(\sum_j b_j\mathbf{e}_j\Big) = \sum_i\sum_j a_i b_j (\mathbf{e}_i\cdot\mathbf{e}_j) = \sum_i a_i b_i, \]

Properties of the Dot Product

Orthogonality and Sign

If both vectors are orthogonal, i.e. \(\theta=90^\circ\), then

\[ \mathbf{a}\cdot\mathbf{b} = \|\mathbf{a}\|\,\|\mathbf{b}\|\cos\frac{\pi}{2} =0. \]

We prefer orthogonal over perpendicular to emphasize the algebraic criterion \(\mathbf{a}\cdot\mathbf{b}=0\), which also remains meaningful if one vector is \(\mathbf{0}\).

The angle controls the dot product continuously:

Norm from the Dot Product

Taking the dot product of a vector with itself gives its squared length:

\[ \mathbf{a}\cdot\mathbf{a}=\|\mathbf{a}\|^2, \]

from which follows that the vector length or norm can be defined as

\[ \|\mathbf{a}\|=\sqrt{\mathbf{a}\cdot\mathbf{a}}. \]

Length of a Sum (Parallelogram Expansion)

Expanding the squared norm of a sum of two vectors gives the the identity

\[ \begin{array}{rl} \|\mathbf{a}+\mathbf{b}\|^2 &= (\mathbf{a}+\mathbf{b})\cdot(\mathbf{a}+\mathbf{b}) \\ &= \mathbf{a}\cdot\mathbf{a}+\mathbf{a}\cdot\mathbf{b}+\mathbf{b}\cdot\mathbf{a}+\mathbf{b}\cdot\mathbf{b} \\ &= \|\mathbf{a}\|^2+2\,\mathbf{a}\cdot\mathbf{b}+\|\mathbf{b}\|^2. \end{array} \]

Algebraic Laws

For all vectors \(\mathbf{a},\mathbf{b},\mathbf{c},\mathbf{d}\in\mathbb{R}^d\) and scalars \(\alpha,\alpha_1,\alpha_2\in\mathbb{R}\), the dot product satisfies the following standard identities. In modern language, the dot product is a symmetric bilinear form.

Commutative Law

The dot product is symmetric:

\[ \mathbf{a}\cdot\mathbf{b}=\mathbf{b}\cdot\mathbf{a}. \]

Proof. \(\mathbf{a}\cdot\mathbf{b}=\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta =\|\mathbf{b}\|\,\|\mathbf{a}\|\cos\theta=\mathbf{b}\cdot\mathbf{a}.\)

Distributive Law

The dot product is distributive over vector addition:

\[ \mathbf{a}\cdot(\mathbf{b}\pm\mathbf{c}) = (\mathbf{a}\cdot\mathbf{b})\pm(\mathbf{a}\cdot\mathbf{c}). \]

Proof. With \(\mathbf{a}\cdot\mathbf{b}=\sum_{i=1}^d a_i b_i\):

\[ \begin{array}{rl} \mathbf{a}\cdot(\mathbf{b}\pm\mathbf{c}) &= \sum_{i=1}^{d} a_i(b_i\pm c_i) \\ &= \sum_{i=1}^{d}(a_i b_i\pm a_i c_i) \\ &= \sum_{i=1}^{d}a_i b_i\;\pm\;\sum_{i=1}^{d}a_i c_i \\ &= \mathbf{a}\cdot\mathbf{b}\;\pm\;\mathbf{a}\cdot\mathbf{c}. \end{array} \]

Orthogonality Criterion and Converse

We already saw: if vectors are orthogonal, then their dot product is \(0\). The converse is also true for nonzero vectors: \[ \mathbf{a}\cdot\mathbf{b}=0 \quad\Longrightarrow\quad \mathbf{a}\perp\mathbf{b}. \]

One way to see this is via the norm expansion: \[ \|\mathbf{a}-\mathbf{b}\|^2 = \|\mathbf{a}\|^2+\|\mathbf{b}\|^2-2\,\mathbf{a}\cdot\mathbf{b}. \] If \(\mathbf{a}\cdot\mathbf{b}=0\), then \[ \|\mathbf{a}-\mathbf{b}\|^2=\|\mathbf{a}\|^2+\|\mathbf{b}\|^2, \] which is exactly the Pythagorean relation for a right triangle with sides \(\|\mathbf{a}\|\), \(\|\mathbf{b}\|\), and \(\|\mathbf{a}-\mathbf{b}\|\).

Equivalently, if \(\|\mathbf{a}\|^2+\|\mathbf{b}\|^2\neq\|\mathbf{a}-\mathbf{b}\|^2\), then the angle is not \(90^\circ\), so the vectors are not orthogonal.

As an example of expansion by distributivity:

\[ (\mathbf{a}+\mathbf{b})\cdot(\mathbf{c}+\mathbf{d}) = \mathbf{a}\cdot\mathbf{c} + \mathbf{a}\cdot\mathbf{d} + \mathbf{b}\cdot\mathbf{c} + \mathbf{b}\cdot\mathbf{d}. \]

Homogeneity (Mixed Associative Law)

Scaling can be moved between both arguments:

\[ \alpha(\mathbf{a}\cdot\mathbf{b}) = (\alpha\mathbf{a})\cdot\mathbf{b} = \mathbf{a}\cdot(\alpha\mathbf{b}). \]

Zero and Definiteness

\[ \mathbf{a}\cdot\mathbf{0}=0, \qquad \mathbf{a}\cdot\mathbf{a}\ge 0, \qquad \mathbf{a}\cdot\mathbf{a}=0\iff\mathbf{a}=\mathbf{0}. \]

Bilinearity

\[ \mathbf{a}\cdot(\alpha\mathbf{b}+\mathbf{c}) = \alpha(\mathbf{a}\cdot\mathbf{b})+\mathbf{a}\cdot\mathbf{c}. \]

Scalar Multiplication

\[ (\alpha_1\mathbf{a})\cdot(\alpha_2\mathbf{b}) = \alpha_1\alpha_2(\mathbf{a}\cdot\mathbf{b}). \]

Cauchy-Schwarz Inequality

\[ |\mathbf{a}\cdot\mathbf{b}| \le \|\mathbf{a}\|\,\|\mathbf{b}\|, \] with equality if and only if \(\mathbf{a}\) and \(\mathbf{b}\) are linearly dependent.

Equivalently, for vectors of fixed length, the dot product \(\mathbf{a}\cdot\mathbf{b}=\|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta\) is largest exactly when \(\theta=0\), that is, when \(\mathbf{b}\) is a nonnegative scalar multiple of \(\mathbf{a}\): the inequality above turns into an equality precisely in this parallel case.

Triangle inequality. \(\|\mathbf{a}+\mathbf{b}\|\le\|\mathbf{a}\|+\|\mathbf{b}\|\) follows from expanding \(\|\mathbf{a}+\mathbf{b}\|^2\) and applying Cauchy-Schwarz.

No Cancellation

If \(\mathbf{a}\cdot\mathbf{b}=\mathbf{a}\cdot\mathbf{c}\) with \(\mathbf{a}\neq\mathbf{0}\), then \(\mathbf{a}\cdot(\mathbf{b}-\mathbf{c})=0\). So \(\mathbf{b}-\mathbf{c}\) is orthogonal to \(\mathbf{a}\), but \(\mathbf{b}\) and \(\mathbf{c}\) need not be equal.

Applications and Worked Examples

Fast Calculation of Cosine

For nonzero vectors, \[ \cos\theta = \frac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{a}\|\,\|\mathbf{b}\|} = \hat{\mathbf{a}}\cdot\hat{\mathbf{b}}. \] With normalized vectors, the dot product directly returns the cosine, so no explicit angle computation is needed.

Making Perpendicular Vectors

Because orthogonality is characterized by \(\mathbf{a}\cdot\mathbf{b}=0\), we can directly construct perpendicular vectors by flipping two components, negating one, and setting all remaining components to \(0\). For \(\mathbf{a}=(a_1,a_2,\ldots,a_n)\), for example, \((-a_2,a_1,0,\ldots,0)\) or \((0,-a_3,a_2,0,\ldots,0)\) are orthogonal to \(\mathbf{a}\), since the nonzero terms cancel in the dot product. In 2D this reduces to the familiar case: if \(\mathbf{a}=(a_1,a_2)\), then \(\mathbf{a}^{\perp}=(-a_2,a_1)\) satisfies \[ \mathbf{a}\cdot\mathbf{a}^{\perp}=a_1(-a_2)+a_2 a_1=0 \] which is the same as with the 2D perpendicular vector.

Vector Projection

The dot product can be used to determine the projection of one vector onto another, like for shadows. Given two vectors \(\mathbf{a}\) and \(\mathbf{b}\), we want to determine the projection of \(\mathbf{a}\) onto \(\mathbf{b}\), which is the vector \(\mathbf{a}'\) of length \(a'\) parallel to \(\mathbf{b}\).

Projection of \(\mathbf{a}\) onto \(\mathbf{b}\).

First compute the scalar projection (signed shadow length):

\[ a' = \|\mathbf{a}\|\cos\theta = \|\mathbf{a}\|\frac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{a}\|\,\|\mathbf{b}\|} = \frac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{b}\|} = \mathbf{a}\cdot\hat{\mathbf{b}} =: \operatorname{comp}_{\mathbf{b}}(\mathbf{a}). \]

This scalar value answers directly how much of \(\mathbf{a}\) lies along direction \(\mathbf{b}\). A positive sign means the same general direction, a negative sign means the opposite direction.

Then turn this scalar into a vector by multiplying with \(\hat{\mathbf{b}}\):

\[ \begin{array}{rl} \mathbf{a}' &= a'\hat{\mathbf{b}} \\ &= (\mathbf{a}\cdot\hat{\mathbf{b}})\hat{\mathbf{b}} \\ &= \dfrac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{b}\|}\cdot\dfrac{\mathbf{b}}{\|\mathbf{b}\|} \\ &= \dfrac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{b}\|^2}\,\mathbf{b} \\ &= \dfrac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{b}\cdot\mathbf{b}}\,\mathbf{b} = \operatorname{proj}_{\mathbf{b}}(\mathbf{a}). \end{array} \]

These are the same identity written in different notations: \[ \mathbf{a}\cdot\mathbf{b} = \|\mathbf{b}\|\,\operatorname{comp}_{\mathbf{b}}(\mathbf{a}) = a'\,\|\mathbf{b}\| = \|\mathbf{a}\|\,\|\mathbf{b}\|\cos\theta. \] So the dot product is projected length times the length of the reference vector.

The ratio of projection length \(a'\) to total length \(\|\mathbf{b}\|\) is the Scalar Projection Percentage:

\[ \frac{a'}{\|\mathbf{b}\|} = \frac{\mathbf{a}\cdot\mathbf{b}}{\|\mathbf{b}\|^2} = \frac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{b}\cdot\mathbf{b}}. \]

Which is interesting. It says that the Vector Projection is just a scaling of vector \(\mathbf{b}\) by this percentage. In other words, \(\operatorname{proj}_{\mathbf{b}}(\mathbf{a})\) keeps the direction of \(\mathbf{b}\) and changes only its length.

Vector Rejection

The rejection of \(\mathbf{a}\) from \(\mathbf{b}\), denoted \(\operatorname{rej}_{\mathbf{b}}(\mathbf{a})\), is the component of \(\mathbf{a}\) that is perpendicular to \(\mathbf{b}\).

Start from the decomposition \[ \mathbf{a}=\operatorname{proj}_{\mathbf{b}}(\mathbf{a})+\operatorname{rej}_{\mathbf{b}}(\mathbf{a}), \] Solving for the unknown perpendicular part gives

\[ \operatorname{rej}_{\mathbf{b}}(\mathbf{a}) = \mathbf{a}-\mathbf{a}' = \mathbf{a}-\frac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{b}\cdot\mathbf{b}}\mathbf{b}. \]

Intuitively: projection keeps only the part of \(\mathbf{a}\) that points along \(\mathbf{b}\); rejection is what remains after removing that aligned part.

In 2D, the rejection length can also be written with the perp direction \(\hat{\mathbf{b}}^{\perp}\): \[ \|\operatorname{rej}_{\mathbf{b}}(\mathbf{a})\| = \big|\hat{\mathbf{b}}^{\perp}\cdot\mathbf{a}\big|. \] Briefly: \(\operatorname{rej}_{\mathbf{b}}(\mathbf{a})\) is parallel to \(\hat{\mathbf{b}}^{\perp}\), so the dot product with that unit direction returns exactly its signed length. This makes the geometry explicit: rejection is exactly the orthogonal distance to the line spanned by \(\mathbf{b}\), which is easiest to visualize with a perpendicular vector.

Vector Reflection

Given the vector projection \(\operatorname{proj}_{\mathbf{b}}(\mathbf{a})\) and the vector rejection \(\operatorname{rej}_{\mathbf{b}}(\mathbf{a})\), we can define the reflection vector \(\mathbf{a}_{\text{reflected}}\), where \(\mathbf{b}\) acts like a mirror and reflects \(\mathbf{a}\) symmetrically with respect to \(\mathbf{b}\).

Reflection built from projection and rejection.

Write \[ \mathbf{a}=\mathbf{a}_{\parallel}+\mathbf{a}_{\perp}, \quad \mathbf{a}_{\parallel}=\operatorname{proj}_{\mathbf{b}}(\mathbf{a}), \quad \mathbf{a}_{\perp}=\operatorname{rej}_{\mathbf{b}}(\mathbf{a}). \] Reflection gives \[ \mathbf{a}_{\text{reflected}} = \mathbf{a}_{\parallel}-\mathbf{a}_{\perp} = \operatorname{proj}_{\mathbf{b}}(\mathbf{a})-\operatorname{rej}_{\mathbf{b}}(\mathbf{a}). \]

Substituting \(\mathbf{a}_{\perp}=\mathbf{a}-\mathbf{a}_{\parallel}\):

\[ \mathbf{a}_{\text{reflected}} = 2\operatorname{proj}_{\mathbf{b}}(\mathbf{a})-\mathbf{a} = 2\frac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{b}\cdot\mathbf{b}}\mathbf{b}-\mathbf{a} = 2(\mathbf{a}\cdot\hat{\mathbf{b}})\hat{\mathbf{b}}-\mathbf{a}. \]

The term \(2(\mathbf{a}\cdot\hat{\mathbf{b}})\hat{\mathbf{b}}\) doubles the projection of \(\mathbf{a}\) onto \(\mathbf{b}\), effectively flipping \(\mathbf{a}\) across \(\mathbf{b}\). It is interesting that reflecting on a vector is exactly the negation of reflecting a vector on a plane across its normal.

Vector Refraction

Refraction bends an incident ray when crossing a media boundary (such as air \(\to\) water). Let \(\hat{\mathbf{a}}\) be an unit incident direction, \(\hat{\mathbf{n}}\) a unit surface normal and \(\eta=\eta_{\text{in}}/\eta_{\text{out}}\) the index ratio.

Refraction with incident direction \(\hat{\mathbf{a}}\), interface normal \(\hat{\mathbf{n}}\), and transmitted direction \(\hat{\mathbf{t}}\).

Intuitively, split the incoming direction into two parts: one part tangent to the interface and one part normal to it. The tangent part is rescaled by Snell's law, and the normal part is then chosen so the outgoing direction is still a unit vector and points into the transmitted medium.

Decompose incident direction into normal/tangential parts:

\[ \hat{\mathbf{a}}_{\parallel}=(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})\hat{\mathbf{n}}, \qquad \hat{\mathbf{a}}_{\perp}=\hat{\mathbf{a}}-\hat{\mathbf{a}}_{\parallel}. \]

Snell's law in scalar form: \[ \eta_{\text{in}}\sin\theta_i=\eta_{\text{out}}\sin\theta_t \quad\Rightarrow\quad \sin\theta_t=\eta\sin\theta_i. \]

Since tangential directions (perpendicular to \(\hat{\mathbf{n}}\)) are preserved across the interface, the transmitted tangential component scales by \(\eta\):

\[ \hat{\mathbf{t}}_{\perp}=\eta\,\hat{\mathbf{a}}_{\perp}. \]

The transmitted vector \(\hat{\mathbf{t}}\) must remain unit length, so its normal component is fixed (up to sign) by

\[ \|\hat{\mathbf{t}}\|^2 =\|\hat{\mathbf{t}}_{\perp}\|^2+\|\hat{\mathbf{t}}_{\parallel}\|^2 =\eta^2\|\hat{\mathbf{a}}_{\perp}\|^2+\|\hat{\mathbf{t}}_{\parallel}\|^2=1, \]

hence

\[ \|\hat{\mathbf{t}}_{\parallel}\|=\sqrt{\,1-\eta^2\|\hat{\mathbf{a}}_{\perp}\|^2\,}. \]

To point into the transmitted medium (across the interface), the normal component must be opposite \(\hat{\mathbf{n}}\), giving

\[ \boxed{\; \hat{\mathbf{t}} = \underbrace{\eta\,\hat{\mathbf{a}}_{\perp}}_{\text{Snell on tangential}} \;-\; \underbrace{\sqrt{\,1-\eta^2\|\hat{\mathbf{a}}_{\perp}\|^2\,}\;\hat{\mathbf{n}}}_{\text{unit-length normal component}} \;} \]

This is the clean “component view” formula. It is valid whenever the square root is real; otherwise there is TIR (total internal reflection) and no refracted ray exists, which happens only when going from higher to lower index and the incidence angle is above the critical angle: \(\sin\theta_c=\frac{n_{\text{out}}}{n_{\text{in}}}\).

Using \(\|\hat{\mathbf{a}}_{\perp}\|^2=1-(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})^2\), this becomes the widely used dot-product form.

Dot-Product Form

With \(\|\hat{\mathbf{a}}_{\perp}\|^2=1-(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})^2\), define

\[ k=1-\eta^2\Big(1-(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})^2\Big). \]

Then

\[ \hat{\mathbf{t}} = \eta\hat{\mathbf{a}}-\big(\eta(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})+\sqrt{k}\big)\hat{\mathbf{n}}, \quad k\ge 0, \] otherwise TIR (total internal reflection).

Relation to Snell's Law

Snell’s law equates the product of refractive index and sine of the angle to the normal across the interface: \[ \eta_{\text{in}}\sin\theta_i=\eta_{\text{out}}\sin\theta_t. \] With \(\cos\theta_i=-\hat{\mathbf{a}}\cdot\hat{\mathbf{n}}\) and \(\sin^2\theta=1-\cos^2\theta\), we obtain

\[ \cos^2\theta_t = 1-\eta^2(1-\cos^2\theta_i) = 1-\eta^2\big(1-(\hat{\mathbf{a}}\cdot\hat{\mathbf{n}})^2\big) =k, \]

exactly the radicand used in the dot-product formula above.

Distance between Line and Point

Distance computed as orthogonal projection gap.

Given line through \(\mathbf{P}_1\), \(\mathbf{P}_2\), and point \(\mathbf{P}\), set \(\mathbf{a}=\mathbf{P}-\mathbf{P}_1\), \(\mathbf{b}=\mathbf{P}_2-\mathbf{P}_1\). The perpendicular distance is the rejection length:

\[ d=\left\|\mathbf{a}-\operatorname{proj}_{\mathbf{b}}(\mathbf{a})\right\|. \]

In 2D, with unit normal \(\hat{\mathbf{b}}^{\perp}\), this is \[ d=\left|\hat{\mathbf{b}}^{\perp}\cdot\mathbf{a}\right|. \]

Scaling a Point Along an Arbitrary Axis

A common geometric operation is to scale a point \(\mathbf{p}\) only along one axis direction \(\hat{\mathbf{n}}\) (with \(\|\hat{\mathbf{n}}\|=1\)), while leaving all orthogonal directions unchanged.

Decompose \(\mathbf{p}\) into parallel and orthogonal components:

\[ \mathbf{p}=\mathbf{p}_{\parallel}+\mathbf{p}_{\perp}, \qquad \mathbf{p}_{\parallel}=(\mathbf{p}\cdot\hat{\mathbf{n}})\hat{\mathbf{n}}, \qquad \mathbf{p}_{\perp}=\mathbf{p}-\mathbf{p}_{\parallel}. \]

If the scaling factor along the axis is \(k\), then

\[ \mathbf{p}'_{\parallel}=k\,\mathbf{p}_{\parallel}, \qquad \mathbf{p}'_{\perp}=\mathbf{p}_{\perp}. \]

Recombine both parts yields the final scaled point \(\mathbf{p}'\):

\[ \mathbf{p}' = \mathbf{p}'_{\parallel}+\mathbf{p}'_{\perp} = k\,\mathbf{p}_{\parallel}+\mathbf{p}_{\perp} = \mathbf{p}+(k-1)(\mathbf{p}\cdot\hat{\mathbf{n}})\hat{\mathbf{n}}. \]

Direction Cosines

In \(\mathbb{R}^3\), if \(\alpha,\beta,\gamma\) are the angles between \(\mathbf{a}\) and the x/y/z axes, then \(\alpha,\beta,\gamma\) are the direction angles of \(\mathbf{a}\). Their cosines are called the direction cosines.

Let \(\mathbf{i},\mathbf{j},\mathbf{k}\) be the standard basis vectors. Using the dot-product angle formula,

\[ \cos\alpha=\frac{\mathbf{a}\cdot\mathbf{i}}{\|\mathbf{a}\|\,\|\mathbf{i}\|} =\frac{a_1}{\|\mathbf{a}\|}, \qquad \cos\beta=\frac{\mathbf{a}\cdot\mathbf{j}}{\|\mathbf{a}\|\,\|\mathbf{j}\|} =\frac{a_2}{\|\mathbf{a}\|}, \qquad \cos\gamma=\frac{\mathbf{a}\cdot\mathbf{k}}{\|\mathbf{a}\|\,\|\mathbf{k}\|} =\frac{a_3}{\|\mathbf{a}\|}. \]

Therefore \[ \cos^2\alpha+\cos^2\beta+\cos^2\gamma=1, \qquad \mathbf{a}=\|\mathbf{a}\|[\cos\alpha,\cos\beta,\cos\gamma]^\mathsf{T}. \]

Linear Combination Example

Let \(\mathbf{q}=(q_1,\dots,q_n)\) be quantities and \(\mathbf{p}=(\$p_1,\dots,\$p_n)\) be unit prices. The total value is the linear combination \(\sum_{i=1}^n q_i\,\$p_i\), which is exactly a dot product.

\[ \mathbf{q}\cdot\mathbf{p} = \sum_{i=1}^n q_i\,\$p_i. \]

So the dot product is the canonical weighted-sum operator.

Concrete example: \( \mathbf{q}=(3,4,5) \) items and \( \mathbf{p}=(\$10,\$60,\$15) \) unit prices yield \[ \mathbf{q}\cdot\mathbf{p}=3\cdot\$10+4\cdot\$60+5\cdot\$15=\$345. \]

Equation of a Line or Plane

Let \(\mathbf{n}\neq\mathbf{0}\) be a fixed normal vector. The dot product \(\mathbf{n}\cdot\mathbf{x}\) measures the signed component of \(\mathbf{x}\) in normal direction.

\[ \mathbf{n}\cdot\mathbf{x}=d. \]

This equation says: collect all points \(\mathbf{x}\) whose projection onto \(\mathbf{n}\) has the same signed value \(d/\|\mathbf{n}\|\). Geometrically, this is the set of points with constant signed distance from the origin along normal direction.

In coordinates with \(\mathbf{n}=(a,b)\), \(\mathbf{x}=(x,y)\), we obtain \(ax+by=d\), i.e. a 2D line. With \(\mathbf{n}=(a,b,c)\), \(\mathbf{x}=(x,y,z)\), we get \(ax+by+cz=d\), i.e. a 3D plane.

Normal and Direction Vectors in 2D

For a 2D line \[ ax+by=c \] the vector \( \mathbf{N}=\begin{bmatrix}a\\b\end{bmatrix} \) is a normal vector. A compatible direction vector is obtained by swapping components and changing one sign, e.g. \[ \mathbf{V}=\begin{bmatrix}b\\-a\end{bmatrix} \quad\text{or}\quad \mathbf{V}=\begin{bmatrix}-b\\a\end{bmatrix}. \]

Indeed, \[ \mathbf{N}\cdot\mathbf{V} = \begin{bmatrix}a\\b\end{bmatrix}\cdot\begin{bmatrix}b\\-a\end{bmatrix} =ab-ab=0, \] so \(\mathbf{N}\perp\mathbf{V}\). For nonzero \(a,b\), this matches the slope criterion \( m_{\mathbf{N}}=b/a, \ m_{\mathbf{V}}=-a/b, \ m_{\mathbf{N}}m_{\mathbf{V}}=-1 \).

The implication \[ \mathbf{u}\perp\mathbf{v}\iff \mathbf{u}\cdot\mathbf{v}=0 \] is the key algebraic orthogonality test. The zero vector also yields a zero dot product with every vector, but it has no direction and is usually excluded in geometric direction statements.

From Parametric to Cartesian Line Form

Start with the parametric form \[ \mathbf{X}=\mathbf{X}_0+t\mathbf{V},\quad t\in\mathbb{R}. \] Dot both sides with a normal vector \(\mathbf{N}\) to \(\mathbf{V}\): \[ \mathbf{N}\cdot\mathbf{X} = \mathbf{N}\cdot(\mathbf{X}_0+t\mathbf{V}) = \mathbf{N}\cdot\mathbf{X}_0+t(\mathbf{N}\cdot\mathbf{V}) = \mathbf{N}\cdot\mathbf{X}_0. \]

With \( c=\mathbf{N}\cdot\mathbf{X}_0 \), this becomes \[ \boxed{\mathbf{N}\cdot\mathbf{X}=c}. \] In components: \[ \begin{bmatrix}a\\b\end{bmatrix}\cdot\begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}a\\b\end{bmatrix}\cdot\begin{bmatrix}x_0\\y_0\end{bmatrix} \iff ax+by=ax_0+by_0. \]

Point Between A and B (Dot-Product Test)

Let \(A,B,C\) be points and define \( \overrightarrow{AB}=B-A, \ \overrightarrow{AC}=C-A \). Compute \[ K_{AC}=\overrightarrow{AB}\cdot\overrightarrow{AC}, \qquad K_{AB}=\overrightarrow{AB}\cdot\overrightarrow{AB}=\|\overrightarrow{AB}\|^2. \]

Then:

So, including endpoints, the interval test is \[ \boxed{0\le \overrightarrow{AB}\cdot\overrightarrow{AC}\le \overrightarrow{AB}\cdot\overrightarrow{AB}}. \] This checks position along the \(A\to B\) direction. To test whether \(C\) is on the segment \(\overline{AB}\), also require collinearity (for example, in 2D: \((B-A)_x(C-A)_y-(B-A)_y(C-A)_x=0\)).

Common Pitfalls

Connections

The scalar product provides the foundation used in cross products and in matrix multiplication, where row-column products are dot products.