Vectors¶
Vectors and matrices · Chapter 3 · Lecture notes (PDF) · Exercises: Vectors · Slides (PDF)
1. Definition and transpose¶
Definition 1: Vector
A vector is a column of real numbers with \(n\) rows.
Given a vector \(\boldsymbol{a}\in\R^{n}\), we write:
-
The integer \(n\) is the dimension of the vector (the number of rows).
-
The quantity \([\boldsymbol a]_i\) (or \(a_i\)) denotes the \(i\)-th entry (or \(i\)-th component) of \(\boldsymbol{a}\), for \(i\in\{1,2,\dots,n\}\).
Example 1: Vector
The vector
is a column vector with \(n=4\) rows, where \(a_1 = 2\), \(a_2 = -5\), \(a_3 = 3\), and \(a_4 = 1\).
Definition 2: Transpose of a vector
Given a column vector \(\boldsymbol a \in \R^{n}\), the transpose of \(\boldsymbol a\), denoted by \(\boldsymbol a'\), is the row vector:
Example 2: Transpose of a vector
Given the column vector
its transpose is the row vector
2. Sum of vectors and scalar multiplication¶
Given two column vectors
their sum is the vector
Given a scalar \(\lambda\in\R\) and a column vector
the scalar multiplication of \(\boldsymbol p\) by \(\lambda\) is the vector
Example 3: Sum of vectors and scalar multiplication
Consider the following two vectors and a scalar:
Then:
2.1 Properties¶
The properties of vector addition and scalar multiplication are:
3. Scalar product¶
Given two column vectors
the expression
is called the scalar product of \( \boldsymbol p \) and \( \boldsymbol w \).
Example 4: Scalar product
Consider the two vectors \(\begin{pmatrix} 1 \\ 4 \end{pmatrix}\in\R^2\) and \(\begin{pmatrix} 4 \\ 1 \end{pmatrix}\in\R^2\). Their scalar product is:
3.1 Properties¶
The properties of the scalar product are:
From the definition we have:
4. Linear combinations and linear independence¶
Definition 3: Linear combination
Given \(k\) vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) and \(k\) scalars \(\lambda_1,\lambda_2,\dots,\lambda_k\in\R\), the vector
is called a linear combination of \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\) with coefficients \(\lambda_1,\lambda_2,\dots,\lambda_k\).
-
We denote by \(\boldsymbol 0\in\R^{n}\) the zero vector, i.e., the vector whose entries are all equal to \(0\).
-
Choosing \(\lambda_1=\lambda_2=\dots=\lambda_k=0\) we always obtain \(\boldsymbol 0\): this is called the trivial linear combination.
Example 5: Linear combination
Consider the vectors
and the coefficients \(\lambda_1=2\) and \(\lambda_2=-3\). The corresponding linear combination is
Definition 4: Linearly independent vectors
The vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) are linearly independent if the only linear combination equal to the zero vector is the trivial one, i.e.,
Otherwise, i.e., if there exist coefficients \(\lambda_1,\lambda_2,\dots,\lambda_k\), not all zero, such that \(\lambda_1\boldsymbol v_1+\lambda_2\boldsymbol v_2+\dots+\lambda_k\boldsymbol v_k=\boldsymbol 0\), the vectors are linearly dependent.
Example 6: Linearly independent vectors in \(\R^2\)
Consider the vectors \( \boldsymbol v_1=\begin{pmatrix}1\\2\end{pmatrix} \) and \( \boldsymbol v_2=\begin{pmatrix}3\\1\end{pmatrix}\in\R^{2}. \) The condition \(\lambda_1\boldsymbol v_1+\lambda_2\boldsymbol v_2=\boldsymbol 0\) reads
From the first equation \(\lambda_1=-3\lambda_2\); substituting in the second one we get \(-6\lambda_2+\lambda_2=-5\lambda_2=0\), hence \(\lambda_2=0\) and \(\lambda_1=0\). Therefore, \(\boldsymbol v_1\) and \(\boldsymbol v_2\) are linearly independent.
Example 7: Linearly dependent vectors in \(\R^2\)
Consider the vectors
With the coefficients \(\lambda_1=1\), \(\lambda_2=1\), \(\lambda_3=-1\) (not all zero) we get
Therefore, \(\boldsymbol v_1\), \(\boldsymbol v_2\) and \(\boldsymbol v_3\) are linearly dependent.
Example 8: Linearly independent vectors in \(\R^3\)
Consider the vectors
The condition \(\lambda_1\boldsymbol v_1+\lambda_2\boldsymbol v_2+\lambda_3\boldsymbol v_3=\boldsymbol 0\) reads
From the first two equations \(\lambda_1=-\lambda_3\) and \(\lambda_2=-\lambda_3\); substituting in the third one we get \(-2\lambda_3=0\). Hence \(\lambda_1=\lambda_2=\lambda_3=0\), and the three vectors are linearly independent.
Example 9: Linearly dependent vectors in \(\R^3\)
Consider the vectors
With the coefficients \(\lambda_1=1\), \(\lambda_2=-2\), \(\lambda_3=1\) we get
Therefore, the three vectors are linearly dependent. Equivalently, \(\boldsymbol v_3=2\boldsymbol v_2-\boldsymbol v_1\) is a linear combination of \(\boldsymbol v_1\) and \(\boldsymbol v_2\).
Observation 1: Sets containing the zero vector
Any set of vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) containing the zero vector \(\boldsymbol 0\) is linearly dependent.
Proof
Assume, without loss of generality, that \(\boldsymbol v_1=\boldsymbol 0\). Choosing \(\lambda_1=1\) and \(\lambda_2=\dots=\lambda_k=0\) we get \(1\cdot\boldsymbol 0+0\cdot\boldsymbol v_2+\dots+0\cdot\boldsymbol v_k=\boldsymbol 0\), which is a linear combination equal to \(\boldsymbol 0\) with coefficients not all zero. □
Observation 2: Characterization of linear dependence
Let \(k\ge 2\). The vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) are linearly dependent if and only if at least one of them is a linear combination of the others.
Proof
(\(\Rightarrow\)) If the vectors are linearly dependent, there exist coefficients, not all zero, such that \(\sum_{i=1}^{k}\lambda_i\boldsymbol v_i=\boldsymbol 0\). Let \(j\) be an index with \(\lambda_j\neq 0\). Then
i.e., \(\boldsymbol v_j\) is a linear combination of the others.
(\(\Leftarrow\)) If \(\boldsymbol v_j=\sum_{i\neq j}\mu_i\boldsymbol v_i\) for some scalars \(\mu_i\), then \(\sum_{i\neq j}\mu_i\boldsymbol v_i+(-1)\,\boldsymbol v_j=\boldsymbol 0\), which is a linear combination equal to \(\boldsymbol 0\) whose coefficient of \(\boldsymbol v_j\) is \(-1\neq 0\). □
Observation 3: More than \(n\) vectors of \(\R^n\)
Any \(k>n\) vectors of \(\R^{n}\) are linearly dependent.
- We state this result without proof. For instance, any three vectors of \(\R^2\) are linearly dependent (see Example Example 7).
4.1 Span and basis¶
Definition 5: Span
The span of the vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) is the set of all their linear combinations:
Definition 6: Basis of \(\R^n\)
The vectors \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\in\R^{n}\) form a basis of \(\R^{n}\) if
-
they are linearly independent, and
-
\(\mathrm{span}(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k)=\R^{n}\), i.e., every vector of \(\R^{n}\) is a linear combination of them.
Observation 4: Coordinates with respect to a basis
If \(\boldsymbol v_1,\boldsymbol v_2,\dots,\boldsymbol v_k\) form a basis of \(\R^{n}\), then every vector \(\boldsymbol x\in\R^{n}\) can be written in a unique way as \(\boldsymbol x=\lambda_1\boldsymbol v_1+\lambda_2\boldsymbol v_2+\dots+\lambda_k\boldsymbol v_k\). The coefficients \(\lambda_1,\lambda_2,\dots,\lambda_k\) are called the coordinates of \(\boldsymbol x\) with respect to the basis.
Proof
Such coefficients exist because the span of the basis is \(\R^{n}\). If \(\boldsymbol x=\sum_{i=1}^{k}\lambda_i\boldsymbol v_i=\sum_{i=1}^{k}\mu_i\boldsymbol v_i\), subtracting the two expressions we get \(\sum_{i=1}^{k}(\lambda_i-\mu_i)\boldsymbol v_i=\boldsymbol 0\). Since the vectors are linearly independent, \(\lambda_i-\mu_i=0\) for all \(i\in\{1,2,\dots,k\}\). □
Definition 7: Canonical basis
For \(i\in\{1,2,\dots,n\}\), we denote by \(\boldsymbol e_i\in\R^{n}\) the vector whose \(i\)-th entry is equal to \(1\) and all other entries are equal to \(0\):
The vectors \(\boldsymbol e_1,\boldsymbol e_2,\dots,\boldsymbol e_n\) form the canonical basis of \(\R^{n}\).
Observation 5: The canonical basis is a basis
The vectors \(\boldsymbol e_1,\boldsymbol e_2,\dots,\boldsymbol e_n\) form a basis of \(\R^{n}\), and every \(\boldsymbol x\in\R^{n}\) satisfies
Proof
For any scalars \(\lambda_1,\dots,\lambda_n\) we have \(\lambda_1\boldsymbol e_1+\dots+\lambda_n\boldsymbol e_n=\begin{pmatrix}\lambda_1 & \lambda_2 & \dots & \lambda_n\end{pmatrix}'\). This vector is equal to \(\boldsymbol 0\) only if \(\lambda_1=\dots=\lambda_n=0\), hence the vectors are linearly independent; choosing \(\lambda_i=x_i\) we obtain \(\eqref{vecCanonical}\), hence their span is \(\R^{n}\). □
- It can be shown that every basis of \(\R^{n}\) consists of exactly \(n\) vectors.
Example 10: Canonical basis of \(\R^3\)
The vector \(\boldsymbol x=\begin{pmatrix}2 & -5 & 3\end{pmatrix}'\in\R^{3}\) can be written as
Example 11: Coordinates with respect to a basis of \(\R^2\)
Consider the vectors \( \boldsymbol v_1=\begin{pmatrix}1\\1\end{pmatrix} \) and \( \boldsymbol v_2=\begin{pmatrix}1\\-1\end{pmatrix}. \)
-
They are linearly independent: \(\lambda_1+\lambda_2=0\) and \(\lambda_1-\lambda_2=0\) give \(\lambda_1=\lambda_2=0\).
-
Their span is \(\R^{2}\): for every \(\begin{pmatrix}a & b\end{pmatrix}'\in\R^{2}\),
\[ \begin{pmatrix}a\\b\end{pmatrix} = \frac{a+b}{2}\begin{pmatrix}1\\1\end{pmatrix} + \frac{a-b}{2}\begin{pmatrix}1\\-1\end{pmatrix}. \]
Hence \(\boldsymbol v_1,\boldsymbol v_2\) form a basis of \(\R^2\). For instance, the coordinates of \(\boldsymbol x=\begin{pmatrix}3 & 1\end{pmatrix}'\) are \(\lambda_1=\frac{3+1}{2}=2\) and \(\lambda_2=\frac{3-1}{2}=1\):