AI MATH 101
ai-math-101 · v1.0.0
ivyx✓
Add, scale and multiply vectors and matrices with nothing but Python lists, and say what shape comes out before you run anything. The math under every model, written by hand so it has nowhere to hide.
What this course is for
By the end of this course you can add, scale and multiply vectors and matrices with nothing but Python lists, and say what shape comes out before you run anything.
What you will be able to do
- Represent grades, points and word counts as vectors and say what each position means
- Implement vector addition, scaling and the dot product with plain loops
- Choose between distance and cosine similarity for a given question, and defend the choice
- State a matrix's shape as (rows, cols) and refuse ragged data
- Implement matrix-vector and matrix-matrix multiplication and prove the shape rule (a,b) @ (b,c) -> (a,c)
Who it is for
Learners who finished PYTHON 101 and want the math under AI without a library hiding it, and engineering students who want linear algebra to be something they once built by hand
Before you start
- PYTHON 101, or comfort with loops, lists and functions
- No math beyond school arithmetic
Lesson path
Ordered numbers with meaning, and the arithmetic they earn
- 1A list with a direction30 min
Represent real things (grades, a point, word counts) as vectors
- 2Adding and scaling30 min
Implement vector addition and scalar multiplication with a loop
- 3The dot product30 min
Compute it by hand and read it as how much two vectors agree
- 4Distance and similarity40 min
Use norm and cosine to say which of two vectors is closer, and defend the metric
Vectors stacked into rows, and the multiplication that runs AI
- 5Rows of vectors30 min
Build a matrix as a list of lists and state its shape as (rows, cols)
- 6Matrix times vector30 min
Implement matvec as one dot product per output entry
- 7Matrix times matrix45 min
Implement matmul with three loops and prove the (a,b) @ (b,c) -> (a,c) shape rule
About this course
AI MATH 101: Vectors and matrices, by hand
Seven lessons that build the mathematics under every AI model out of plain Python lists and loops. Vectors, the dot product, distance and cosine similarity, matrix shapes, matrix-times-vector and finally matrix-times-matrix. Each one is written by hand before any library gets to hide it. Nothing needs installing; the whole course runs on the standard library, on purpose.
How this course teaches
The tutor works the way PYTHON 101 taught you: it asks what a cell will do before you run it, then puts your answer next to the real output. Cells with a prediction box keep their run button shut until you have committed to an answer. When you are stuck, hints arrive on a ladder: a nudge, then the concept, then the steps, and finally an explanation of why your version fails, in words. The last step never hands over the code; the typing is yours, because the typing is the part that sticks.
Several cells here run and print tidy, confident, wrong answers: a scale function that repeats instead of multiplying, a shape report that trusted one row, a matmul that only worked because the test matrix was symmetric. Learning to distrust a clean printout is not a side effect of this course. It is a goal.
If you have not used the tutor before, PYTHON 101's fifteen-minute lesson 0 ("Working with the tutor") teaches it on itself.
What you will be able to do
- Represent grades, points and word counts as vectors and say what each position means
- Implement vector addition, scaling and the dot product with plain loops
- Choose between distance and cosine similarity for a given question, and defend the choice
- State a matrix's shape as (rows, cols) and refuse ragged data
- Implement matvec and matmul and prove the shape rule (a,b) @ (b,c) -> (a,c)
The lessons
Vectors
- A list with a direction
- Adding and scaling
- The dot product
- Distance and similarity
Matrices 5. Rows of vectors 6. Matrix times vector 7. Matrix times matrix
Where this course sits
This is the first mathematics course of the ivyx AI series, directly after
PYTHON 101. The matmul you write here with three nested loops becomes a single
character (a @ b) in numpy-101, where you will time the two against each
other. And the cosine similarity you build in lesson 4 is, unchanged, how
sentence similarity is computed on embeddings at the far end of the series.
ai-math-102 picks up the other half of the foundation: chance, averages
and slopes.