Courses / Computer Science I
Algebra

Vectors and Vector Spaces

Computer Science I 340 words Free to read

Objects You Can Add and Scale

A vector is an object that has both magnitude and direction — a displacement, a velocity, a force. In coordinates, a vector in the plane is a pair (v1,v2)(v_1, v_2) and in nn dimensions an nn-tuple. But the deeper idea is structural: a vector space is any set of objects that can be added together and scaled by numbers (scalars), obeying a short list of natural rules.

Two operations define a vector space:

These obey the vector-space axioms: addition is commutative and associative, there is a zero vector 0\mathbf{0} (adding it changes nothing), every vector has a negative, and scalar multiplication distributes over addition. Any set satisfying these axioms is a vector space — and remarkably, this includes not just arrows but polynomials, matrices, and functions, which is why the abstraction is so powerful.

The magnitude (norm) of a vector measures its length: in the plane, v=v12+v22\|v\| = \sqrt{v_1^2 + v_2^2} by the Pythagorean theorem. A unit vector has norm 1 and captures pure direction. In computing, vectors are everywhere — coordinates in graphics, feature vectors in machine learning, embeddings in language models.

Common pitfall: treating vectors as mere lists of numbers and losing the operations, or confusing a vector's magnitude with its components. A vector is defined by how it adds and scales, not just its entries; and its magnitude is v12+v22\sqrt{v_1^2 + v_2^2} (a single length), not the individual components v1,v2v_1, v_2. Adding vectors is componentwise — you do not add magnitudes (the length of a sum is generally not the sum of the lengths).

Two vectors from the origin joined tip-to-tail, the accent resultant drawn from start to final tip, with its Pythagorean length labeled — showing componentwise addition, not magnitude addition.

v=v12+v22\|v\| = \sqrt{v_1^2 + v_2^2}

Vectors and Vector Spaces

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

11practice questions
2interactive scenes
Start Computer Science I free

Algebra