Courses / Computer Science I
Algebra

Vectors and Vector Spaces

Computer Science I 264 words Free to read

What is a Vector?

A vector is an object with magnitude and direction, like velocity or force. In nn dimensions, it is an nn-tuple. A vector space is any set of objects that can be added and scaled by numbers (scalars), obeying natural rules. This abstraction applies to arrows, polynomials, matrices, and functions.

Two core operations define the space:

OperationRuleGeometric meaning
Vector addition(a1,b1)+(a2,b2)=(a1+a2,b1+b2)(a_1, b_1) + (a_2, b_2) = (a_1+a_2, b_1+b_2)Tip-to-tail placement
Scalar multiplicationc(v1,v2)=(cv1,cv2)c(v_1, v_2) = (cv_1, cv_2)Stretch, shrink, or reverse

These operations obey vector-space axioms: commutative and associative addition, a zero vector 0\mathbf{0} that changes nothing, additive inverses, and distributive laws.

Length and Pitfalls

The magnitude (norm) of a vector measures its length. For a 2D vector, the Pythagorean norm formula is:

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

A unit vector has norm 1 and captures pure direction. In computing, vectors serve as graphics coordinates, machine learning feature vectors, and language model embeddings.

ConceptCorrect MeaningCommon Mistake
MagnitudeSingle length v12+v22\sqrt{v_1^2 + v_2^2}Treating components v1,v2v_1, v_2 as the length
AdditionComponentwise additionAdding magnitudes directly (u+vu+v\|u+v\| \neq \|u\| + \|v\|)
Pitfall: Do not treat vectors as mere lists of numbers. A vector is defined by how it adds and scales, and the length of a vector sum is generally not the sum of their individual lengths.
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

Algebra