Chapter 1: Vectors and linear combinations

LA 00 Course Map | Next: LA 02 Dot Product Length and Angle

The big idea

A vector is a list of numbers that you are allowed to add and scale. Almost all of linear algebra comes from one question: if I add and scale a few vectors, what can I build?

In this chapter you will learn to
  1. Read and write vectors, and switch between the “arrow” picture and the “list of data” picture.
  2. Add vectors and multiply them by numbers, by hand and geometrically.
  3. Write one vector as a linear combination of others, and find the weights.
  4. Describe the span of a set of vectors (a line, a plane, or more).
  5. Decide whether vectors are linearly independent, and explain what that means.
Before you start

You only need school algebra: solving two equations in two unknowns, such as , . If you can do that, you are ready.


1.1 What is a vector?

Why we need them

Many things in the world need more than one number to describe them:

  • A point on a map needs two numbers: how far east, how far north.
  • A robot arm with three joints needs three angles.
  • A colour on a screen needs three numbers: red, green, blue.
  • A greyscale image is brightness values.

We want one object that holds all those numbers together, in a fixed order, so that we can do maths with the whole thing at once. That object is a vector.

The definition

Definition: vector

A vector with entries is an ordered list of real numbers. We write it as a column:

The numbers are the entries (or components). The set of all such vectors is called (“R-n”).

Let’s unpack each word.

  • “Ordered” means position matters. and are different vectors, the same way “3 east, 1 north” is a different place from “1 east, 3 north”.
  • ” entries” is the dimension of the space the vector lives in. lives in , the plane. lives in , ordinary 3-D space.
  • stands for the real numbers. means “pairs of real numbers”, means “triples”, and so on.

To save space in writing, people also write a vector on one line, such as . It means the same column. Later you will meet the transpose, , which really is a row; for now, treat as a shorthand for the column.

Two ways to picture a vector

You should get comfortable switching between these two pictures. Each one is good for different things.

Picture 1: an arrow. The vector is an arrow that starts at the origin and ends at the point 3 units right and 1 unit up.

  y
  2 |
  1 |        ● (3,1)
    |     _/
    |  _/
  0 +----------------- x
    0  1  2  3

The arrow has a direction (where it points) and a length (how long it is). This picture is wonderful in 2-D and 3-D, because you can draw it.

Picture 2: a record of data. The vector might hold the three joint angles of a robot arm, in radians. Nobody draws it as an arrow; it is just three numbers kept together.

This picture is the one you need in high dimensions. A 784-entry image vector cannot be drawn, but every rule you learn with 2-D arrows still works on it.

The habit to build

Learn each new idea with a 2-D arrow you can draw. Then trust that the same algebra works in any number of dimensions.

Equality

Two vectors are equal exactly when they have the same number of entries and every entry matches:

So one vector equation is really several ordinary equations, one per entry. Keep this in mind; you will use it constantly.

The zero vector

The vector with every entry equal to zero is the zero vector, written (sometimes ):

As an arrow it has no length and no direction: it is just the origin.


1.2 Adding vectors

The rule

Definition: vector addition

To add two vectors of the same size, add matching entries:

Worked example 1.1.

Worked example 1.2.

You cannot add vectors of different sizes. is not defined, just as you cannot add a map location to a colour.

What addition means: walking

Think of a vector as an instruction to walk: means “3 steps east, 1 step north”.

Adding means: follow , then from where you ended up, follow . The sum is where you finish.

           ● end = (2,3)
          /|
       v / |
        /  |
(3,1) ●    |   u = (3,1), then v = (-1,2)
     /     |
  u /      |
   /       |
  ●--------+
origin

This is the tip-to-tail rule: place the tail of at the tip of .

Why does it match the entry-by-entry rule? Walking east 3 and then east (that is, west 1) puts you at east . The east-west numbers simply add, and so do the north-south numbers. Each coordinate adds on its own.

The parallelogram

If you instead walk first and then , you finish at the same point, because (ordinary addition does not care about order). The two routes form the sides of a parallelogram, and is its diagonal.

Rules that addition obeys

These all follow directly from the same rules for ordinary numbers, entry by entry:

RuleFormulaIn words
commutativeorder does not matter
associativegrouping does not matter
zeroadding nothing changes nothing
negativewalking there and back returns you home

Here is the vector with every entry negated, for example . It points the opposite way with the same length.

Subtraction is adding the negative: .

Subtraction as “from to ”

is the arrow that goes from the tip of to the tip of . Check: start at , add , and you get .

With and : . If a robot’s hand is at and the target is at , then is exactly the move it must make.


1.3 Scaling vectors

The rule

Definition: scalar multiplication

To multiply a vector by a number (a scalar), multiply every entry by :

“Scalar” just means “a single ordinary number”, as opposed to a vector. The name comes from what it does: it scales.

Worked example 1.3.

What scaling means

Scalar Effect on the arrow
same direction, longer
same direction, shorter
unchanged
collapses to the zero vector
flips to the opposite direction, then stretches by

The important thing: scaling never turns a vector sideways. Every multiple lies on the same line through the origin as . We will use this fact many times.

Rules

RuleFormula
distributes over vectors
distributes over scalars
associative
one

Why is true? Look at one entry. On the left the entry is ; on the right it is . Those are equal by ordinary algebra. Since every entry matches, the vectors are equal. This “check one entry” argument proves all the rules in this chapter.


1.4 Linear combinations

Putting the two operations together

Now combine both operations. Take some vectors, scale each one, and add the results.

Definition: linear combination

A linear combination of the vectors is any vector of the form

where are scalars, called the weights (or coefficients).

The word “linear” signals that only these two operations are used. No squaring, no multiplying vectors together, no square roots.

Worked example 1.4. With , and weights , :

The recipe picture

A good way to think about it: the vectors are ingredients, and the weights are amounts.

Mixing paint

Suppose each paint is described by (red, green, blue) amounts per litre:

  • paint A (pure red)
  • paint B (pure blue)

Mixing 2 litres of A with 1 litre of B gives . Every colour you can mix is a linear combination of A and B. Notice you can never get any green, because neither ingredient has any. That observation is the seed of the idea of span in the next section.

The reverse question: finding the weights

The interesting question goes backwards: given a target vector, which weights produce it?

Worked example 1.5. Can we write as a combination of and ?

Step 1: write what we want. We need numbers with

Step 2: compute the left side. It equals .

Step 3: match entries (remember: one vector equation is several ordinary equations):

Step 4: solve. The second equation gives . Then the first gives .

Step 5: check. . Correct.

The key connection

Finding weights for a linear combination is the same thing as solving a system of linear equations. This link between vectors and equation systems is the backbone of the whole course. Chapter 4 (LA 04 Solving Linear Systems) gives a method that works for any size.

Worked example 1.6 (no solution). Can be written as a combination of and ?

Matching entries:

Multiply the first equation by 2: . But the second equation says the same left side equals 5. Since , there is no solution.

Why? Look at the ingredients: . Both point along the same line, so every combination stays on that line. The target is not on it.

Worked example 1.7 (many solutions). Write using the same , . The equations are and . The second is just twice the first, so we only really have one equation with two unknowns. Choose any , say , then . For example gives , and gives . Both equal . There are infinitely many ways.

These three examples show the only three possibilities: exactly one way, no way, or infinitely many ways. Chapter 4 explains why there is never “exactly two”.


1.5 Span: everything you can build

The definition

Definition: span

The span of vectors is the set of all their linear combinations:

Read the set notation as: “all vectors of the form , where the ‘s can be any real numbers.”

In the paint analogy, the span is every colour you could possibly mix.

So “is a linear combination of the ‘s?” and “is in the span of the ‘s?” are the same question.

What spans look like

Let’s build up one vector at a time, in .

One nonzero vector. The span of is all multiples . From section 1.3, all multiples lie on one line. So:

Two vectors pointing in different directions. Combinations can move along and along freely, so they sweep out a whole flat plane through the origin.

Two vectors on the same line. If , then . That is just a multiple of . The span is still only a line. The second vector added nothing new.

Three vectors in . If the third points out of the plane of the first two, the span is all of . If it lies in that plane, the span is still just the plane.

VectorsTypical spanException
one nonzero vectora linenone
two vectorsa planea line, if they are parallel
three vectors in all of a plane or line, if one is “redundant”

Two facts that always hold

  1. The span always contains the zero vector. Choose all weights equal to zero.
  2. The span always passes through the origin. That follows from fact 1. A line that misses the origin, such as , can never be a span.

Worked example 1.8. Is in the span of and ?

We need to equal . The first two entries force , . The third entry then must be . It is. So yes: .

Now try . The same first two entries force , , but then the third entry would be . So is not in the span. The span is a plane, and this point lies just off it.


1.6 Linear independence: spotting redundancy

Motivation

In section 1.5, sometimes adding a vector made the span bigger and sometimes it did nothing. A vector that adds nothing is redundant: it can already be built from the others. We want a precise test for this.

The definition

Definition: linear independence

Vectors are linearly independent if the only way to make the zero vector from them is to use all-zero weights:

Otherwise they are linearly dependent.

Why this definition captures “no redundancy”

The definition looks strange at first: why talk about making zero? Here is the reasoning.

Suppose some vector is redundant, say . Move everything to one side:

That is a way to make zero with weights , which are not all zero. So redundancy produces a nonzero recipe for zero.

It works the other way too. If with, say, , divide by and rearrange:

so is built from the others: it is redundant.

So “some vector is redundant” and “zero can be made with nonzero weights” mean exactly the same thing. The zero-based definition is preferred because it treats all the vectors equally, and it turns the question into a system of equations we can solve.

How to test for independence

  1. Write .
  2. Turn it into equations, one per entry.
  3. Solve. If the only solution is all zeros, the vectors are independent. If any other solution exists, they are dependent.

Worked example 1.9. Are and independent?

. The second entry gives ; then the first gives . Only the zero solution: independent.

Worked example 1.10. Are and independent?

, so with weights . A nonzero recipe for zero exists: dependent.

Worked example 1.11. Are , , independent?

Set :

From the first two, and . Substitute into the third: , which is , always true. So can be anything. Take : then , and indeed , that is . Dependent.

Quick tests you can do in your head

  • Two vectors are dependent exactly when one is a multiple of the other.
  • Any set containing the zero vector is dependent: is a nonzero recipe.
  • Too many vectors: more than vectors in are always dependent. For example, any 3 vectors in are dependent. (Chapter 5 proves this.)
Independence is about the whole set

Three vectors can be dependent even when no two of them are multiples of each other, as example 1.11 shows. Checking pairs is not enough.


1.7 The standard basis

In there are three especially simple vectors:

Each has a single 1 and zeros elsewhere. They point along the , and axes.

Every vector is a combination of them, and the weights are just its entries:

They have two properties:

  1. They span : everything can be built.
  2. They are independent: none can be built from the other two.

A set with both properties is called a basis. Spanning means “enough vectors”; independence means “no wasted vectors”. So a basis is a minimal, complete set of building blocks.

The standard basis is not the only basis. and also form a basis of . Choosing a clever basis is often the key to solving a problem, and that is the subject of LA 11 Change of Basis.


Summary

IdeaMeaningHow to compute or test
vectorordered list of numberswrite as a column
additionwalk one, then the otheradd matching entries
scalingstretch, shrink or flipmultiply every entry
linear combinationscale, then add
finding weightswhich recipe makes ?match entries, solve the equations
spaneverything you can builda line, plane, … through the origin
independentno redundant vectoronly the zero recipe makes
basisspans, and independente.g.

Three facts to remember:

  1. A vector equation is a system of ordinary equations, one per entry.
  2. A span always passes through the origin.
  3. Redundancy means a nonzero recipe for the zero vector.

Exercises

Work in order. Part A builds fluency, B builds understanding, C asks for short proofs, D connects to code. Try every question before opening its solution.

Part A: warm-up

A1. Compute .

A2. Compute .

A3. Find and if .

A4. A robot hand is at metres and must move to . What displacement vector does it need?

A5. Simplify .

Part B: core

B1. Write as a linear combination of and .

B2. Is in the span of and ? If so, give the weights.

B3. Is in the span of and ?

B4. Decide whether each set is independent:
(a)
(b)
(c)

B5. For which value of are and dependent?

B6. Describe geometrically the span of and in .

B7. Give three different vectors in the span of and .

Part C: explain and prove

C1. Prove that for vectors in .

C2. Prove that any set of vectors containing the zero vector is linearly dependent.

C3. Suppose and are independent. Prove that and are also independent.

C4. Explain in your own words why the span of any set of vectors must contain the origin, and why the line is therefore not a span.

C5. True or false, with a reason: “If is not a multiple of , and not a multiple of , then are independent.”

Part D: practise with code

Use Python with NumPy (import numpy as np).

D1. Create u = np.array([3, 1]) and v = np.array([-1, 2]). Compute u + v, 2 * u, and u - v, and check them against your hand calculations from this chapter.

D2. Write a function combo(weights, vectors) that returns the linear combination . Test it on worked example 1.4.

D3. Generate 1000 random weight pairs c1, c2 from , compute c1 * (1, 0, 1) + c2 * (0, 1, 1), and plot the points in 3-D with Matplotlib. What shape do you see, and which section explains it?

D4. NumPy can test independence with np.linalg.matrix_rank. Put vectors as columns of a matrix (np.column_stack([u, v, w])). If the rank equals the number of vectors, they are independent. Test the three sets in exercise B4.


Where this is used

  • Robot configurations. A robot’s joint angles form a vector ; a motion is a displacement (02 Geometry and Kinematics).
  • Neural networks. The output of a linear layer is a linear combination of its weight columns, with the inputs as weights (05 Training Neural Policies).
  • Data. If one feature in a dataset is a combination of others (for example “total = part A + part B”), the features are dependent, and a regression has no unique answer. Chapter 6 deals with this.

Next: LA 02 Dot Product Length and Angle, where we measure lengths and angles between vectors.