Skip to content

Vectors

Before this article, a special note on translation issues is warranted. Due to historical reasons, the translation of the term "vector" differs between mathematics and physics.

In physics, it is generally translated as "矢量" (vector quantity), and is contrasted with "标量" (scalar quantity). In mathematics, it is generally translated as "向量". Similar translation differences exist for terms like "本征" vs. "特征" (eigen-) and "幺正" vs. "酉" (unitary).

In OI Wiki, which primarily targets engineering-related disciplines like computer science and is closer to mathematics, the term "向量" is adopted.

Vector: A quantity that has both magnitude and direction is called a vector. Mathematically, vectors studied are free vectors, meaning that as long as their magnitude and direction remain unchanged, their starting and ending points can be arbitrarily translated in parallel. Denoted as \(\vec a\) or \(\boldsymbol{a}\).

Directed Line Segment: A line segment with a direction is called a directed line segment. A directed line segment has three elements: starting point, direction, length. Knowing these three elements uniquely determines the endpoint. Vectors are generally represented using directed line segments.

Magnitude of a Vector: The length of the directed line segment \(\overrightarrow{AB}\) is called the magnitude of the vector, representing its size. Denoted as: \(|\overrightarrow{AB}|\) or \(|\boldsymbol{a}|\).

Zero Vector: A vector with magnitude \(0\). The direction of the zero vector is arbitrary. Denoted as: \(\vec 0\) or \(\boldsymbol{0}\).

Unit Vector: A vector with magnitude \(1\) is called a unit vector in that direction. Generally denoted as \(\vec e\) or \(\boldsymbol{e}\).

Parallel Vectors: Two non-zero vectors with the same or opposite directions. Denoted as: \(\boldsymbol a\parallel \boldsymbol b\). For multiple mutually parallel vectors, any line parallel to these vectors can be drawn, so any set of parallel vectors can be translated onto the same line. Hence, parallel vectors are also called collinear vectors.

Equal Vectors: Vectors with equal magnitude and the same direction.

Opposite Vectors: Vectors with equal magnitude and opposite directions.

Angle Between Vectors: Given two non-zero vectors \(\boldsymbol a,\boldsymbol b\), draw \(\overrightarrow{OA}=\boldsymbol a,\overrightarrow{OB}=\boldsymbol b\), then \(\theta=\angle AOB\) is the angle between vectors \(\boldsymbol a\) and \(\boldsymbol b\). Denoted as: \(\langle \boldsymbol a,\boldsymbol b\rangle\). Clearly, when \(\theta=0\), the two vectors are in the same direction; when \(\theta=\pi\), they are in opposite directions; when \(\theta=\frac{\pi}{2}\), they are perpendicular, denoted as \(\boldsymbol a\perp \boldsymbol b\). It is also stipulated that \(\theta \in [0,\pi]\).

Note that plane vectors have directionality; two vectors cannot be compared in size (but their magnitudes can be compared). However, two vectors can be equal.

Linear Operations on Vectors

Vector Addition and Subtraction

After defining a quantity, we hope to endow it with operations. Vector operations can be analogized to numerical operations, and can also be studied from a physics perspective.

Analogous to the concept of displacement in physics, if a person walks from \(A\) to \(C\) via \(B\), the displacement undergone is \(\overrightarrow{AB}+\overrightarrow{BC}\), which is equivalent to the person walking directly from \(A\) to \(C\), i.e., \(\overrightarrow{AB}+\overrightarrow{BC}=\overrightarrow{AC}\).

Note the parallelogram rule for force composition, which can also be seen as the addition of vectors.

Summarizing the rules for vector addition:

  1. Triangle Rule for Vector Addition: If the vectors to be summed are connected head-to-tail in order, then their sum is the vector from the starting point of the first vector to the endpoint of the last vector.
  2. Parallelogram Rule for Vector Addition: If the two vectors to be summed share the same starting point, then their sum vector is the diagonal of the parallelogram formed by these two vectors as adjacent sides, starting from the common starting point and directed along the diagonal.

Thus, vector addition acquires geometric meaning. It can also be verified that vector addition satisfies commutativity and associativity.

Since subtraction of real numbers can be written as adding the opposite number, consider writing vector subtraction similarly. That is: \(\boldsymbol a-\boldsymbol b=\boldsymbol a+(-\boldsymbol b)\).

Thus, considering vectors sharing a starting point, applying the parallelogram rule to find their difference, after translation it can be found that "the difference vector of vectors sharing a starting point" is the directed line segment from the "subtrahend vector" to the "minuend vector". This is also the geometric meaning of vector subtraction.

Sometimes, given two points \(A,B\), to find \(\overrightarrow{AB}\), we can use the subtraction operation \(\overrightarrow{AB}=\overrightarrow{OB}-\overrightarrow{OA}\).

Scalar Multiplication of Vectors

It is stipulated that "the product of a real number \(\lambda\) and a vector \(\boldsymbol a\)" is a vector. This operation is called scalar multiplication of vectors, denoted as \(\lambda \boldsymbol a\). Its length and direction are defined as follows:

  1. \(|\lambda \boldsymbol a|=|\lambda||\boldsymbol a|\);
  2. When \(\lambda >0\), \(\lambda\boldsymbol a\) has the same direction as \(\boldsymbol a\); when \(\lambda =0\), \(\lambda \boldsymbol a=\boldsymbol 0\); when \(\lambda<0\), \(\lambda \boldsymbol a\) has the opposite direction to \(\boldsymbol a\).

Based on the definition of scalar multiplication, the following operational laws can be verified:

\[ \begin{aligned} \lambda(\mu \boldsymbol a)&=(\lambda \mu)\boldsymbol a\\ (\lambda+\mu)\boldsymbol a&=\lambda \boldsymbol a+\mu \boldsymbol a\\ \lambda(\boldsymbol a+\boldsymbol b)&=\lambda \boldsymbol a+\lambda \boldsymbol b \end{aligned} \]

In particular:

\[ \begin{gathered} (-\lambda)\boldsymbol a=-(\lambda \boldsymbol a)=-\lambda(\boldsymbol a)\\ \lambda(\boldsymbol a-\boldsymbol b)=\lambda \boldsymbol a-\lambda \boldsymbol b \end{gathered} \]

Determining Collinearity of Two Vectors

Two non-zero vectors \(\boldsymbol a\) and \(\boldsymbol b\) are collinear \(\iff\) there exists a unique real number \(\lambda\) such that \(\boldsymbol b=\lambda \boldsymbol a\).

Proof: From the definition of scalar multiplication, for a non-zero vector \(\boldsymbol a\), if there exists a real number \(\lambda\) such that \(\boldsymbol b=\lambda \boldsymbol a\), then \(\boldsymbol a \parallel \boldsymbol b\).

Conversely, if \(\boldsymbol a\parallel \boldsymbol b\), \(\boldsymbol a \not = \boldsymbol 0\), and \(|\boldsymbol b|=\mu |\boldsymbol a|\), then when \(\boldsymbol a\) and \(\boldsymbol b\) are in the same direction, \(\boldsymbol b=\mu \boldsymbol a\); when opposite, \(\boldsymbol b=-\mu \boldsymbol a\).

Finally, vector addition, subtraction, and scalar multiplication are collectively called linear operations on vectors.

Fundamental Theorem of Plane Vectors and Coordinate Representation

Fundamental Theorem of Plane Vectors

Theorem content: If two vectors \(\boldsymbol{e_1},\boldsymbol{e_2}\) are not collinear, then there exists a unique ordered pair of real numbers \((x,y)\) such that any vector \(\boldsymbol p\) coplanar with \(\boldsymbol{e_1},\boldsymbol{e_2}\) satisfies \(\mathbf p=x\boldsymbol{e_1}+y\boldsymbol{e_2}\).

There are so many plane vectors; how can we represent all plane vectors with as few quantities as possible?

Using only one vector to represent all vectors is obviously impossible; at most, it can only represent vectors on a certain line.

Adding another vector, using two non-collinear vectors to represent (two collinear vectors can be considered the same vector here), any plane vector can be decomposed into the directions of these two vectors.

Two non-collinear vectors in the same plane are called a basis. If the basis vectors are mutually perpendicular, then the decomposition is an orthogonal decomposition of the vector.

Coordinate Representation of Plane Vectors

If we take unit vectors \(i,j\) in the same directions as the horizontal and vertical axes as a set of basis vectors, according to the fundamental theorem of plane vectors, every plane vector corresponds one-to-one with an ordered pair of real numbers \((x,y)\).

And ordered pairs \((x,y)\) correspond one-to-one with points in the plane Cartesian coordinate system. So, drawing \(\overrightarrow{OP}=\boldsymbol p\), the endpoint \(P(x,y)\) is also uniquely determined. Since the objects of study are free vectors, the starting point can be freely translated. Thus, in the plane Cartesian coordinate system, every vector can be uniquely represented by an ordered pair of real numbers.

Coordinate Operations for Plane Vectors

Linear Operations on Plane Vectors

From the linear operations on plane vectors, their coordinate operations can be derived. The main method is to express all coordinates using the basis vectors, then combine them using operational laws, and finally express the result in coordinate form.

If two vectors are \(\boldsymbol a=(m,n)\), \(\boldsymbol b=(p,q)\), then:

\[ \begin{aligned} \boldsymbol a+\boldsymbol b&=(m+p,n+q)\\ \boldsymbol a-\boldsymbol b&=(m-p,n-q)\\ k\boldsymbol a&=(km,kn) \end{aligned} \]

Finding the Coordinate Representation of a Vector

Given two points \(A(a,b),B(c,d)\), it is easy to prove that \(\overrightarrow{AB}=(c-a,d-b)\).

Translating a Point

Sometimes it is necessary to translate a point \(P\) by a certain unit length in a given direction. Combine the direction and distance into a vector, use the triangle rule for vector addition to add this vector to \(\overrightarrow{OP}\), and the endpoint of the resulting vector is the translated point.

Determining Collinearity of Three Points

If points \(A,B,C\) are collinear, then \(\overrightarrow{OB}=\lambda \overrightarrow{OA}+(1-\lambda)\overrightarrow{OC}\).

Extension of Three-Point Collinearity Determination

In triangle \(ABC\), if \(D\) is an \(n\)-division point on \(BC\) (\(n\ BD=k\ DC\)), then: \(\overrightarrow{AD}=\frac{n}{k+n}\overrightarrow{AB}+\frac{k}{k+n}\overrightarrow{AC}\)

Extension to Three-Dimensional Space (Solid Geometry/Space Vectors)

In space, all the content described above holds. Additionally:

Fundamental Theorem of Space Vectors

Theorem content: If three vectors \(\boldsymbol{e_1},\boldsymbol{e_2},\boldsymbol{e_3}\) are not coplanar, then there exists a unique ordered triple of real numbers \((x,y,z)\) such that any space vector \(\boldsymbol p\) satisfies \(\mathbf p=x\boldsymbol{e_1}+y\boldsymbol{e_2}+z\boldsymbol{e_3}\). According to the fundamental theorem of space vectors, we can also use three mutually perpendicular basis vectors \(\boldsymbol{e_1},\boldsymbol{e_2},\boldsymbol{e_3}\) as an orthogonal basis to establish a spatial Cartesian coordinate system and use a triple \((x,y,z)\) as coordinates to represent space vectors.

Fundamental Theorem of Coplanar Vectors

If there exist two non-collinear vectors \(\boldsymbol{x},\boldsymbol{y}\), then vector \(\boldsymbol{p}\) is coplanar with \(\boldsymbol{x},\boldsymbol{y}\) if and only if there exists a unique ordered pair \((a,b)\) such that \(\boldsymbol{p}=a\boldsymbol{x}+b\boldsymbol{y}\).

Direction Vector

The direction of a spatial line is represented by a non-zero vector parallel to that line; this vector is called a direction vector of the line. The position of a line in space is completely determined by a point it passes through and one of its direction vectors.

Note that lines in a plane also have direction vectors.

For lines in space, the direction vector can be found as follows:

  • If there are \(A(x_1,y_1,z_1),B(x_2,y_2,z_2)\), then a direction vector of line \(AB\) is \(\boldsymbol{s}=(x_2-x_1,y_2-y_1,z_2-z_1)\).

  • If a plane perpendicular to the desired line is known, and the plane's general equation is \(ax+by+cz+d=0\), then a direction vector of the line perpendicular to this plane is \(\boldsymbol{s}=(a,b,c)\), which is also a normal vector of the plane.

Normal Vector

For a surface \(ABCD\), its normal vector \(\boldsymbol{n}\) is perpendicular to this surface.

Calculation method: Arbitrarily take two lines within the surface \(\overrightarrow{AB},\overrightarrow{AD}\), such that \(\overrightarrow{AB} \cdot \boldsymbol{n}=\boldsymbol{0}\) and \(\overrightarrow{AD} \cdot \boldsymbol{n}=\boldsymbol{0}\), and use the coordinate method to compute.

Vectors and Matrices

In linear algebra, linear transformations can be represented by matrices. Let \(T\) denote a linear transformation mapping \(\mathbf R^n\) to \(\mathbf R^m\), and \(\mathbf x\) denote an \(n\)-dimensional column vector. Then there exists an \(m\times n\) matrix \(A\) such that

\[ T(\mathbf x)=A\mathbf x. \]

Matrix \(A\) is called the transformation matrix of linear transformation \(T\). In algorithmic problems, linear transformations generally occur within the same dimension, so \(A\) is a square matrix. Thus, problems of linear transformations on vectors can be converted into matrix multiplication problems.

Next, we discuss three types of transformations commonly encountered in competitions and their corresponding transformation matrices: scaling transformation (transformation matrix denoted by \(S\)), rotation transformation (transformation matrix denoted by \(R\)), and translation transformation (transformation matrix denoted by \(T\)).

Scaling Transformation

For an \(n\)-dimensional column vector \(\boldsymbol a\), scale each dimension by factors \(v_1,v_2,\ldots,v_n\). It is easy to see that the transformation matrix \(R\) for scaling is an \(n\times n\) diagonal matrix, i.e., \(S=\operatorname{diag}\{v_1,v_2,\ldots,v_n\}\).

Rotation Transformation

Vector rotation is a relatively complex operation; we limit our discussion to two and three dimensions.

Vector Rotation About a Point

For vector rotation about a point, it generally refers to rotation about the origin. For rotation of a point about another point \(P\), we can use translation to bring point \(P\) to the origin, perform vector rotation, and then translate the coordinate system back. Let the transformation matrix for translation be \(T\), and the transformation matrix for rotation about the origin be \(R\). Then the transformation matrix for the entire process is \(TRT^{-1}\). Based on geometric meaning, \(T^{-1}\) must exist.

For two-dimensional space, let \(\boldsymbol a=(x,y)\), with inclination angle \(\theta\) and length \(l=\sqrt{x^2+y^2}\). Then \(x=l\cos \theta,y=l\sin\theta\). Rotate it counterclockwise about the origin by angle \(\alpha\) to obtain vector \(\boldsymbol b=(l\cos(\theta+\alpha),l\sin(\theta+\alpha))\).

By trigonometric identities,

\[ \boldsymbol{b}=(l(\cos\theta\cos\alpha-\sin\theta\sin\alpha),l(\sin\theta\cos\alpha+\cos\theta\sin\alpha)) \]

Simplifying,

\[ \boldsymbol b=(l\cos\theta\cos\alpha-l\sin\theta\sin\alpha,l\sin\theta\cos\alpha+l\cos\theta\sin\alpha) \]

Substituting back \(x,y\) gives

\[ \boldsymbol b=(x\cos\alpha-y\sin\alpha,y\cos\alpha+x\sin\alpha) \]

Therefore, in two-dimensional space, the transformation matrix \(R\) is

\[ R= \begin{bmatrix} \cos\alpha & -\sin\alpha\\ \sin\alpha & \cos\alpha \end{bmatrix}. \]

For three-dimensional space, vector rotation requires two angular parameters: zenith angle rotation and azimuth angle rotation. This can be done using the spherical coordinate system.

Vector Rotation About a Line

For three-dimensional vectors, rotation about a line is more common. Again for convenience, this line passes through the origin. If the line does not pass through the origin, we can still translate the coordinate system.

Take the direction vector of the line \(\boldsymbol u=(u_x,u_y,u_z)\), and suppose the three-dimensional vector rotates counterclockwise about it by angle \(\theta\). Then the corresponding transformation matrix \(R\) is1

\[ R= \begin{bmatrix} u_x^2 \left(1-\cos \theta\right) + \cos \theta & u_x u_y \left(1-\cos \theta\right) - u_z \sin \theta & u_x u_z \left(1-\cos \theta\right) + u_y \sin \theta \\ u_x u_y \left(1-\cos \theta\right) + u_z \sin \theta & u_y^2\left(1-\cos \theta\right) + \cos \theta & u_y u_z \left(1-\cos \theta\right) - u_x \sin \theta \\ u_x u_z \left(1-\cos \theta\right) - u_y \sin \theta & u_y u_z \left(1-\cos \theta\right) + u_x \sin \theta & u_z^2\left(1-\cos \theta\right) + \cos \theta \end{bmatrix}. \]

Translation Transformation

Translation transformation is not a linear transformation but an affine transformation. However, affine transformations in \(\mathbf R^n\) can still be represented by linear transformations in \(\mathbf R^{n+1}\).

Consider an \(n\)-dimensional vector \(\boldsymbol a=(a_1,a_2, \ldots , a_n)\). Now we want to translate it along vector \(\boldsymbol t=(t_1, t_2, \ldots , t_n)\). We add one dimension to the column vector \(\boldsymbol a\) and set it to \(1\), obtaining a new column vector \(\boldsymbol a'=(a_1, a_2, \ldots , a_n, 1)\). Then the transformation matrix \(T\) can be written as

\[ T= \begin{bmatrix} 1 & & & & t_1 \\ & 1 & & & t_2 \\ & & \ddots & & \vdots \\ & & & 1 & t_n \\ & & & & 1 \\ \end{bmatrix}. \]

For other linear transformation matrices, add a column and a row to the matrix, filling with \(0\) except for the bottom-right element which is \(1\). Through this method, all linear transformation matrices can be converted to affine transformation matrices. For example, for two-dimensional vector rotation, the transformation matrix becomes

\[ R'= \begin{bmatrix} \cos\alpha & -\sin\alpha & 0\\ \sin\alpha & \cos\alpha & 0\\ 0 & 0 & 1 \end{bmatrix}. \]

A More Rigorous Definition of Vectors

In the above, vectors were defined as directed line segments in space. However, strictly speaking, vectors are not just directed line segments. To give a more rigorous definition of vectors, one first needs to define linear spaces. For details, refer to the introduction on the linear spaces page.