← Lesson
BitWithBite
AI & Machine Learning · Quick Reference

Scalars, Vectors & Matrices Cheat Sheet

AI & Machine Learning
In one line: Here's the honest motivation before any notation: every piece of data a machine learning model touches gets turned into numbers, and those numbers get organized into vectors and...

Key Ideas

1Why Bother With Linear Algebra At All?. Here's the honest motivation before any notation: every piece of data a machine learning model touches gets turned into numbers, and those numbers get organized into v...
2The Three Building Blocks 🔢 Scalar Just a single number. The temperature outside (72), a price ($19.99), a single test score (88). No direction, no structure — just a value. ➔ Vector An ordered list of numbers. A house described by [1800 sqft, 3 bedrooms, 2 bathrooms] is a vector with 3 numbers — one "feature" per position. 📊 Matrix A grid of numbers — rows and columns. A dataset of 100 houses, each with 3 features, is a 100×3 matrix: 100 rows, 3 columns. 💡 A simple way to keep these straight: a scalar has zero dimensions (just a value), a vector has one dimension (a line of numbers), and a matrix has two dimensions (rows and columns). Later in Tier 3, you'll meet "tensors," which just extend this idea to three or more dimensions — same concept, more dimensions. Section 3 Vectors, Concretely. Say you're describing a house for a price-prediction model (the exact project you'll build in Module 7). You might represent it as:
3Matrices, Concretely. Now imagine 100 houses, not just one. Stack their vectors into rows, and you get a matrix:
4Matrix Shape — A Habit Worth Building Now. ML practitioners constantly talk about a matrix's shape — written as (rows, columns). Getting comfortable reading shapes now will save you real debugging time la...

Code Examples

sqft beds baths age House 1: 1800, 3, 2, 15 House 2: 2400, 4, 3, 5 House 3: 1100, 2, 1, 40 ... House 100: ... ... ... ...