Vectors

Before proceeding, a note about translation is necessary. For historical reasons, the Chinese terms for “vector” differ between mathematics and physics.

In physics, the term is generally translated as “vector” and contrasted with “scalar”; in mathematics, it is generally translated as “vector”. Similar differences in translation include “eigen” versus “characteristic” and “unitary” versus “unitary-matrix”, among others.

OI Wiki is mainly oriented toward engineering-related disciplines such as computer science and is closer to mathematics, so it adopts the term “vector”.

Vector: A quantity with both magnitude and direction is called a vector. The vectors studied in mathematics are free vectors: their starting and ending points may be translated arbitrarily as long as their magnitude and direction are unchanged. They are denoted by a⃗\vec a or a\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, and length. Once these three elements are known, its endpoint is uniquely determined. Directed line segments are commonly used to represent vectors.

Magnitude of a vector: The length of the directed line segment AB→\overrightarrow{AB} is called the magnitude of the vector, that is, the size of the vector. It is denoted by: ∣AB→∣|\overrightarrow{AB}| or ∣a∣|\boldsymbol{a}|.

Zero vector: A vector with magnitude 00. The direction of the zero vector is arbitrary. It is denoted by: 0⃗\vec 0 or 0\boldsymbol{0}.

Unit vector: A vector with magnitude 11 is called the unit vector in that direction. It is generally denoted by e⃗\vec e or e\boldsymbol{e}.

Parallel vectors: Two nonzero vectors with the same or opposite directions. They are denoted by: a∥b\boldsymbol a\parallel \boldsymbol b. Given several mutually parallel vectors, one can choose any line parallel to them; every such collection of parallel vectors can then be translated onto the same line. Thus, parallel vectors are also called collinear vectors.

Equal vectors: Vectors with equal magnitudes and the same direction.

Opposite vectors: Vectors with equal magnitudes and opposite directions.

Angle between vectors: Given two nonzero vectors a,b\boldsymbol a,\boldsymbol b, construct OA→=a,OB→=b\overrightarrow{OA}=\boldsymbol a,\overrightarrow{OB}=\boldsymbol b. Then θ=∠AOB\theta=\angle AOB is the angle between vectors a\boldsymbol a and b\boldsymbol b. It is denoted by: ⟨a,b⟩\langle \boldsymbol a,\boldsymbol b\rangle. Clearly, when θ=0\theta=0, the two vectors have the same direction; when θ=π\theta=\pi, they have opposite directions; and when θ=π2\theta=\frac{\pi}{2}, they are perpendicular, denoted by a⊥b\boldsymbol a\perp \boldsymbol b. We stipulate that θ∈[0,π]\theta \in [0,\pi].

Planar vectors have direction, so two vectors cannot be compared by size (although their magnitudes can be compared). However, two vectors can be equal.

Linear operations on vectors

Addition and subtraction of vectors

After defining a kind of quantity, one naturally wants to give it operations. Vector operations can be studied by analogy with numerical operations, and they can also be studied from the perspective of physics.

By analogy with displacement in physics, suppose that a person walks from AA through BB to CC. The displacement they undergo is AB→+BC→\overrightarrow{AB}+\overrightarrow{BC}, which is equivalent to the person walking directly from AA to CC, namely AB→+BC→=AC→\overrightarrow{AB}+\overrightarrow{BC}=\overrightarrow{AC}.

The parallelogram law for composing forces can likewise be viewed as adding vectors.

Let us summarize the laws of vector addition:

  1. Triangle law of vector addition: If the vectors being added are joined head to tail in order, their sum points from the starting point of the first vector to the endpoint of the last vector;
  2. Parallelogram law of vector addition: If the two vectors being added have a common starting point, their sum is the diagonal of the parallelogram whose adjacent sides are those two vectors. Its starting point is their common starting point, and its direction follows the diagonal of the parallelogram.

Thus, vector addition has a geometric meaning. It can also be verified that vector addition satisfies the commutative and associative laws.

Since subtraction of real numbers can be written as addition of the opposite number, we use the same form for vector subtraction. Namely: a−b=a+(−b)\boldsymbol a-\boldsymbol b=\boldsymbol a+(-\boldsymbol b).

Now consider vectors with a common starting point and construct their difference according to the parallelogram law. After translating them, one finds that the difference vector of vectors with a common starting point is the directed line segment from the subtrahend to the minuend. This is also the geometric meaning of vector subtraction.

Sometimes, given two points A,BA,B, we want to find AB→\overrightarrow{AB}. This can be obtained using subtraction: AB→=OB→−OA→\overrightarrow{AB}=\overrightarrow{OB}-\overrightarrow{OA}.

Scalar multiplication of vectors

Define the product of a real number λ\lambda and a vector a\boldsymbol a to be a vector. This operation is called scalar multiplication of vectors, denoted by λa\lambda \boldsymbol a, and its length and direction are specified as follows:

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

From the definition of scalar multiplication, the following laws can be verified:

λ(μa)=(λμ)a(λ+μ)a=λa+μaλ(a+b)=λa+λb\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:

(−λ)a=−(λa)=−λ(a)λ(a−b)=λa−λb\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 whether two vectors are collinear

Two nonzero vectors a\boldsymbol a and b\boldsymbol b are collinear   ⟺  \iff there is a unique real number λ\lambda such that b=λa\boldsymbol b=\lambda \boldsymbol a.

Proof: By the definition of scalar multiplication, for a nonzero vector a\boldsymbol a, if there exists a real number λ\lambda such that b=λa\boldsymbol b=\lambda \boldsymbol a, then a∥b\boldsymbol a \parallel \boldsymbol b.

Conversely, if a∥b\boldsymbol a\parallel \boldsymbol b, a≠0\boldsymbol a \not = \boldsymbol 0, and ∣b∣=μ∣a∣|\boldsymbol b|=\mu |\boldsymbol a|, then a\boldsymbol a when b\boldsymbol b and b=μa\boldsymbol b=\mu \boldsymbol a have the same direction, and b=−μa\boldsymbol b=-\mu \boldsymbol a when they have opposite directions.

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

Fundamental theorem and coordinate representation of planar vectors

Fundamental theorem of planar vectors

The theorem states: If two vectors e1,e2\boldsymbol{e_1},\boldsymbol{e_2} are not collinear, then there is a unique pair of real numbers (x,y)(x,y) such that every vector e1,e2\boldsymbol{e_1},\boldsymbol{e_2} coplanar with p\boldsymbol p satisfies p=xe1+ye2\mathbf p=x\boldsymbol{e_1}+y\boldsymbol{e_2}.

There are so many planar vectors; how can all planar vectors be represented using as few quantities as possible?

It is clearly impossible to represent every vector using only one vector; at most, vectors on a particular line can be represented.

Add another vector and use two non-collinear vectors (the two collinear vectors can be regarded as one vector here). Then any planar 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 perpendicular to each other, the decomposition is an orthogonal decomposition of the vector.

Coordinate representation of planar vectors

If unit vectors i,ji,j in the directions of the horizontal and vertical axes are chosen as a basis, then by the fundamental theorem of planar vectors, every vector in the plane corresponds bijectively to an ordered pair of real numbers (x,y)(x,y).

An ordered pair of real numbers (x,y)(x,y) also corresponds bijectively to a point in the plane's Cartesian coordinate system. Thus, if OP→=p\overrightarrow{OP}=\boldsymbol p, the endpoint P(x,y)P(x,y) is uniquely determined. Since the objects under study are free vectors, their starting points may be translated freely; consequently, every vector in the Cartesian plane has a unique representation by an ordered pair of real numbers.

Coordinate operations on planar vectors

Linear operations on planar vectors

The coordinate operations of planar vectors can be derived from their linear operations. The main method is to express all coordinates in terms of the basis vectors, combine them using the operation laws, and then express the result in coordinates.

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

a+b=(m+p,n+q)a−b=(m−p,n−q)ka=(km,kn)\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)A(a,b),B(c,d), it is easy to prove that AB→=(c−a,d−b)\overrightarrow{AB}=(c-a,d-b).

Translating a point

Sometimes a point PP needs to be translated in a given direction by a certain distance. Combine the direction and distance to form a vector, then use the triangle law of vector addition to add this vector to OP→\overrightarrow{OP}. The endpoint of the resulting vector is the translated point.

Determining whether three points are collinear

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

Extension of the collinearity criterion for three points

In triangle ABCABC, if DD is the BCBC-division point of nn (n BD=k DCn\ BD=k\ DC), then: AD→=nk+nAB→+kk+nAC→\overrightarrow{AD}=\frac{n}{k+n}\overrightarrow{AB}+\frac{k}{k+n}\overrightarrow{AC}

Extension to three-dimensional space (solid geometry/spatial vectors)

Everything described above also holds in space. In addition:

Fundamental theorem of spatial vectors

The theorem states: If three vectors e1,e2,e3\boldsymbol{e_1},\boldsymbol{e_2},\boldsymbol{e_3} are not coplanar, then there is a unique pair of real numbers (x,y,z)(x,y,z) such that every vector p\boldsymbol p in space satisfies p=xe1+ye2+ze3\mathbf p=x\boldsymbol{e_1}+y\boldsymbol{e_2}+z\boldsymbol{e_3}. According to the fundamental theorem of spatial vectors, three mutually perpendicular basis vectors e1,e2,e3\boldsymbol{e_1},\boldsymbol{e_2},\boldsymbol{e_3} can likewise be used as an orthogonal basis to establish a spatial Cartesian coordinate system, with a triple (x,y,z)(x,y,z) representing a spatial vector as its coordinates.

Fundamental theorem of coplanar vectors

If there are two non-collinear vectors x,y\boldsymbol{x},\boldsymbol{y}, then a necessary and sufficient condition for a vector p\boldsymbol{p} to be coplanar with x,y\boldsymbol{x},\boldsymbol{y} is that there exist a unique pair of real numbers (a,b)(a,b) such that p=ax+by\boldsymbol{p}=a\boldsymbol{x}+b\boldsymbol{y}.

Direction vectors

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

Note that lines in a plane also have direction vectors.

For a line in space, its direction vector can be found as follows:

  • If A(x1,y1,z1),B(x2,y2,z2)A(x_1,y_1,z_1),B(x_2,y_2,z_2) are given, then a direction vector of the line containing ABAB is s=(x2−x1,y2−y1,z2−z1)\boldsymbol{s}=(x_2-x_1,y_2-y_1,z_2-z_1).

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

Normal vectors

For a face ABCDABCD, its normal vector n\boldsymbol{n} is perpendicular to the face.

To compute it, choose any two lines in the face, AB→,AD→\overrightarrow{AB},\overrightarrow{AD}, so that AB→⋅n=0\overrightarrow{AB} \cdot \boldsymbol{n}=\boldsymbol{0} and AD→⋅n=0\overrightarrow{AD} \cdot \boldsymbol{n}=\boldsymbol{0}, and calculate using coordinates.

Vectors and matrices

In linear algebra, linear transformations can be represented by matrices. Let TT be a linear transformation mapping Rn\mathbf R^n to Rm\mathbf R^m, and let x\mathbf x be an nn-dimensional column vector. Then there exists an m×nm\times n matrix AA such that

T(x)=Ax.T(\mathbf x)=A\mathbf x.

The matrix AA is called the transformation matrix of the linear transformation TT. In algorithmic problems, linear transformations generally act within the same dimension, so AA is a square matrix. Thus, a vector linear-transformation problem can be converted into a matrix multiplication problem.

Next we discuss three transformations that are relatively common in contests and their corresponding transformation matrices: scaling (whose transformation matrix is denoted by SS), rotation (denoted by RR), and translation (denoted by TT).

Scaling transformation

For an nn-dimensional column vector a\boldsymbol a, scale each dimension by v1,v2,…,vnv_1,v_2,\ldots,v_n. It is easy to see that the transformation matrix RR for scaling is an n×nn\times n diagonal matrix, namely S=diag⁡{v1,v2,…,vn}S=\operatorname{diag}\{v_1,v_2,\ldots,v_n\}.

Rotation transformation

Rotation of a vector is a relatively complicated operation, so we restrict the discussion to two and three dimensions.

Rotation of a vector about a point

Rotation of a vector about a point generally means rotation about the origin. To rotate about another point PP, translate the point PP to the origin, perform the vector rotation, and then translate the coordinate system back to its original position. Let the transformation matrix for translation be TT and that for rotation about the origin be RR. The transformation matrix for the whole process is TRT−1TRT^{-1}. By its geometric meaning, T−1T^{-1} necessarily exists.

In two-dimensional space, let a=(x,y)\boldsymbol a=(x,y) have inclination θ\theta and length l=x2+y2l=\sqrt{x^2+y^2}. Then x=lcos⁡θ,y=lsin⁡θx=l\cos \theta,y=l\sin\theta. Rotate it counterclockwise about the origin through an angle α\alpha to obtain b=(lcos⁡(θ+α),lsin⁡(θ+α))\boldsymbol b=(l\cos(\theta+\alpha),l\sin(\theta+\alpha)).

Figure: vector rotation

Using the trigonometric identity,

b=(l(cos⁡θcos⁡α−sin⁡θsin⁡α),l(sin⁡θcos⁡α+cos⁡θsin⁡α))\boldsymbol{b}=(l(\cos\theta\cos\alpha-\sin\theta\sin\alpha),l(\sin\theta\cos\alpha+\cos\theta\sin\alpha))

Simplifying,

b=(lcos⁡θcos⁡α−lsin⁡θsin⁡α,lsin⁡θcos⁡α+lcos⁡θsin⁡α)\boldsymbol b=(l\cos\theta\cos\alpha-l\sin\theta\sin\alpha,l\sin\theta\cos\alpha+l\cos\theta\sin\alpha)

Substituting the above x,yx,y back gives

b=(xcos⁡α−ysin⁡α,ycos⁡α+xsin⁡α)\boldsymbol b=(x\cos\alpha-y\sin\alpha,y\cos\alpha+x\sin\alpha)

Therefore, in two-dimensional space, the transformation matrix RR is

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

In three-dimensional space, vector rotation requires two angular parameters, namely the zenith-angle rotation and the azimuth-angle rotation. The rotation can be performed using spherical coordinates.

Rotation of a vector about a line

For three-dimensional vectors, rotation about a line is more common. For convenience, assume again that this line passes through the origin. If it does not, the coordinate system can still be translated to reduce it to this case.

Take the direction vector of the line to be u=(ux,uy,uz)\boldsymbol u=(u_x,u_y,u_z), and let a three-dimensional vector be rotated counterclockwise about it through an angle θ\theta. The corresponding transformation matrix RR is 1

R=[ux2(1−cos⁡θ)+cos⁡θuxuy(1−cos⁡θ)−uzsin⁡θuxuz(1−cos⁡θ)+uysin⁡θuxuy(1−cos⁡θ)+uzsin⁡θuy2(1−cos⁡θ)+cos⁡θuyuz(1−cos⁡θ)−uxsin⁡θuxuz(1−cos⁡θ)−uysin⁡θuyuz(1−cos⁡θ)+uxsin⁡θuz2(1−cos⁡θ)+cos⁡θ].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 is not a linear transformation but an affine transformation. However, an affine transformation in Rn\mathbf R^n can still be represented by a linear transformation in Rn+1\mathbf R^{n+1}.

Consider an nn-dimensional vector a=(a1,a2,…,an)\boldsymbol a=(a_1,a_2, \ldots , a_n) and translate it along the vector t=(t1,t2,…,tn)\boldsymbol t=(t_1, t_2, \ldots , t_n). Append one dimension to the column vector a\boldsymbol a and set it to 11, obtaining the new column vector a′=(a1,a2,…,an,1)\boldsymbol a'=(a_1, a_2, \ldots , a_n, 1). The transformation matrix TT can then be written as

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

For any other linear transformation matrix, add one column and one row to the matrix, filling every part with 11 except for the bottom-right element, which is 00. In this way, every linear transformation matrix can be converted into an affine transformation matrix. For example, for a two-dimensional vector rotation, the transformation matrix becomes

R′=[cos⁡α−sin⁡α0sin⁡αcos⁡α0001].R'= \begin{bmatrix} \cos\alpha & -\sin\alpha & 0\\ \sin\alpha & \cos\alpha & 0\\ 0 & 0 & 1 \end{bmatrix}.

A more rigorous definition of vectors

Above, a vector was defined as a directed line segment in space. Strictly speaking, however, a vector is more than a directed line segment. To give vectors a more rigorous definition, one must first define a vector space; see the vector space page for details.

Footnotes

  1. See Rotation matrix from axis and angle - Wikipedia ↩

This content comes from OI Wiki: Vectors. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.