1. The Vector Space Axioms
In Computer Science and Engineering, a vector is not merely an arrow in 2D space or an array in memory; it is an element of an algebraic structure called a Vector Space $(V, +, \cdot)$ defined over a scalar field $\mathbb{F}$ (typically the real numbers $\mathbb{R}$ or complex numbers $\mathbb{C}$).
A set $V$ equipped with vector addition $+: V \times V \to V$ and scalar multiplication $\cdot: \mathbb{F} \times V \to V$ forms a vector space if it satisfies the 8 Core Axioms:
- Associativity of Addition: $u + (v + w) = (u + v) + w$ for all $u, v, w \in V$.
- Commutativity of Addition: $u + v = v + u$ for all $u, v \in V$.
- Additive Identity: There exists $\mathbf{0} \in V$ such that $v + \mathbf{0} = v$.
- Additive Inverse: For every $v \in V$, there exists $-v \in V$ such that $v + (-v) = \mathbf{0}$.
- Compatibility of Scalar Multiplication: $a(bv) = (ab)v$ for all $a, b \in \mathbb{F}$.
- Multiplicative Identity: $1 \cdot v = v$ where $1 \in \mathbb{F}$.
- Distributivity over Vector Addition: $a(u + v) = au + av$.
- Distributivity over Scalar Addition: $(a + b)v = av + bv$.
text
2. Linear Independence and Span
Let $S = {v_1, v_2, \dots, v_k}$ be a set of vectors in $V$.
The Span
The span of $S$, denoted $\text{span}(S)$, is the set of all possible linear combinations of vectors in $S$:
$$\text{span}(S) = \left{ \sum_{i=1}^k c_i v_i ;\middle|; c_i \in \mathbb{F} \right}$$
$\text{span}(S)$ is the smallest subspace of $V$ containing all vectors in $S$.
Linear Independence
The vectors ${v_1, v_2, \dots, v_k}$ are linearly independent if and only if the vector equation:
$$c_1 v_1 + c_2 v_2 + \dots + c_k v_k = \mathbf{0}$$
has only the trivial solution:
$$c_1 = c_2 = \dots = c_k = 0$$
If there exists a set of scalars not all zero that satisfies the equation, the vectors are linearly dependent. In CSE terms, linear dependence indicates redundant data or collinear features in a dataset.
3. Basis and Dimension
A subset $B = {b_1, b_2, \dots, b_n} \subset V$ is a Basis of $V$ if:
- $B$ is linearly independent.
- $\text{span}(B) = V$ (B spans the entire space).
Unique Representation Theorem
If $B$ is a basis for $V$, every vector $v \in V$ can be expressed uniquely as a linear combination:
$$v = x_1 b_1 + x_2 b_2 + \dots + x_n b_n$$
The scalar tuple $[x_1, x_2, \dots, x_n]^T \in \mathbb{R}^n$ represents the coordinates of $v$ with respect to basis $B$.
Dimension
The dimension of a vector space, $\dim(V)$, is the number of vectors in any basis for $V$. All bases for a given finite-dimensional vector space have the identical cardinality.
4. Inner Products and Norms in CSE
To measure distances, angles, and magnitudes in vector spaces, we equip $V$ with an Inner Product $\langle u, v \rangle = u^T v = \sum_{i=1}^n u_i v_i$.
Common Vector Norms in Computer Science
| Norm | Formula | CSE / Engineering Usage |
|---|---|---|
| $L_1$ Norm (Manhattan) | $|x|1 = \sum{i=1}^n |x_i|$ | Lasso regression, sparse feature selection, grid pathfinding. |
| $L_2$ Norm (Euclidean) | $|x|2 = \sqrt{\sum{i=1}^n x_i^2}$ | Standard distance metric, ridge regularization, SGD weight decay. |
| $L_\infty$ Norm (Max) | $|x|\infty = \max{i} |x_i|$ | Worst-case numerical error analysis, infinity-norm adversarial attacks in AI. |
| Cosine Similarity | $\cos(\theta) = \frac{u \cdot v}{|u|_2 |v|_2}$ | Vector search engines, RAG embeddings similarity (Pinecone, Milvus, pgvector). |
5. Python Implementation: Verifying Basis & Independence
python
Key Takeaway for CSE
Vector spaces form the foundation for coordinate systems in computer graphics, token embeddings in large language models ($d=4096$ in Llama 3), and feature spaces in classification algorithms. Linear independence guarantees that our representations contain zero redundant dimensions.