Vectors

Vectors as quantities with magnitude, direction, and coordinates.

A vector is an ordered list of numbers. In two dimensions, the vector \(\langle 3,4\rangle\) can mean “move 3 units right and 4 units up.” The same vector can also represent a point, a velocity, a force, a row of data, or a pair of unknowns. Linear algebra starts with vectors because they let us talk about many related numbers as one object.

What you should be able to do

By the end of this lesson, you should be able to:

  • read vectors as coordinate lists and as arrows in the plane;
  • add vectors and multiply vectors by scalars;
  • compute vector length using the distance formula;
  • compute a dot product;
  • explain why a zero dot product means perpendicular vectors;
  • verify vector calculations with edumath, NumPy, and SymPy.

Coordinates, arrows, and movement

A vector in two dimensions is often written

\[ \mathbf{v}=\begin{bmatrix}a\\b\end{bmatrix} \quad \text{or} \quad \langle a,b\rangle. \]

The first coordinate tells horizontal movement. The second coordinate tells vertical movement. The vector \(\langle 3,4\rangle\) can be drawn as an arrow from \((0,0)\) to \((3,4)\).

NoteCoordinate reminder

The ordered pair \((3,4)\) names a point. The vector \(\langle 3,4\rangle\) names a movement or displacement. They are drawn in similar places, but the vector idea emphasizes direction and length.

Vector addition

To add vectors, add matching coordinates:

\[ \begin{bmatrix}a\\b\end{bmatrix} + \begin{bmatrix}c\\d\end{bmatrix} = \begin{bmatrix}a+c\\b+d\end{bmatrix}. \]

Geometrically, vector addition means doing one movement and then the other. For example,

\[ \begin{bmatrix}3\\1\end{bmatrix} + \begin{bmatrix}-2\\4\end{bmatrix} = \begin{bmatrix}1\\5\end{bmatrix}. \]

You moved 3 right and 1 up, then 2 left and 4 up. The total movement is 1 right and 5 up.

Scalar multiplication

A scalar is a single number. Scalar multiplication stretches, shrinks, or flips a vector:

\[ 3\begin{bmatrix}2\\-1\end{bmatrix} = \begin{bmatrix}6\\-3\end{bmatrix}. \]

If the scalar is negative, the vector reverses direction. If the scalar is between 0 and 1, the vector gets shorter.

Length of a vector

The length of a vector is also called its norm or magnitude. In two dimensions,

\[ \lVert \mathbf{v} \rVert = \sqrt{a^2+b^2} \quad \text{for} \quad \mathbf{v}=\langle a,b\rangle. \]

This is the Pythagorean theorem. The vector \(\langle 3,4\rangle\) makes a right triangle with legs 3 and 4, so its length is

\[ \sqrt{3^2+4^2}=\sqrt{9+16}=\sqrt{25}=5. \]

Dot products

The dot product combines two vectors and returns one number:

\[ \langle a,b\rangle \cdot \langle c,d\rangle = ac+bd. \]

Example:

\[ \langle 1,2\rangle \cdot \langle 3,4\rangle = 1\cdot 3 + 2\cdot 4 = 11. \]

The dot product is not just arithmetic. It measures how much two vectors point in the same direction.

  • A positive dot product means the vectors point generally the same way.
  • A negative dot product means they point generally opposite ways.
  • A zero dot product, for nonzero vectors, means they are perpendicular.
WarningCommon pitfall

A dot product produces a scalar, not a vector. Do not write \(\langle 1,2\rangle \cdot \langle 3,4\rangle = \langle 3,8\rangle\). Multiplying matching coordinates is only the first step; you must add the products.

Worked example: compare two vectors

Let \(\mathbf{u}=\langle 2,1\rangle\) and \(\mathbf{v}=\langle -1,2\rangle\).

  1. Add them: \[ \mathbf{u}+\mathbf{v}=\langle 2+(-1),1+2\rangle=\langle 1,3\rangle. \]
  2. Find the length of \(\mathbf{u}\): \[ \lVert \mathbf{u}\rVert=\sqrt{2^2+1^2}=\sqrt{5}. \]
  3. Compute the dot product: \[ \mathbf{u}\cdot\mathbf{v}=2(-1)+1(2)=0. \]
  4. Interpret: because the dot product is zero and neither vector is the zero vector, the vectors are perpendicular.

Practice exercises

Try these before opening the solutions.

  1. Compute \(\lVert \langle 6,8\rangle \rVert\).
  2. Compute \(\langle 1,0\rangle \cdot \langle 0,1\rangle\).
  3. Add \(\langle -2,5\rangle + \langle 4,-1\rangle\).
  4. Multiply \(-2\langle 3,-4\rangle\).
  5. Are \(\langle 3,1\rangle\) and \(\langle -1,3\rangle\) perpendicular?
  1. \(\sqrt{6^2+8^2}=\sqrt{100}=10\).
  2. \(1\cdot 0+0\cdot 1=0\).
  3. \(\langle 2,4\rangle\).
  4. \(\langle -6,8\rangle\).
  5. Yes. The dot product is \(3(-1)+1(3)=0\).

Subtopic guided practice and checkpoints

Vectors become easier when you separate three ideas: coordinates tell movement, length measures size, and dot products compare directions.

Lab 1: read a vector as movement

Guess first. Does the vector <-2, 5> move right or left? Up or down?

Guided exercise.

Read the coordinates in order:

  1. The first coordinate is -2, so the horizontal movement is 2 units left.
  2. The second coordinate is 5, so the vertical movement is 5 units up.
  3. The vector can be drawn from any starting point, but its movement is always “left 2, up 5.”

Checkpoint. Describe the movement of <4, -3> in words. Then say where the arrow ends if it starts at (0,0).

Lab 2: add vectors coordinate by coordinate

Guess first. If one vector moves right and another moves left, can their horizontal parts cancel?

Guided exercise.

Add <3, -1> + <-5, 4> by matching positions:

horizontal:  3 + (-5) = -2
vertical:   -1 + 4    = 3

So

<3, -1> + <-5, 4> = <-2, 3>

The result means the combined movement is 2 units left and 3 units up.

Checkpoint. Compute <6, 2> + <-1, -7> and explain which coordinate changed direction.

Lab 3: scale a vector without mixing coordinates

Guess first. What does a negative scalar do to the direction of a vector?

Guided exercise.

Compute -3<2, -4> by multiplying every coordinate:

-3<2, -4> = <-6, 12>

Because the scalar is negative, the vector points in the opposite direction from the original vector.

Checkpoint. Compute (1/2)<8, -6> and describe how the length changes.

Lab 4: compute length with the Pythagorean theorem

Guess first. Is the length of <5, 12> closer to 12, 13, or 17?

Guided exercise.

Use the norm formula:

length of <5, 12> = sqrt(5^2 + 12^2)
                  = sqrt(25 + 144)
                  = sqrt(169)
                  = 13

Length is never negative. It measures distance from the tail of the arrow to the tip.

Checkpoint. Find the length of <-8, 15>.

Lab 5: use the dot product to compare directions

Guess first. If the dot product of two nonzero vectors is 0, are the vectors pointing the same way, opposite ways, or perpendicular?

Guided exercise.

Let u = <4, 1> and v = <-1, 4>. Then

u dot v = 4(-1) + 1(4) = 0

The zero dot product tells us these nonzero vectors are perpendicular.

Checkpoint. Compute <2, 3> dot <5, -1>. Are the vectors perpendicular?

  1. <4, -3> moves right 4 and down 3. Starting at (0,0), it ends at (4,-3).
  2. <6, 2> + <-1, -7> = <5, -5>. The vertical coordinate changed from positive to negative.
  3. (1/2)<8, -6> = <4, -3>. The vector points the same direction and has half the length.
  4. sqrt((-8)^2 + 15^2) = sqrt(289) = 17.
  5. The dot product is 2(5) + 3(-1) = 7, so the vectors are not perpendicular.

Vector guessing game

Guess lengths, dot products, and perpendicular relationships. If you miss a question, read the feedback and connect it to the formula.

Using this lesson with edumath and SymPy

Use the visible code below to reproduce the main computations. In a browser, these examples can also be adapted for PyScript/Pyodide because they use normal Python packages.

from edumath.linear_algebra import dot_product, vector_add, vector_norm

u = [2, 1]
v = [-1, 2]

print(vector_add(u, v))
print(vector_norm(u))
print(dot_product(u, v))
[1. 3.]
2.23606797749979
0.0
import sympy as sp

u = sp.Matrix([2, 1])
v = sp.Matrix([-1, 2])

print(u + v)
print(sp.sqrt(u.dot(u)))
print(u.dot(v))
Matrix([[1], [3]])
sqrt(5)
0