All courses

Intermediate · module I3 · Sublevel Beginner

Mathematics for AI

By the end: Calculate and interpret the key statistics, probabilities, vector operations and slopes that machine learning relies on

Start here
Covers
The statistics, probability, linear algebra and calculus ideas behind AI, each explained in words before any formula
Contents
4 chapters, 20 topics
Time
About 4 hours
Level
Intermediate
Your progress
0 / 20

This module builds on Python Programming for AI. We suggest looking at it first, but the choice is yours.

Chapter 1 Statistics

  1. 1.1

    Mean, Median and Mode

    Measures of the centre, and when each misleads

    Code: compare the measures on skewed data

    x̄ = Σxᵢ / n

    10 min Read
  2. 1.2

    Variance and Standard Deviation

    How spread out values are

    Code: compare two classes with the same mean

    σ² = Σ(xᵢ − x̄)² / n

    10 min Read
  3. 1.3

    Percentiles, Quartiles and Outliers

    Box plots and the 1.5 × IQR rule

    Code: find outliers in salaries

    IQR = Q3 − Q1

    8 min Read Activity
  4. 1.4

    Correlation

    Measuring how two variables move together, and why correlation is not causation

    Code: correlation heatmap

    r = cov(X,Y) / (σₓσᵧ)

    10 min Read
  5. 1.5

    Sampling and Hypothesis Testing

    Samples, confidence intervals, p-values and A/B tests

    Code: test whether a new study method helps

    t = (x̄ − μ₀) / (s / √n)

    12 min Read Activity

Chapter 2 Probability

  1. 2.1

    Probability Basics

    Events, outcomes and simple probability

    Code: simulate dice rolls

    For equally likely outcomes, P(A) = favourable outcomes / total outcomes

    10 min Read
  2. 2.2

    Conditional Probability

    Probability when we already know something

    Code: spam given a word

    P(A|B) = P(A∩B) / P(B)

    10 min Read
  3. 2.3

    Bayes' Theorem

    Updating a belief with new evidence, using a medical test example

    Code: the rare-disease test

    P(A|B) = P(B|A)P(A) / P(B)

    12 min Read
  4. 2.4

    Probability Distributions and the Normal Curve

    Uniform, binomial and normal distributions, and z-scores

    Code: simulate heights

    z = (x − μ) / σ

    12 min Read
  5. 2.5

    Entropy and Information

    Measuring uncertainty with entropy, cross-entropy and information gain

    Code: information gain for a decision-tree split

    H = −Σ p log₂ p

    10 min Read Activity

Chapter 3 Linear Algebra

  1. 3.1

    Vectors and Matrices

    How data becomes rows and columns of numbers

    Code: represent students as vectors

    10 min Read
  2. 3.2

    Vector Operations and the Dot Product

    Adding, scaling and comparing vectors

    Code: similarity between two users

    a·b = Σ aᵢbᵢ

    10 min Read
  3. 3.3

    Distance and Similarity

    Euclidean distance and cosine similarity

    Code: find the most similar document

    d = √Σ(aᵢ − bᵢ)²

    10 min Read
  4. 3.4

    Matrix Multiplication

    Combining tables, as every neural network layer does

    Code: a bill for many customers at once

    (AB)ᵢⱼ = Σ AᵢₖBₖⱼ

    10 min Read
  5. 3.5

    Eigenvalues and Eigenvectors

    Directions a matrix only stretches, and why PCA and PageRank use them

    Code: power iteration and a tiny PageRank

    Av = λv

    12 min Read Activity

Chapter 4 Calculus Intuition

  1. 4.1

    Functions and Graphs

    Inputs, outputs and the shape of a function

    Code: plot common functions

    8 min Read Activity
  2. 4.2

    Slope and the Derivative

    How fast a value changes, in pictures first

    Code: estimate a slope numerically

    f′(x) ≈ (f(x+h) − f(x)) / h

    10 min Read
  3. 4.3

    Gradients and Gradient Descent

    Walking downhill to make an error smaller

    Interactive: roll a ball to the bottom of a curve

    θ ← θ − η∇L

    12 min Read Activity
  4. 4.4

    Partial Derivatives and the Chain Rule

    Derivatives with many inputs, and the rule that powers backpropagation

    Code: check a chain-rule gradient numerically

    dy/dx = (dy/du)(du/dx)

    10 min Read Activity
  5. 4.5

    Module Review and Assessment

    Worked problems and a scored quiz

    Graded problem set

    15 min Read Activity