Recommended resources
The freely available resources this lesson will direct you to.
Welcome to the first lesson of your journey into the mathematical foundations of artificial intelligence and computer graphics. Your goal is to master these fields from first principles, and there is no better place to start than with the fundamental atom of this entire domain: the vector. Everything from the position of a vertex in a 3D model, to a data point in a machine learning problem, to the forces in a physics simulation is described using vectors.
In this lesson, we will establish a solid, first-principles understanding of vectors. We will define precisely what a vector is, exploring both its geometric and numerical representations. Then, we will master the two foundational operations that allow us to manipulate them: addition and scalar multiplication. These concepts form the bedrock upon which all of linear algebra—and consequently, much of modern AI and graphics—is built.
What is a Vector?
To begin, it's essential to understand that the term "vector" can be interpreted in a few different ways, depending on the context. For our purposes in computer science, graphics, and machine learning, we will primarily focus on two complementary perspectives: vectors as arrows in space (the geometric view) and vectors as lists of numbers (the numerical or coordinate view).
The ability to fluidly translate between these two perspectives is what makes linear algebra such a powerful tool. A deep understanding of this duality will allow you to visualize the effect of your code and, conversely, to translate geometric ideas into precise, computable instructions.
The following video from the YouTube channel 3Blue1Brown provides an excellent introduction to this dual nature. Please watch the first four minutes to ground your intuition.
Vectors | Chapter 1, Essence of linear algebra
This video, "Vectors | Chapter 1, Essence of linear algebra," introduces the different perspectives on vectors and establishes the core intuition we will build upon.
Watch from the beginning until the end of the coordinate system explanation. Pay close attention to the distinction between the "physics student" view (arrows that can move freely) and the convention in linear algebra, where vectors are typically rooted at the origin.
As the video highlights, we can formally represent a vector in -dimensional space, denoted , as an ordered list (or "n-tuple") of real numbers. These numbers are the vector's components or coordinates. For example, a vector in 3D space () can be written as:
Here, , , and are the coordinates along the x, y, and z axes, respectively. This column format is the standard convention in computer graphics and machine learning texts, as it interacts cleanly with matrices, which we will see in a future lesson.
The Fundamental Operations: Addition and Scalar Multiplication
All of the complex transformations and analyses we'll perform in this course are built from two simple operations: adding two vectors together and multiplying a vector by a number (a scalar).
Geometric Interpretation
Let's first build our intuition geometrically.
- Vector Addition: To add two vectors and , we use the tip-to-tail method. We move the tail of to the tip of . The sum, , is the new vector drawn from the origin (the tail of ) to the tip of the repositioned . You can think of this as following one displacement, then another, with the sum being the net displacement.
- Scalar Multiplication: Multiplying a vector by a scalar scales its length. If is positive, the vector's direction remains the same, but its length is multiplied by . If is negative, the vector's direction is reversed, and its length is scaled by the absolute value of .
The image below provides a clean visual summary of these two geometric operations.

Algebraic Definition
The geometric intuition has a direct and simple numerical counterpart. These operations are performed component-wise.
Let and be two vectors in .
-
Vector Addition:
-
Scalar Multiplication: Let be a scalar.
To see how these two views connect, let's return to the 3Blue1Brown video.
Vectors | Chapter 1, Essence of linear algebra
This segment of the video explicitly connects the geometric tip-to-tail method to the algebraic component-wise addition and also visualizes scalar multiplication.
Please watch from this section on vector operations. Notice how moving along the components of the first vector and then the second is equivalent to moving along the components of the sum vector.
A Question of Subtraction
We have defined addition and scalar multiplication. Using only these two operations, how would you define vector subtraction, ? What would this look like geometrically?
Think about how subtraction relates to addition and negative numbers in standard arithmetic. The same principle applies here.
Vector subtraction is defined as the addition of and the negative of :
Geometrically, this means we take the vector , reverse its direction (by multiplying by -1), and then add the resulting vector to using the tip-to-tail method. Another useful visualization is that is the vector that points from the tip of to the tip of . This interpretation will become very useful in graphics for finding the vector between two points.
Points vs. Vectors: A Crucial Distinction
Your interest in graphics and low-level engineering demands precision. A common point of confusion is the difference between a point and a vector. A point specifies a location in space. A vector specifies a direction and magnitude (a displacement), but has no fixed location.
Point + Vector = Point: Moving a point by a displacement vector results in a new point.Point - Point = Vector: The difference between two points is the displacement vector needed to get from one to the other.Vector + Vector = Vector: Combining two displacements results in a net displacement.
However, an operation like Point + Point is geometrically meaningless. Adding two locations doesn't produce a logical third location. This distinction is subtle but fundamental to writing correct and robust geometric code.
The following reading from a University of Kansas tutorial on vector geometry for computer graphics provides a rigorous yet intuitive explanation of this topic.
Vector Geometry for Computer Graphics
This paper by J.R. Miller formalizes the distinction between points and vectors, explaining why certain operations are valid while others are not. This is a key "first principles" insight for anyone serious about computer graphics.
Please read the sections titled "Points and vectors" and "Spaces". Start from the beginning of the section and focus on the example in Figure 1 that demonstrates why adding points is ill-defined. Then, continue reading through the formal definitions of a vector space and an affine space, up to the sentence which concludes the argument. This will clarify which combinations of points and vectors are mathematically sound.
Conclusion
In this lesson, we established our first and most critical building block. You learned to define a vector both as a geometric arrow and as a numerical list of coordinates in . We then explored the two fundamental operations, vector addition and scalar multiplication, from both perspectives and saw how they are intrinsically linked. Finally, we drew a sharp distinction between points and vectors, a piece of formal knowledge that is essential for robust geometric programming.
These simple operations are the foundation of everything that follows. In our next lesson, we will introduce a new operation: the dot product. The dot product will unlock the geometric concepts of length, angle, and projection, allowing us to ask much more interesting questions, such as "How much is this vector pointing in the same direction as that one?"—a question at the heart of lighting calculations in graphics and similarity measures in machine learning.