import numpy as np
# define two vectors
u = np.array([2, 1])
v = np.array([1, 3])
# addition
u_plus_v = u + v
# scalar multiplication
scalar_mult = 3 * u
u_plus_v, scalar_mult(array([3, 4]), array([6, 3]))
A vector space (also called a linear space) is a collection of objects called vectors, along with two operations:
The scalars usually come from the real numbers \mathbb{R}, but they can also come from the complex numbers \mathbb{C} or other fields.
The set \mathbb{R}^2 (the plane) is a vector space. Vectors are pairs of real numbers:
\mathbf{v} = \begin{bmatrix} x \\ y \end{bmatrix}, \quad x,y \in \mathbb{R}
Addition: \begin{bmatrix} x_1 \\ y_1 \end{bmatrix} + \begin{bmatrix} x_2 \\ y_2 \end{bmatrix} = \begin{bmatrix} x_1 + x_2 \\ y_1 + y_2 \end{bmatrix}
Scalar multiplication: c \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} c x \\ c y \end{bmatrix}
For a set V to be a vector space (over scalars in a field F), it must satisfy: