Starting from zero? Perfect. This guide introduces the essential mathematical concepts you'll need before diving into calculus and linear algebra. No prior math background requiredβjust curiosity.
A function is a rule that takes an input and produces an output. Think of it as a machine: you put something in, the machine does something to it, and you get something out.
Input Function Output
β β β
βΌ βΌ βΌ
βββββ βββββββββββ βββββ
β 3 β ββββββββΆ β Γ 2 + 1 β ββββββββΆ β 7 β
βββββ βββββββββββ βββββ
f(x) = 2x + 1
f(3) = 2(3) + 1 = 7
A function transforms inputs into outputs following a specific rule
The same input always gives the same output. If you put 3 into f(x) = 2x + 1, you'll always get 7. This predictability is what makes functions useful.
A neural network IS a function! It takes inputs (like an image) and produces outputs (like "cat" or "dog"). The entire goal of training is to find the right function that maps inputs to correct outputs. Everything in AI is about learning, representing, or applying functions.
In math, we use letters to represent numbers. This makes it easy to write general rules that work for any value.
A variable is a symbol (usually a letter) that can take different values. Think of it as a container that can hold any number.
x = 5 β x is a variable holding the value 5
y = x + 3 β y depends on x, so y = 8
x = 10 β now x is 10
y = x + 3 β and y = 13
A constant is a value that never changes. Famous constants include:
x, y, z β common variables
a, b, c β often constants or coefficients
n, m, k β often counts or indices
i, j β loop counters
ΞΈ (theta) β often parameters in AI
Ξ± (alpha) β often learning rate
+ addition
β subtraction
Γ, Β· multiplication (or just xy)
Γ·, / division
^, ** exponent (2Β³ = 8)
β square root
= equals
β not equal
β approximately equal
A graph is a visual representation of a function. It shows how the output changes as the input changes. Graphs are drawn on a coordinate plane.
y (vertical axis)
β
4 βΌββββββββββββββββββ’
β β±
3 βΌββββββββββββββ’
β β±
2 βΌββββββββββ’
β β±
1 βΌββββββ’
β β±
0 βΌββ’ββββββββββββββββββ x (horizontal axis)
0 1 2 3 4
This is f(x) = x + 1
When x = 0, y = 1
When x = 3, y = 4
Each point (x, y) shows an input-output pair
Linear (straight) Quadratic (curved) Exponential (growth)
y y y
β β± β β±β² β β±
β β± β β± β² β β±
ββ± β β± β² β β±
ββββββ x ββββ±βββββββ²βββ x ββββββ±βββββ x
ββ± β² β__β±
y = 2x y = xΒ² y = 2Λ£
AI uses graphs constantly: loss curves show how error decreases during training, activation functions are visualized as graphs, and decision boundaries separate classes in a coordinate space. Learning to read graphs is essential.
Rate of change tells you how fast something is changing. This is the core idea behind derivatives (which you'll learn in calculus), but let's start with intuition.
Speed is a rate of change: how fast your position changes over time.
Interest rate is how fast your money grows.
Learning rate in AI is how fast the model updates its knowledge.
To calculate rate of change, pick two points on a graph and measure how much the output (y) changes compared to the input (x):
Rate of change = (change in output) / (change in input)
y
β β’ B (4, 8) β Point B: x=4, y=8
β β±
β β±
β β± β rise = 8 - 2 = 6 (B's y minus A's y)
β β’ A (1, 2) β Point A: x=1, y=2
β ββββββ
β run = 4 - 1 = 3 (B's x minus A's x)
βββββββββββββββ x
Rate of change = rise / run = 6 / 3 = 2
This means: for every 1 unit x increases, y increases by 2
We measure from point A to point B to find the rate
Training a neural network means finding out: "If I change this weight, how does the error change?" That's a rate of change! The whole field of deep learning is built on computing these rates (called gradients) and using them to improve the model.
Algebra is about working with equationsβfinding unknown values and manipulating expressions. Here are the essential skills you'll need.
The goal: get the variable by itself on one side. Whatever you do to one side, do to the other.
2x + 5 = 13
Step 1: Subtract 5 from both sides
2x + 5 - 5 = 13 - 5
2x = 8
Step 2: Divide both sides by 2
2x / 2 = 8 / 2
x = 4
Check: 2(4) + 5 = 8 + 5 = 13 β
a(b + c) = ab + ac
Example:
3(x + 2) = 3x + 6
3x + 2x = 5x
4y - y = 3y
Example:
2x + 3 + 5x - 1 = 7x + 2
2 + 3 Γ 4Β² = ?
Step 1: Exponent first β 4Β² = 16
Step 2: Multiplication β 3 Γ 16 = 48
Step 3: Addition β 2 + 48 = 50
A vector is a quantity that has both magnitude (size) and direction. Think of it as an arrow pointing somewhere with a certain length.
SCALAR (just a number) VECTOR (number + direction)
"5" 5 units north
β
β
A scalar tells βββββ
you HOW MUCH
A vector tells you
HOW MUCH and WHERE
In math and AI, we represent vectors as lists of numbers. Each number represents a component in a different dimension.
2D Vector: [3, 4] 3D Vector: [1, 2, 3]
y y
β β
4 βΌββββββββ’ β β’ (1, 2, 3)
β β± ββ±
β β± βββββββββ x
β β± β±
βΌββββββββ x z
3
"Go 3 units right, "Go 1 right, 2 up,
then 4 units up" 3 forward"
For a 2D vector [x, y], the length is β(xΒ² + yΒ²).
Example: [3, 4] has length β(9 + 16) = β25 = 5
Why this formula? It's the Pythagorean theorem! The vector forms a right triangle, and the length is the hypotenuse: aΒ² + bΒ² = cΒ².
AI represents almost everything as vectors! A word becomes a 300-dimensional vector. An image becomes a vector of pixel values. Model parameters are stored in vectors. You'll work with vectors constantly in AI, so getting comfortable with them is essential.
Now that you have the foundations, continue building your math toolkit: