Phase 01: Math Foundations

Vectors, Matrices & Operations

Every neural network is just matrix multiplication with extra steps. Build a Matrix class with element-wise operations, matrix multiplication, transpose, determinant, and inverse. Distinguish element-wise multiplication from matrix multiplication and explain when each applies. Implement a single dense neural network layer (relu(W @ x + b)) using only the from-scratch Matrix class. Explain broadcasting rules and how bias addition works in neural network frameworks. You want to build a neural network. You read the code and see this: That @ is matrix multiplication. The weights are a matrix. The input is a vector. If you do not know what those operations do, this line is magic. If you do know, it is the entire forward pass of a layer in three operations. Every image your model processes is a matrix of pixel values. Every word embedding is a vector. Every layer of every neural network is a matrix transformation. You cannot build AI systems without being fluent in matrix operations the same way you cannot write code without understanding variables. This lesson builds that fluency from scratch. A vector is a list of numbers with a direction and magnitude. In AI, vectors represent data points, features, or parameters. A 2D vector [3, 4] points to coordinates (3, 4) on a plane. Its length (magnitude) is 5 (the 3-4-5 triangle). A…

Vectors, Matrices & Operations: Every neural network is just matrix multiplication with extra steps. Build a Matrix class with element-wise operations, matrix…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.