Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 1: Vectors and Linear Combinations
Linear Algebra

Foundations

  1. 01Start Here: Python and the Math the Labs Use
  1. 02Week 1: Vectors and Linear Combinations
  2. 03Week 2: Linear Transformations and Matrices
  3. 04Week 3: Elimination and LU Factorization
  4. 05Week 4: Determinants
  5. 06Week 5: Vector Spaces, Independence, and Basis
  6. 07Week 6: The Four Fundamental Subspaces
  7. 08Week 7: Orthogonality and Projections
  8. 09Week 8: Least Squares and QR
  9. 10Week 9: Eigenvalues and Eigenvectors
  10. 11Week 10: Diagonalization and Markov Matrices
  11. 12Week 11: Differential Equations
  12. 13Week 12: Symmetric and Positive Definite Matrices
  13. 14Week 13: The SVD and Complex Matrices
  14. 15Week 14: PCA, the Fourier Matrix and the FFT
Week 01· Linear Algebra6 min read

Week 1: Vectors and Linear Combinations

Two arrows leave the origin. Drag either tip.

u · v = 5.00. Projection scale of v onto u = 1.00. u + v = (3.0, 4.0).

The amber arrow is u=(2,1)u = (2, 1)u=(2,1). The teal arrow is v=(1,3)v = (1, 3)v=(1,3). The ink arrow is the diagonal u+vu + vu+v. The short ink mark on uuu is the projection of vvv onto uuu, and the readout under the picture is the scalar u⋅vu \cdot vu⋅v.

The tip of each arrow is an ordered pair. That pair is the vector once the standard basis of the plane is fixed. The same addition and the same dot product work in Rn\mathbb{R}^nRn by doing the arithmetic on every component. The picture stays in the plane, where you can see it.

Learning Outcomes
  • Add two arrows and read the diagonal of the parallelogram
  • Scale an arrow and say which way it points
  • Name a target in the plane as a linear combination of two non-parallel arrows
  • Compute a dot product and say when it is zero
Prerequisites

Background knowledge assumed:

  • Basic algebra (solving equations, working with variables)
  • Comfort with coordinate geometry in two and three dimensions

Recommended: Review the Course Index for an overview of the learning path.

Addition and scaling#

Addition is component-wise. With the arrows on the picture,

u+v=(21)+(13)=(34).u + v = \begin{pmatrix} 2 \\ 1 \end{pmatrix} + \begin{pmatrix} 1 \\ 3 \end{pmatrix} = \begin{pmatrix} 3 \\ 4 \end{pmatrix}.u+v=(21​)+(13​)=(34​).

Place the tail of vvv at the tip of uuu, or the other way around. The two routes close a parallelogram, and u+vu + vu+v is the diagonal. Drag a tip and the diagonal moves with it. That is the parallelogram law, and it is the same statement as u+v=v+uu + v = v + uu+v=v+u.

A scalar ccc multiplies every component.

2u=(42),−v=(−1−3).2u = \begin{pmatrix} 4 \\ 2 \end{pmatrix}, \qquad -v = \begin{pmatrix} -1 \\ -3 \end{pmatrix}.2u=(42​),−v=(−1−3​).

If c>1c > 1c>1 the arrow stretches. If 0<c<10 < c < 10<c<1 it shrinks. If c<0c < 0c<0 it reverses. The zero arrow is the origin, and it is the only arrow www with w+0=ww + 0 = ww+0=w.

Span in the plane#

A linear combination is c1v1+c2v2c_1 v_1 + c_2 v_2c1​v1​+c2​v2​ for real scalars c1c_1c1​ and c2c_2c2​. The span is every vector you can reach that way.

Take v1=(1,1)v_1 = (1, 1)v1​=(1,1) and v2=(1,−1)v_2 = (1, -1)v2​=(1,−1), and the target b=(4,2)b = (4, 2)b=(4,2). The equation c1v1+c2v2=bc_1 v_1 + c_2 v_2 = bc1​v1​+c2​v2​=b is the pair c1+c2=4c_1 + c_2 = 4c1​+c2​=4 and c1−c2=2c_1 - c_2 = 2c1​−c2​=2. Adding gives c1=3c_1 = 3c1​=3. Subtracting gives c2=1c_2 = 1c2​=1. Check 3(1,1)+1(1,−1)=(4,2)3(1, 1) + 1(1, -1) = (4, 2)3(1,1)+1(1,−1)=(4,2).

Those two arrows are not on the same line, so their span is the whole plane. Every target in R2\mathbb{R}^2R2 is some pair of scalars. If both arrows lie on one line through the origin, the span is only that line. Week 5 turns this picture into linear independence and bases.

span{v1, v2} is the whole plane v1 v2 3v1 b = 3v1 + v2

The span of two non-parallel vectors is the whole plane. The target bbb is assembled as 3v1+v23v_1 + v_23v1​+v2​.

The dot product#

The dot product is the scalar on the readout.

u⋅v=2⋅1+1⋅3=5.u \cdot v = 2 \cdot 1 + 1 \cdot 3 = 5.u⋅v=2⋅1+1⋅3=5.

In Rn\mathbb{R}^nRn the same sum runs over every component, x⋅y=∑ixiyix \cdot y = \sum_i x_i y_ix⋅y=∑i​xi​yi​. The length is ∥u∥=u⋅u\|u\| = \sqrt{u \cdot u}∥u∥=u⋅u​, so ∥u∥=5\|u\| = \sqrt{5}∥u∥=5​ and ∥v∥=10\|v\| = \sqrt{10}∥v∥=10​. The angle θ\thetaθ between the arrows satisfies

u⋅v=∥u∥ ∥v∥cos⁡θ,u \cdot v = \|u\| \, \|v\| \cos \theta,u⋅v=∥u∥∥v∥cosθ,

so cos⁡θ=5/50=1/2\cos \theta = 5 / \sqrt{50} = 1/\sqrt{2}cosθ=5/50​=1/2​ and θ=45∘\theta = 45^\circθ=45∘. The lab prints those three numbers.

The projection scale is (u⋅v)/(u⋅u)=5/5=1(u \cdot v) / (u \cdot u) = 5 / 5 = 1(u⋅v)/(u⋅u)=5/5=1. The projection of vvv onto uuu is 1⋅u1 \cdot u1⋅u, which is why the ink mark sits on the tip of the amber arrow until you drag.

If the scalar is zero, the arrows are orthogonal. For x=(1,2)x = (1, 2)x=(1,2) and y=(2,−1)y = (2, -1)y=(2,−1), x⋅y=0x \cdot y = 0x⋅y=0. Then

∥x+y∥2=∥x∥2+∥y∥2,\|x + y\|^2 = \|x\|^2 + \|y\|^2,∥x+y∥2=∥x∥2+∥y∥2,

because the cross term 2 x⋅y2\, x \cdot y2x⋅y drops out. That is Pythagoras in every Rn\mathbb{R}^nRn. The same idea returns in orthogonal projections (Week 7).

Knowledge Check#

Question 1 of 4

What is the length of the vector v = (3, 4)?

5
7
3.5
12

Browser lab: dot product, length, and angle#

The cell uses the same two arrows as the picture. Run it, then drag a tip and compute the new scalar by hand.

python · runs in browser
import numpy as np
import matplotlib.pyplot as plt

u = np.array([2, 1])
v = np.array([1, 3])

dot = np.dot(u, v)
length_u = np.linalg.norm(u)
length_v = np.linalg.norm(v)
cos_theta = dot / (length_u * length_v)
angle_deg = np.degrees(np.arccos(cos_theta))

print(f"u . v = {dot}")
print(f"|u| = {length_u:.3f}, |v| = {length_v:.3f}")
print(f"angle between u and v = {angle_deg:.1f} degrees")

fig, ax = plt.subplots(figsize=(5, 5))
ax.quiver(0, 0, u[0], u[1], angles="xy", scale_units="xy", scale=1, color="tab:blue", label="u")
ax.quiver(0, 0, v[0], v[1], angles="xy", scale_units="xy", scale=1, color="tab:orange", label="v")
ax.set_xlim(-1, 4)
ax.set_ylim(-1, 4)
ax.set_aspect("equal")
ax.legend()
ax.set_title("Vectors u and v")
plt.show()

Key takeaways#

  • Addition is the diagonal of the parallelogram.
  • Scaling stretches, shrinks, or reverses an arrow.
  • Two arrows that are not on the same line span the plane.
  • The dot product is one scalar. It is zero exactly when the arrows are orthogonal.

Further reading#

  • Gilbert Strang, Introduction to Linear Algebra (5th ed., Wellesley-Cambridge Press, 2016). Chapters 1 and 2.
  • David C. Lay, Steven R. Lay, and Judi J. McDonald, Linear Algebra and Its Applications (6th ed., Pearson, 2021). Chapter 1.
  • Stephen Boyd and Lieven Vandenberghe, Introduction to Applied Linear Algebra (Cambridge University Press, 2018). Chapters 1 to 3, free at vmls-book.stanford.edu.
  • 3Blue1Brown, Essence of Linear Algebra. The first two videos match this page.

Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.

← Previous
Start Here: Python and the Math the Labs Use
Next →
Week 2: Linear Transformations and Matrices
On this page
  • Addition and scaling
  • Span in the plane
  • The dot product
  • Knowledge Check
  • Browser lab: dot product, length, and angle
  • Key takeaways
  • Further reading