Interactive Lab 01

The World as Numbers

A guided computational lab for the first chapter of a story-driven linear algebra book. Students translate real objects into vectors, test what is gained and lost, and discover why high-dimensional data needs geometry.

Central idea

Linear algebra begins when we decide that something in the world can be represented by a list of numbers.

object → features → vector → geometry → computation
height
price
pixels
words
ratings
signals

1. From world to vector

A vector is not only an arrow. In data science, a vector is often a compact description of an object. The choice of features is the first mathematical act.

Object

A student, image, house, song, patient, document, or city.

Features

Measurable quantities selected by a human, model, or sensor.

Vector

An ordered list such as [2.1, 4.7, 0, 13].

Student task. Write one object from your own life and list five possible features. Then identify one feature that is useful and one that may be misleading.

2. Build a vector from a real object

Change the features below. The object becomes a point in a small feature space. Notice that the numbers are meaningful only because we chose meanings for the coordinates.

Coffee shop representation

Teaching note

This example lets students see that a feature vector is a modeling decision. The same shop can become a 2D, 4D, or 100D vector depending on the question.

3. Similarity becomes geometry

Once objects become vectors, we can ask geometric questions: Which two objects are close? Which object is unusual? Which group forms a cluster?

Move point B

horizontal change
vertical change
Euclidean distance
distance = sqrt((x_B - x_A)^2 + (y_B - y_A)^2)

4. The danger of units and scale

A distance formula does not know whether one coordinate is dollars, minutes, pixels, or kilograms. Large-scale features can dominate the geometry.

Three apartments

ApartmentRentDistanceSize
A$21008 min650 sq ft
B$24006 min720 sq ft
C$220026 min680 sq ft

5. Images are matrices before they become vectors

A grayscale image is a grid of numbers. Flattening the grid creates a vector. This is one reason linear algebra is everywhere in image processing and machine learning.

Student task. Increase the grid size. Why does a small image already become a high-dimensional vector?

6. Text can also become vectors

A document can be represented by word counts. This is a simple version of the idea behind text embeddings: language is translated into coordinates.

vocabulary size
dot product
cosine similarity
Why cosine similarity?

Word-count vectors can be longer simply because a document has more words. Cosine similarity focuses on direction rather than length, so it often captures topical similarity better than raw distance.

7. High-dimensional geometry feels different

Modern data often has many coordinates: pixels, gene expressions, words, ratings, sensor readings. This activity samples random points and shows how distances behave as dimension grows.

nearest pair
average distance
farthest pair
Student task. Compare dimension 2, 20, and 200. What happens to the spread of pairwise distances?

8. Reflection and AI companion prompts

Reflection questions

  1. What information is lost when an object becomes a vector?
  2. When can distance be misleading?
  3. Why might scaling be necessary before clustering or prediction?
  4. What makes high-dimensional data both powerful and dangerous?

AI companion prompts

Explain feature vectors using a real example from medicine.

Give me three bad feature choices for comparing colleges.

Create a tiny dataset where scaling changes the nearest neighbor.

Explain why a 100 × 100 image is a 10,000-dimensional vector.

Instructor notes

This page can be used as an in-class demonstration, a companion to the Chapter 1 notebook, or a standalone online activity. Suggested pacing: 10 minutes for feature vectors, 10 minutes for distance and scaling, 10 minutes for image/text representations, and 10 minutes for high-dimensional intuition and discussion.

Learning outcomes
  • Explain that a vector is an ordered list of meaningful features.
  • Compute and interpret simple distances and dot products.
  • Identify why units and scaling matter.
  • Recognize images and documents as numerical objects.
  • Describe one basic phenomenon of high-dimensional geometry.
Suggested extension

Ask students to modify the Jupyter notebook so that their own dataset becomes a matrix: rows are objects, columns are features. Then ask them to normalize columns and compare nearest neighbors before and after normalization.