Algebraic and Geometric Interpretations of Vectors
In this article, lets learn about vectors in terms of algebraic and geometric interpretations. We will also learn how to write vectors in python and visualize vectors.
Here’s all the source code: https://github.com/MrSheerluck/linear-algebra/blob/main/vectors/geometric-vector-representation.ipynb
Algebraically a vector is an ordered list of numbers like this:
Vectors are typically surrounded by brackets, sometimes angled brackets, sometimes more curved brackets like parentheses.
The order of the numbers is important.
Each number inside the vector is often called an Element.
The number of elements in a vector is called the Dimensionality of the Vector. In our above example the vector is a 3 dimensional vector as it has 3 elements.
These elements can be real numbers, complex value numbers, rational or irrational.
Let’s take 2 vectors:
As I said the order of elements in a vector matters. Hence the above 2 vectors are not equal.
The first vector’s first element is 1 but the second vector’s first element is 2. Even though both the vectors contains same numbers and are 3 dimensional (both the vectors contains 3 elements) but due their difference in ordering they are not the same.
You’ll understand this more clearly in geometric interpretation that why these 2 vectors are not same and why order matters.
Column and Row Vectors
Vectors can be standing up like:
These are called column vectors.
Vectors can be lying down like:
These are called row vectors.
Vector Notations
There are few conventions or format for referring a vector but all of these notations can be used interchangeably, that’s why you need to know all of them:
Don’t worry too much about the right most one just remember this:
The most common notations are the bold letter way (left most one) or the arrow one (2nd one from left)
Geometric Interpretation
The geometric interpretation of a vector is that a vector is a straight line with some length and some direction and its specified by the numbers given in the vector.
It’s easy to visualise in 2D.
This is a 2d vector that goes over 3 units and up 2 units.
Notice how I said this is a vector and not the vector.
Remember that a vector geometrically is the length and direction from the start point to the end point of the vector.
It doesn’t matter where the vector starts
All of the above vectors are:
but they are starting at different points.
The starting point of a vector is called the tail of the vector.
The endpoint which is drawn with an arrowhead is called the head of the vector.
When a vector start at the origin, they are called being in standard position.
So in our previous video with multiple vectors, the vector that starts at origin is a vector in standard position.
So, always remember a vector doesn’t represent its coordinate point. A vector (3,2) just represents that it goes over 3 units and up 2 units.
Of course, when a vector starts at standard position then you can say that the coordinate and the vector matches.
Geometric 3D Vector Representation
Here’s a example of representing a 3d vector:
One thing you can understand that geometric representation of linear algebra concepts is useful in 2D and 3D and after that, we need to switch back to algebraic representation
Vectors don’t need to contain only numbers they can contain functions too but in this series we won’t get into those things and instead stick to numbers.
Now, lets get practical and try to create vectors in python.
Vectors in Python
We’ll be using:
numpyfor numerical operationsmatplotlibfor visualsmpl_toolkitsfor 3D visuals
Creating and Visualizing Vectors
Let’s start by importing our tools and creating some vectors:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3DThese imports give us everything we need. numpy handles our numerical work, matplotlib.pyplot creates our plots, and Axes3D from mpl_toolkits.mplot3d enables 3D plotting.
Now let’s create our vectors:
# 2-dimensional vector
v2 = [ 3, -2 ]
# 3-dimensional vector
v3 = [ 4, -3, 2 ]
# row to column (or vice-versa):
v3t = np.transpose(v3)
Here we’ve defined v2 as a 2-dimensional vector that goes 3 units in the x-direction and -2 units in the y-direction. Remember from our geometric interpretation that the negative sign means it goes down instead of up.
Similarly, v3 is our 3-dimensional vector: 4 units in x, -3 units in y, and 2 units in z.
The np.transpose() function converts between row and column vectors, just like those different notations we discussed earlier. This is useful when you need to switch between different vector representations.
Do not worry if you don’t understand about transpose we will understand this concept later. You don’t need to understand everything right now, we are just getting started you’ll understand very clearly as we understand more and more concepts.
Plotting the 2D Vector
Now let’s visualize our 2D vector:
# plot the 2D vector
plt.plot([0,v2[0]],[0,v2[1]])
plt.axis('equal')
plt.plot([-4, 4],[0, 0],'k--')
plt.plot([0, 0],[-4, 4],'k--')
plt.grid()
plt.axis((-4, 4, -4, 4))
plt.show()
What’s happening here? The first plt.plot([0,v2[0]],[0,v2[1]]) draws a line from the origin (0,0) to our vector’s endpoint (3,-2). This puts our vector in standard position, just like we discussed.
The plt.axis('equal') ensures our x and y axes have the same scale, so our vector isn’t distorted.
The next two plt.plot() lines draw the x-axis and y-axis as dashed black lines ('k--') to give us reference lines. These help us see exactly where our vector is pointing.
plt.grid() adds a grid for easier reading, and plt.axis((-4, 4, -4, 4)) sets our viewing window from -4 to 4 on both axes.
Plotting the 3D Vector
Now lets visualize our 3D vector:
# plot the 3D vector
fig = plt.figure(figsize=plt.figaspect(1))
ax = plt.axes(projection = '3d')
ax.plot([0, v3[0]],[0, v3[1]],[0, v3[2]],linewidth=3)
# make the plot look nicer
ax.plot([0, 0],[0, 0],[-4, 4],'k--')
ax.plot([0, 0],[-4, 4],[0, 0],'k--')
ax.plot([-4, 4],[0, 0],[0, 0],'k--')
plt.show()
First, we create a figure with square proportions using figaspect(1) so our 3D plot looks balanced.
The key line is ax = plt.axes(projection = '3d') which tells matplotlib we’re working in three dimensions now.
Then ax.plot([0, v3[0]],[0, v3[1]],[0, v3[2]],linewidth=3) draws our vector from the origin (0,0,0) to the point (4,-3,2). Notice how we specify three coordinates now, one for each dimension.
The last three ax.plot() lines draw our x, y, and z axes as dashed black lines, giving us reference axes just like we had in 2D. This makes it much easier to see how our vector extends in 3D space.
And that’s it! You’ve now created and visualized vectors in Python. I hope you now have clear understanding of what vector actually means both in terms of algebra and geometry.
In the next article, we will cover vector operations, till then happy learning. Good bye!

