Maths and Stats for Modern Tech
Linear Algebra
The Language of Data
Linear algebra is the mathematics of data. It gives us a way to organize and manipulate information, from a simple list of numbers to a complex dataset with millions of points. The two most basic building blocks are vectors and matrices.
Linear algebra deals with vectors, matrices, and linear transformations - all essential tools for expressing and manipulating data, solving equations, and calculating geometric transformations.
At its core, a vector is just an ordered list of numbers. You can think of it as a point in space or an arrow pointing from the origin to that point. For example, the vector represents a point that is 2 units to the right and 3 units up from the origin in a 2D plane.
In data science, a vector could represent a user's preferences, the features of a house, or the pixel values in a single row of an image. The collection of all possible vectors of a certain type (like all possible 2D vectors) forms a vector space. It's the universe where our data points live.
Organizing Data with Matrices
If a vector is a list of numbers, a matrix is a grid of numbers, arranged in rows and columns. You can think of it as a collection of vectors stacked together. For instance, a grayscale image can be represented as a matrix where each number is the brightness of a pixel.
This is a 2x3 matrix because it has 2 rows and 3 columns. Matrices are incredibly useful for storing datasets where rows might be individual samples (like different houses) and columns are features (like number of bedrooms, square footage, etc.).
Square matrices (those with the same number of rows and columns) have a special property called the determinant. The determinant is a single number that tells us about the matrix. For a 2x2 matrix, it's simple to calculate.
The determinant reveals how a matrix transformation scales area. A determinant of 2 means the matrix doubles the area of any shape it transforms. A determinant of 0 means the matrix squashes space down into a lower dimension, like collapsing a square into a line.
Transforming Space
The most powerful idea in linear algebra is that matrices can act on vectors to change them. This action is called a linear transformation. It can rotate, stretch, shear, or flip vectors, but it has one key rule: grid lines must remain parallel and evenly spaced, and the origin must stay put.
Every linear transformation can be described by a matrix. When we multiply a matrix by a vector, we are applying that matrix's transformation to the vector, resulting in a new vector.
Matrix multiplication is how we perform transformations. A matrix holds the instructions, and a vector is what gets transformed.
This is fundamental to computer graphics, where objects are moved and resized by applying transformation matrices to the vectors that define their shapes.
The Unchanging Vectors
For any given transformation, there are often special vectors that don't change their direction. When the transformation is applied, these vectors only get stretched or shrunk; they stay on the same line through the origin. These are called eigenvectors.
eigenvector
noun
A nonzero vector that changes only by a scalar factor when a linear transformation is applied to it.
The factor by which an eigenvector is scaled is its corresponding eigenvalue. If an eigenvector has an eigenvalue of 2, it means the transformation doubles its length. If the eigenvalue is -0.5, it halves its length and flips its direction.
This equation says it all: applying the transformation matrix to its eigenvector has the same effect as just multiplying by a simple number, the eigenvalue .
Eigenvectors and eigenvalues are the soul of a matrix. They reveal the fundamental directions along which the transformation acts purely as a scaling. This concept is critical in many areas, including Principal Component Analysis (PCA), a technique used to reduce the dimensionality of data by finding the directions of maximum variance, which happen to be the eigenvectors.
In the context of linear algebra, what is a vector?
What does the determinant of a square matrix reveal about its corresponding linear transformation?
Understanding these core ideas—vectors, matrices, transformations, and eigenvectors—provides the foundation for working with data in a huge number of fields.