Functions & Graphs
P2.math-foundations.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Numbers & Computer Representations
Where next?
Later in Mathematics Foundations
This module unlocks
P2.math-foundations.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Numbers & Computer Representations
Later in Mathematics Foundations
This module unlocks
A function is simply a rule that turns one number into another: you give it an input, it gives back an output. That is the whole idea, and it is the single most important tool in this tutorial. Every transformation inside a Transformer — the embedding lookup, attention, the feed-forward layer — is a function, and a small family of special functions (ReLU, sigmoid, tanh, softmax) shapes numbers at every layer. This module explains what functions are, how we picture them as graphs, and how chaining them together builds the entire model.
A function is a rule that turns one number (or set of numbers) into another. You give it an input, it hands back an output. That is all it is. You already use functions every day:
In mathematics we write f(x) = some rule. The letter x is the input; f(x) is the output.
Why it matters — Every transformation inside the Transformer is a function. The embedding lookup, the dot-product attention, the feed-forward layer — each is a function that takes a vector as input and returns a vector as output.
Three everyday functions, side by side over inputs from −3 to 3: f(x) = x² (a bowl-shaped curve), g(x) = 2x + 1 (a straight line), and h(x) = the absolute value of x (a V-shape). Each takes the same input and produces its own output.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Loading your notes...