What Mathematical Concepts Are Covered in Chapter 1: Vectors? A Deep Dive into the Maths-CS-AI Compendium
Chapter 1 of the Maths-CS-AI Compendium introduces five foundational mathematical concepts: vector spaces and their algebraic axioms, vector properties including linear independence and basis transformations, norms and distance metrics, vector products such as inner and cross products, and basis duality with coordinate functionals.
The HenryNdubuaku/maths-cs-ai-compendium repository structures its first chapter as a complete mathematical foundation for linear algebra. According to the source files located in chapter 01: vectors/, this chapter establishes the algebraic language necessary for machine learning embeddings, computer graphics, and optimization theory.
Vector Spaces: Definitions, Axioms, and Algebraic Structure
According to chapter 01: vectors/01. vector spaces.md, the chapter opens with the formal definition of vector spaces and their governing axioms. The text covers closure under addition and scalar multiplication, with concrete examples including ℝⁿ and abstract function spaces.
The note explores subspaces, linear combinations, and the span of a set of vectors. It defines dimension and basis as fundamental structural properties that characterize any vector space.
import numpy as np
# Vector space closure: linear combinations stay in the space
v = np.array([1, 2])
w = np.array([3, -1])
alpha, beta = 2.5, -0.7
print(alpha*v + beta*w) # Result remains in ℝ²
Vector Properties: Linear Independence and Basis Transformations
The content in chapter 01: vectors/02. vector properties.md focuses on linear independence and the mechanics of basis formation. You will learn to test for independence via rank calculations and understand how vectors behave under linear operations.
The file details coordinate representation relative to a chosen basis and the change of basis transformation. These concepts explain how the same vector can be represented by different coordinate tuples depending on the reference frame.
# Linear independence test via matrix rank
A = np.array([[1, 2, 3], [2, 4, 6]])
print(np.linalg.matrix_rank(A)) # Rank 1 indicates linear dependence
Norms and Metrics: Measuring Length and Distance
As implemented in chapter 01: vectors/03. norms and metrics.md, the chapter introduces norms as functions that assign length to vectors. The text defines the three essential properties: positivity, scalability (homogeneity), and the triangle inequality.
The note covers common norms including the ℓ₁ (Manhattan), ℓ₂ (Euclidean), and ℓ∞ (maximum) norms. It explains how these norms induce distance metrics that measure similarity between vectors, a prerequisite for optimization algorithms and machine-learning similarity measures.
# Comparing Euclidean (ℓ₂) and Manhattan (ℓ₁) norms
x = np.array([3, -4])
print(np.linalg.norm(x)) # ℓ₂ norm = 5.0
print(np.abs(x).sum()) # ℓ₁ norm = 7
Vector Products: Inner Products, Orthogonality, and Cross Products
According to chapter 01: vectors/04. products.md, this section covers the inner product (dot product) with its properties of symmetry, bilinearity, and positivity. The text explains orthogonality and derives projection formulae used in least-squares approximations.
For ℝ³ specifically, the note introduces the cross product and its geometric interpretation. It also touches on the outer product as a matrix-generating operation between vectors.
# Inner product and orthogonal projection
u = np.array([1, 0])
v = np.array([2, 3])
proj = (np.dot(v, u) / np.dot(u, u)) * u
print(proj) # [2, 0]
# Cross product in ℝ³
a = np.array([1, 0, 0])
b = np.array([0, 1, 0])
print(np.cross(a, b)) # [0, 0, 1]
Basis and Duality: Dual Spaces and Coordinate Functionals
The final note, chapter 01: vectors/05. basis and duality.md, connects vector spaces to their dual spaces. It covers the construction of a dual basis and the use of coordinate functionals to extract coefficients relative to a basis.
This section explains how linear maps can be represented succinctly using basis and dual-basis pairs, preparing the foundation for advanced topics like tensors and differential forms.
# Dual basis: extracting coordinates via matrix inverse
B = np.array([[1, 2], [3, 4]]) # Basis matrix
B_inv = np.linalg.inv(B) # Dual basis matrix
v = np.array([5, 6])
coords = B_inv @ v
print(coords) # Coordinates of v in basis B
Summary
Chapter 1 of the Maths-CS-AI Compendium establishes the complete mathematical foundation for vector mathematics:
- Vector spaces and their axioms, covering subspaces, span, and dimension in
01. vector spaces.md - Vector properties including linear independence, basis formation, and coordinate transformations in
02. vector properties.md - Norms and metrics defining length and distance through ℓ₁, ℓ₂, and ℓ∞ norms in
03. norms and metrics.md - Vector products including inner products, orthogonality, projections, and cross products in
04. products.md - Basis and duality connecting primal and dual spaces through coordinate functionals in
05. basis and duality.md
Frequently Asked Questions
What is the difference between linear independence and a basis?
Linear independence means no vector in a set can be written as a combination of the others, while a basis is a linearly independent set that also spans the entire space. According to the compendium, every basis is linearly independent, but not every independent set is a basis unless it spans the space.
How does the dual basis extract coordinates from a vector?
The dual basis consists of linear functionals that map vectors to their scalar coordinates relative to a specific basis. As shown in chapter 01: vectors/05. basis and duality.md, you compute coordinates by applying the dual basis vectors (rows of the inverse basis matrix) to your target vector.
When should I use the ℓ₁ norm versus the ℓ₂ norm in machine learning?
Use the ℓ₁ norm (Manhattan) when you need sparsity-inducing regularization or robustness to outliers, as implemented in LASSO regression. Use the ℓ₂ norm (Euclidean) for standard distance calculations and when you require rotational invariance, common in ridge regression and standard gradient descent.
What is the geometric interpretation of the cross product?
The cross product in ℝ³ produces a vector orthogonal to both input vectors with magnitude equal to the area of the parallelogram they span. According to chapter 01: vectors/04. products.md, this operation is essential for calculating surface normals and torque in physics applications.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →