Skip to main content
Engineering LibreTexts

4.1: Vector Arithmetic

  • Page ID
    3916
  • In mathematical notation, a real-valued vector \({\bf A}\) is said to have a magnitude \(A=\left|{\bf A}\right|\) and direction \(\hat{\bf a}\) such that \[{\bf A} = A \hat{\bf a}\] where \(\hat{\bf a}\) is a unit vector (i.e., a real-valued vector having magnitude equal to one) having the same direction as \({\bf A}\). If a vector is complex-valued, then \(A\) is similarly complex-valued.

    Cartesian Coordinate System

    Fundamentals of vector arithmetic are most easily grasped using the Cartesian coordinate system. This system is shown in Figure \(\PageIndex{1}\). Note carefully the relative orientation of the \(x\), \(y\), and \(z\) axes. This orientation is important. For example, there are two directions that are perpendicular to the \(z=0\) plane (in which the \(x\)- and \(y\)-axes lie), but the \(+z\) axis is specified to be one of these in particular.

    4.1.png

    Figure \(\PageIndex{1}\): Cartesian coordinate system. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Position-Fixed vs. Position-Free Vectors

    It is often convenient to describe a position in space as a vector for which the magnitude is the distance from the origin of the coordinate system and for which the direction is measured from the origin toward the position of interest. This is shown in Figure \(\PageIndex{2}\). These position vectors are “position-fixed” in the sense that they are defined with respect to a single point in space, which in this case is the origin. Position vectors can also be defined as vectors that are defined with respect to some other point in space, in which case they are considered position-fixed to that position.

    4.2 (1).png

    Figure \(\PageIndex{2}\): Position vectors. The vectors \(\mathbf { r } _ { 1 }\) and \(\mathbf { r } _ { 2}\) are position-fixed and refer to particular locations.Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Position-free vectors, on the other hand, are not defined with respect to a particular point in space. An example is shown in Figure \(\PageIndex{2}\). Particles 1 m apart may both be traveling at 2 m/s in the same direction. In this case, the velocity of each particle can be described using the same vector, even though the particles are located at different points in space.

    4.3.png

    Figure \(\PageIndex{3}\): Two particles exhibiting the same velocity. In this case, the velocity vectors \(\mathbf { r } _ { 1 }\) and \(\mathbf { r } _ { 2}\) are position-free and equal. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Position-free vectors are said to be equal if they have the same magnitudes and directions. Position-fixed vectors, on the other hand, must also be referenced to the same position (e.g., the origin) to be considered equal.

    Basis Vectors

    Each coordinate system is defined in terms of three basis vectors which concisely describe all possible ways to traverse three-dimensional space. A basis vector is a position-free unit vector that is perpendicular to all other basis vectors for that coordinate system. The basis vectors \(\hat{\bf x}\), \(\hat{\bf y}\), and \(\hat{\bf z}\) of the Cartesian coordinate system are shown in Figure \(\PageIndex{4}\). In this notation, \(\hat{\bf x}\) indicates the direction in which \(x\) increases most rapidly, \(\hat{\bf y}\) indicates the direction in which \(y\) increases most rapidly, and \(\hat{\bf z}\) indicates the direction in which \(z\) increases most rapidly. Alternatively, you might interpret \(\hat{\bf x}\), \(\hat{\bf y}\), and \(\hat{\bf z}\) as unit vectors that are parallel to the \(x\)-, \(y\)-, and \(z\)-axes and point in the direction in which values along each axis increase.

    4.4.png

    Figure \(\PageIndex{4}\): Basis vectors in the Cartesian coordinate system. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Vectors in the Cartesian Coordinate System

    In Cartesian coordinates, we may describe any vector \({\bf A}\) as follows:

    \[{\bf A} = \hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\]

    where \(A_x\), \(A_y\), and \(A_z\) are scalar quantities describing the components of \({\bf A}\) in each of the associated directions, as shown in Figure \(\PageIndex{5}\). This description makes it clear that the magnitude of \({\bf A}\) is:

    \[\left|{\bf A}\right| = \sqrt{ A_x^2 + A_y^2 + A_z^2 }\] and therefore, we can calculate the associated unit vector as

    \[\begin{split} \hat{\bf a} &= \frac{\bf A}{\left|{\bf A}\right|} = \frac{\bf A}{\sqrt{ A_x^2 + A_y^2 + A_z^2 }} \\[4pt] &= ~~~\hat{\bf x}A_x \left( A_x^2 + A_y^2 + A_z^2 \right)^{-1/2} \\[4pt] &~ ~~+\hat{\bf y}A_y \left( A_x^2 + A_y^2 + A_z^2 \right)^{-1/2} \\[4pt] &~ ~~+\hat{\bf z}A_z \left( A_x^2 + A_y^2 + A_z^2 \right)^{-1/2} \end{split}\]

    4.5.png

    Figure \(\PageIndex{5}\): Components of a vector A in the Cartesian coordinate system. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Vector Addition and Subtraction

    It is common to add and subtract vectors. For example, vectors describing two forces \({\bf A}\) and \({\bf B}\) applied to the same point can be described as a single force vector \({\bf C}\) that is the sum of \({\bf A}\) and \({\bf B}\); i.e., \({\bf C}={\bf A}+{\bf B}\). This addition is quite simple in the Cartesian coordinate system:

    \[\begin{split} {\bf C} &= {\bf A}+{\bf B} \\[4pt] &= \left(\hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\right) + \left( \hat{\bf x}B_x + \hat{\bf y}B_y + \hat{\bf z}B_z \right) \\[4pt] &= \hat{\bf x}\left(A_x+B_x\right) + \hat{\bf y}\left(A_y+B_y\right) + \hat{\bf z}\left(A_z+B_z\right) \end{split}\]

    In other words, the \(\hat{\bf x}\) component of \({\bf C}\) is the sum of the \(\hat{\bf x}\) components of \({\bf A}\) and \({\bf B}\), and similarly for \(\hat{\bf y}\) and \(\hat{\bf z}\). From the above example, it is clear that vector addition is commutative; i.e.,

    \[{\bf A}+{\bf B} = {\bf B}+{\bf A}\]

    In other words, vectors may be added in any order. Vector subtraction is defined similarly:

    \[\begin{split} {\bf D} &= {\bf A}-{\bf B} \\[4pt] &= \left(\hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\right) - \left( \hat{\bf x}B_x + \hat{\bf y}B_y + \hat{\bf z}B_z \right) \\[4pt] &= \hat{\bf x}\left(A_x-B_x\right) + \hat{\bf y}\left(A_y-B_y\right) + \hat{\bf z}\left(A_z-B_z\right) \end{split}\]

    In other words, the \(\hat{\bf x}\) component of \({\bf D}\) is the difference of the \(\hat{\bf x}\) components of \({\bf A}\) and \({\bf B}\), and similarly for \(\hat{\bf y}\) and \(\hat{\bf z}\). Like scalar subtraction, vector subtraction is not commutative.

    Relative Positions and Distances

    A common task in vector analysis is to describe the position of one point in space relative to a different point in space. Let us identify those two points using the position vectors \({\bf r}_1\) and \({\bf r}_2\), as indicated in Figure \(\PageIndex{6}\). We may identify a third vector \({\bf r}_{12}\) as the position of \({\bf r}_{2}\) relative to \({\bf r}_{1}\): \[{\bf r}_{12} \triangleq {\bf r}_{2} - {\bf r}_{1}\] Now \(\left|{\bf r}_{12}\right|\) is the distance between these points, and \({\bf r}_{12}/\left|{\bf r}_{12}\right|\) is a unit vector indicating the direction to \({\bf r}_{2}\) from \({\bf r}_{1}\).

    4.6.png

    Figure \(\PageIndex{6}\): Relative position (distance and direction) between locations identified by their position vector. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Example \(\PageIndex{1}\): Direction and distance between positions.

    Consider two positions, identified using the position vectors \({\bf r}_1 = 2\hat{\bf x} +3\hat{\bf y} +1\hat{\bf z}\) and \({\bf r}_2 = 1\hat{\bf x} -2\hat{\bf y} +3\hat{\bf z}\), both expressed in units of meters. Find the direction vector that points from \({\bf r}_1\) to \({\bf r}_2\), the distance between these points, and the associated unit vector.

    Solution

    The vector that points from \({\bf r}_1\) to \({\bf r}_2\) is

    \[ \begin{aligned} \mathbf { R } & = \mathbf { r } _ { 2 } - \mathbf { r } _ { 1 } \\[4pt] & = ( 1 - 2 ) \hat { \mathbf { x } } + ( - 2 - 3 ) \hat { \mathbf { y } } + ( 3 - 1 ) \hat { \mathbf { z } } \\[4pt] & = - \hat { \mathbf { x } } - 5 \hat { \mathbf { y } } + 2 \hat { \mathbf { z } } \end{aligned} \]

    The distance between \({\bf r}_1\) and \({\bf r}_2\) is simply the magnitude of this vector:

    \[\left|{\bf R}\right| = \sqrt{ \left(-1\right)^2 + \left(-5\right)^2 + \left(2\right)^2 } \cong 5.48~\mbox{m}\]

    The unit vector \(\hat{\bf R}\) is simply \({\bf R}\) normalized to have unit magnitude:

    \[\begin{aligned} \hat { \mathbf { R } } & = \mathbf { R } / | \mathbf { R } | \\[4pt] & \cong ( - \hat { \mathbf { x } } - 5 \hat { \mathbf { y } } + 2 \hat { \mathbf { z } } ) / 5.48 \\[4pt] & \cong - 0.182 \hat { \mathbf { x } } - 0.913 \hat { \mathbf { y } } + 0.365 \hat { \mathbf { z } } \end{aligned}\]

    Multiplication of a Vector by a Scalar

    Let’s say a particular force is specified by a vector \({\bf F}\). What is the new vector if this force is doubled? The answer is simply \(2{\bf F}\) – that is, twice the magnitude applied in the same direction. This is an example of scalar multiplication of a vector. Generalizing, the product of the scalar \(\alpha\) and the vector \({\bf A}\) is simply \(\alpha{\bf A}\).

    4.7.png

    Figure \(\PageIndex{7}\): Special cases of the dot product. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    Another common task in vector analysis is to determine the similarity in the direction in which two vectors point. In particular, it is useful to have a metric which, when applied to the vectors \({\bf A}=\hat{\bf a}A\) and \({\bf B}=\hat{\bf b}B\), has the following properties (Figure \(\PageIndex{7}\)):

    • If \({\bf A}\) is perpendicular to \({\bf B}\), the result is zero.
    • If \({\bf A}\) and \({\bf B}\) point in the same direction, the result is \(AB\).
    • If \({\bf A}\) and \({\bf B}\) point in opposite directions, the result is \(-AB\).
    • Results intermediate to these conditions depend on the angle \(\psi\) between \({\bf A}\) and \({\bf B}\), measured as if \({\bf A}\) and \({\bf B}\) were arranged “tail-to-tail” as shown in Figure \(\PageIndex{8}\).

    4.8.png

    Figure \(\PageIndex{8}\): Calculation of the dot product. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    In vector analysis, this operator is known as the scalar product (not to be confused with scalar multiplication) or the dot product. The dot product is written \({\bf A}\cdot{\bf B}\) and is given in general by the expression:

    \[{\bf A}\cdot{\bf B} = AB\cos\psi \label{m0006_eDPdef}\]

    Note that this expression yields the special cases previously identified, which are \(\psi=\pi/2\), \(\psi=0\), and \(\psi=\pi\), respectively. The dot product is commutative; i.e., \[{\bf A}\cdot{\bf B} = {\bf B}\cdot{\bf A}\] The dot product is also distributive; i.e.,

    \[{\bf A}\cdot\left({\bf B}+{\bf C}\right) = {\bf A}\cdot{\bf B}+{\bf A}\cdot{\bf C}\]

    The dot product has some other useful properties. For example, note:

    \[\begin{split} {\bf A}\cdot{\bf A} &= \left(\hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\right) \cdot \left(\hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\right) \\[4pt] &= ~~\hat{\bf x}\cdot\hat{\bf x} A_x^2 + \hat{\bf x}\cdot\hat{\bf y} A_x A_y + \hat{\bf x}\cdot\hat{\bf z} A_x A_z \\[4pt] &~~ +\hat{\bf y}\cdot\hat{\bf x} A_x A_y + \hat{\bf y}\cdot\hat{\bf y} A_y^2 + \hat{\bf y}\cdot\hat{\bf z} A_y A_z \\[4pt] &~~ +\hat{\bf z}\cdot\hat{\bf x} A_x A_z + \hat{\bf z}\cdot\hat{\bf y} A_y A_z + \hat{\bf z}\cdot\hat{\bf z} A_z^2 \end{split}\]

    which looks pretty bad until you realize that

    \[\hat{\bf x}\cdot\hat{\bf x} = \hat{\bf y}\cdot\hat{\bf y} = \hat{\bf z}\cdot\hat{\bf z} = 1\] and any other dot product of basis vectors is zero. Thus, the whole mess simplifies to:

    \[{\bf A}\cdot{\bf A} = A_x^2 + A_y^2 + A_z^2\]

    This is the square of the magnitude of \({\bf A}\), so we have discovered that

    \[{\bf A}\cdot{\bf A} = \left|{\bf A}\right|^2 = A^2\] Applying the same principles to the dot product of potentially different vectors \({\bf A}\) and \({\bf B}\), we find:

    \[\begin{align} {\bf A}\cdot{\bf B} &= \left(\hat{\bf x}A_x + \hat{\bf y}A_y + \hat{\bf z}A_z\right) \cdot \left(\hat{\bf x}B_x + \hat{\bf y}B_y + \hat{\bf z}B_z\right) \\[4pt] &= A_x B_x + A_y B_y + A_z B_z \label{m0006_eDPC} \end{align} \]

    This is a particularly easy way to calculate the dot product, since it eliminates the problem of determining the angle \(\psi\). In fact, an easy way to calculate \(\psi\) given \({\bf A}\) and \({\bf B}\) is to first calculate the dot product using Equation \ref{m0006_eDPC} and then use the result to solve Equation \ref{m0006_eDPdef} for \(\psi\).

    Example \(\PageIndex{2}\): Angle between two vectors

    Consider the position vectors \({\bf C} = 2\hat{\bf x} +3\hat{\bf y} +1\hat{\bf z}\) and \({\bf D} = 3\hat{\bf x} -2\hat{\bf y} +2\hat{\bf z}\), both expressed in units of meters. Find the angle between these vectors.

    Solution

    From Equation \ref{m0006_eDPdef}

    \[{\bf C}\cdot{\bf D} = CD\cos\psi\]

    where \(C = \left|{\bf C}\right|\), \(D = \left|{\bf D}\right|\), and \(\psi\) is the angle we seek. From Equation \ref{m0006_eDPC}:

    \[\begin{aligned} \mathbf { C } \cdot \mathbf { D } & = C _ { x } D _ { x } + C _ { y } D _ { y } + C _ { z } D _ { z } \\[4pt] & = 2 \cdot 3 + 3 \cdot ( - 2 ) + 1 \cdot 2 \mathrm { m } ^ { 2 } \\[4pt] & = 2 \mathrm { m } ^ { 2 } \end{aligned}\]

    also

    \[\begin{aligned} C & = \sqrt { C _ { x } ^ { 2 } + C _ { y } ^ { 2 } + C _ { z } ^ { 2 } } \cong 3.742 \mathrm { m } \\[4pt] D & = \sqrt { D _ { x } ^ { 2 } + D _ { y } ^ { 2 } + D _ { z } ^ { 2 } } \cong 4.123 \mathrm { m } \end{aligned}\]

    so

    \[\cos\psi = \frac{\bf C \cdot \bf D}{CD} \cong 0.130\]

    Taking the inverse cosine, we find \(\psi=82.6^{\circ}\).

    The cross product is a form of vector multiplication that results in a vector that is perpendicular to both of the operands. The definition is as follows:

    \[{\bf A}\times{\bf B} = \hat{\bf n}AB\sin\psi_{AB} \label{m0006_eCrossProduct}\]

    As shown in Figure \(\PageIndex{9}\), the unit vector \(\hat{\bf n}\) is determined by the “right hand rule.” Using your right hand, curl your fingers to traverse the angle \(\psi_{AB}\) beginning at \({\bf A}\) and ending at \({\bf B}\), and then \(\hat{\bf n}\) points in the direction of your fully-extended thumb.

    4.9.png

    Figure \(\PageIndex{9}\): The cross product \(\mathbf { A } \times \mathbf { B }\). Image used with permission (CC BY SA 4.0; K. Kikkeri).

    It should be apparent that the cross product is not commutative but rather is anticommutative; that is, \[{\bf A}\times{\bf B} = -{\bf B}\times{\bf A}\] You can confirm this for yourself using either Equation \ref{m0006_eCrossProduct} or by applying the right-hand rule.

    The cross product is distributive: \[{\bf A}\times\left({\bf B} + {\bf C}\right) = {\bf A}\times{\bf B} + {\bf A}\times{\bf C}\]

    There are two useful special cases of the cross product that are worth memorizing. The first is the cross product of a vector with itself, which is zero: \[{\bf A}\times{\bf A} = 0\] The second is the cross product of vectors that are perpendicular; i.e., for which \(\psi_{AB}=\pi/2\). In this case:

    \[{\bf A}\times{\bf B} = \hat{\bf n}AB\] Using these principles, note: \[\hat{\bf x} \times \hat{\bf x} = \hat{\bf y} \times \hat{\bf y} = \hat{\bf z} \times \hat{\bf z} = 0\]

    whereas

    \[\hat{\bf x} \times \hat{\bf y} = \hat{\bf z}\]

    \[\hat{\bf y} \times \hat{\bf z} = \hat{\bf x}\]

    \[\hat{\bf z} \times \hat{\bf x} = \hat{\bf y}\]

    A useful diagram that summarizes these relationships is shown in Figure \(\PageIndex{10}\).

    4.10.png

    Figure \(\PageIndex{10}\): Cross products among basis vectors in the Cartesian system. The cross product of any two basis vectors is the third basis vector when the order of operands is counter-clockwise, as shown in the diagram, and is −1 times the third basis vector when the order of operands is clockwise with respect to the arrangement in the diagram. Image used with permission (CC BY SA 4.0; K. Kikkeri).

    It is typically awkward to “manually” determine \(\hat{\bf n}\) in Equation \ref{m0006_eCrossProduct}. However, in Cartesian coordinates the cross product may be calculated as:

    \[\begin{split} {\bf A}\times{\bf B} =& ~~~~\hat{\bf x}\left(A_y B_z - A_z B_y \right) \\[4pt] & +\hat{\bf y}\left(A_z B_x - A_x B_z \right) \\[4pt] & +\hat{\bf z}\left(A_x B_y - A_y B_x \right) \end{split}\]

    This may be easier to remember as a matrix determinant:

    \[{\bf A}\times{\bf B} = \begin{vmatrix} \hat{\bf x} & \hat{\bf y} & \hat{\bf z} \\[4pt] A_x & A_y & A_z \\[4pt] B_x & B_y & B_z \end{vmatrix}\]

    Similar expressions are available for other coordinate systems.

    Vector analysis routinely requires expressions involving both dot products and cross products in different combinations. Often, these expressions may be simplified, or otherwise made more convenient, using the vector identities listed in Appendix B3.

    Contributors