Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 2: From Scalars to Vectors to Matrices

Why do we need structure?

In Chapter 1, we said that data can be represented as numbers. But real-world data is rarely just a single number often it comes in groups.

To work with data effectively, we need a way to organize these numbers.

Scalar - a single value

A scalar is just one number.

Think of it as measuring one thing:

Vector - a list of values

A vector is a list of numbers.

Think of it as describing one object using multiple measurements.

For example, a person can be described by:

we combine them into one vector

x = [170, 65, 39]

A vector represents one data point with mutiple features.

Matrix - a table of values

A matrix is a table of numbers.

Think of it as many data points stacked together.

X = [
    [170, 65, 25],
    [180, 75, 30],
    [160, 55, 22]
]

Now We connect the three ideas:

Therefore we can now understand why data grows in structure from a single value to a list and a list to a table.