No history yet

Vectors and Matrices

What Are Vectors?

Imagine you're giving someone directions. You wouldn't just say "go 5 miles." You'd say "go 5 miles north." That combination of a magnitude (5 miles) and a direction (north) is the core idea of a vector.

Vectors are mathematical objects that have both length and direction. They are often represented as arrows in space, where the arrow's length is the vector's magnitude and the way it points is its direction. In text, we typically write them as a list of numbers, called components, inside brackets. These components tell us how far the vector travels along each axis, like the x-axis and y-axis in a 2D plane.

For example, a vector in a 2D plane has two components: one for the x-direction and one for the y-direction. We usually write it as a column.

v=(xy)\vec{v} = \begin{pmatrix} x \\ y \end{pmatrix}

Here, xx tells you how many units to move horizontally, and yy tells you how many units to move vertically. A vector with components (3,2)(3, 2) points 3 units to the right and 2 units up.

Vector Operations

We can perform arithmetic with vectors, just like with regular numbers (which are called scalars in this context). The three basic operations are addition, subtraction, and scalar multiplication.

Vector addition is like taking two journeys back-to-back. The final vector represents the direct path from your starting point to your final destination.

To add vectors, we simply add their corresponding components. If we have two vectors, a\vec{a} and b\vec{b}, their sum is a new vector.

a=(a1a2),b=(b1b2)    a+b=(a1+b1a2+b2)\vec{a} = \begin{pmatrix} a_1 \\ a_2 \end{pmatrix}, \quad \vec{b} = \begin{pmatrix} b_1 \\ b_2 \end{pmatrix} \implies \vec{a} + \vec{b} = \begin{pmatrix} a_1 + b_1 \\ a_2 + b_2 \end{pmatrix}

Vector subtraction works similarly. Subtracting a vector is the same as adding its negative. A negative vector has the same length but points in the exact opposite direction.

Scalar multiplication involves multiplying a vector by a single number (a scalar). This operation scales the vector's length. If you multiply by 2, the vector becomes twice as long. If you multiply by 0.5, it becomes half as long. Multiplying by a negative scalar, like -1, reverses the vector's direction.

Lesson image

To perform scalar multiplication, you multiply each component of the vector by the scalar.

ca=c(a1a2)=(ca1ca2)c \cdot \vec{a} = c \begin{pmatrix} a_1 \\ a_2 \end{pmatrix} = \begin{pmatrix} c \cdot a_1 \\ c \cdot a_2 \end{pmatrix}

Introducing Matrices

If a vector is a list of numbers, a matrix is a grid of numbers, arranged in rows and columns. Matrices are incredibly useful for organizing data and representing transformations, like rotations or scaling.

A matrix's size, or dimension, is described by its number of rows and columns. A matrix with 2 rows and 3 columns is called a 2x3 matrix.

Lesson image

Here is an example of a 2x3 matrix:

A=(153402)A = \begin{pmatrix} 1 & -5 & 3 \\ 4 & 0 & -2 \end{pmatrix}

There are a few special types of matrices. The zero matrix is a matrix where every entry is 0. It's the matrix equivalent of the number zero.

O=(000000)O = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}

Another important one is the identity matrix. This is a square matrix (it has the same number of rows and columns) with 1s on the main diagonal (from top-left to bottom-right) and 0s everywhere else. The identity matrix, usually written as II, acts like the number 1 in multiplication. Multiplying a matrix by the identity matrix doesn't change it.

I=(100010001)I = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}

Matrix Operations

Like vectors, we can add and subtract matrices. The rule is simple: the matrices must have the exact same dimensions. If they do, you just add or subtract the corresponding elements in each position.

(abcd)+(efgh)=(a+eb+fc+gd+h)\begin{pmatrix} a & b \\ c & d \end{pmatrix} + \begin{pmatrix} e & f \\ g & h \end{pmatrix} = \begin{pmatrix} a+e & b+f \\ c+g & d+h \end{pmatrix}

Matrix multiplication is more complex. You can't just multiply corresponding elements. To multiply two matrices, the number of columns in the first matrix must equal the number of rows in the second matrix.

Let's say we have matrix AA (size m x n) and matrix BB (size n x p). Their product, C=ABC = AB, will be a matrix of size m x p. To find the element in the ii-th row and jj-th column of CC, you take the dot product of the ii-th row of AA and the jj-th column of BB. This means you multiply their corresponding entries and then sum the results.

For example, to get the element in the first row, first column of the result, you multiply the elements of the first row of matrix A by the elements of the first column of matrix B, and add them up.

A=(1234),B=(5678)AB=((15+27)(16+28)(35+47)(36+48))=(19224350)\begin{aligned} A &= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} \\ AB &= \begin{pmatrix} (1\cdot5 + 2\cdot7) & (1\cdot6 + 2\cdot8) \\ (3\cdot5 + 4\cdot7) & (3\cdot6 + 4\cdot8) \end{pmatrix} \\ &= \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix} \end{aligned}

One crucial property of matrix multiplication is that it's not commutative. This means that, in general, ABBAAB \neq BA. The order you multiply matrices in matters a great deal.

Ready to test your knowledge?

Quiz Questions 1/6

What two properties are essential for defining a vector?

Quiz Questions 2/6

What is the result of adding the vectors [32]\begin{bmatrix} 3 \\ 2 \end{bmatrix} and [15]\begin{bmatrix} 1 \\ 5 \end{bmatrix}?

Vectors and matrices are the alphabet of linear algebra. By understanding how to manipulate them, you're ready to explore more advanced and powerful concepts.