Now that we understand a vector as an ordered list of numbers representing magnitude and direction, or simply a point in space, we need a consistent way to write them down. Just like we use symbols like x or y to represent unknown numbers in algebra, we use specific notation in linear algebra to represent vectors. This helps distinguish them from single numbers (scalars) and keeps our mathematical expressions clear.
You'll typically see vectors denoted in one of two main ways:
Both notations signal that we're talking about a vector, not just a simple scalar value like a or b. In this course, we will primarily use the lowercase bold letter convention, like v.
A vector is defined by its components, which are the individual numbers within the ordered list. We usually write these components enclosed in square brackets or parentheses.
For example, a vector v with n components can be written as:
v=[v1,v2,…,vn]Or sometimes using parentheses:
v=(v1,v2,…,vn)Here, v1 is the first component, v2 is the second component, and vn is the n-th component. The subscript number (1, 2, ..., n) indicates the position of the component within the vector.
Important Note on Indexing: In mathematics, vector components are often 1-indexed, meaning the first element is v1, the second is v2, and so on. However, in programming, particularly in Python and libraries like NumPy, indexing is typically 0-indexed. This means the first element is at index 0, the second at index 1, etc. When we move to implementing vectors in code, we'll use 0-based indexing. It's useful to be aware of both conventions.
The way we arrange the components visually matters, especially when we start working with matrices later. There are two primary formats:
Column Vector: The components are arranged vertically in a column. This is often the default representation in many linear algebra contexts.
v=v1v2⋮vnRow Vector: The components are arranged horizontally in a row.
v=[v1v2…vn]Or simply written inline as v=[v1,v2,…,vn].
While they contain the same information, the distinction between column and row vectors becomes significant for operations like matrix multiplication. Unless specified otherwise, when we refer to a "vector," we often implicitly mean a column vector. However, row vectors are also frequently used, especially when representing data points in a table or dataset, where each row might be a single data sample (vector).
A 2-dimensional column vector a:
a=[3−1]Here, a1=3 and a2=−1.
A 3-dimensional row vector b:
b=[502.5]Here, b1=5, b2=0, and b3=2.5.
A general n-dimensional column vector x:
x=x1x2⋮xnYou might also encounter notation like v∈Rn. This is mathematical shorthand stating that v is a vector belonging to the set of all possible n-dimensional vectors where each component is a real number. R represents the set of real numbers, and the superscript n indicates the dimension (number of components).
Understanding this notation is helpful for reading mathematical definitions related to machine learning algorithms.
With this standard notation in mind, we can clearly communicate and work with vectors. Next, we'll see how to represent these mathematical objects using Python's NumPy library.
© 2025 ApX Machine Learning