Courses / Data, AI & infrastructure / Mathematics for Programmers: Discrete and Applied Foundations

Free courseSelf-paced

Mathematics for Programmers: Discrete and Applied Foundations

Build a tested Python notebook of discrete and applied maths models, covering logic, counting, number representation, graphs, matrices, probability, numerics and optimisation.

  • Who it's for. Programmers who can write short Python functions and want the maths behind algorithms, data and machine learning.
  • Before you start. Completion of Programming Problem Solving (language-neutral: tracing, invariants, loops, simple collections) or equivalent.
  • 35 to 60 hours of study with practice
  • 10 modules, 58 lessons
  • 5 guided projects and a final project

What you'll learn

  • Evaluate Boolean formulas by exhaustive enumeration, use quantifiers and set algebra correctly, and write proofs by direct argument, contradiction and induction that meet a written checklist.
  • Count arrangements, selections and distributions with product, sum, binomial, stars-and-bars, inclusion-exclusion and recurrence arguments, each cross-checked by brute force.
  • Prove and apply basic graph facts (handshake lemma, trees, bipartiteness, DAG ordering, Euler trails) with executable checks.
  • Explain binary64 rounding, compare floats safely, choose exact types when needed, and apply bisection, Newton's method and the trapezoid rule with stated error behaviour.
  • Deliver a notebook of executable models with tests, a proof section and a reproducible run, optionally ported to Math.js against shared test vectors.

Skills you'll gain

  • Logic
  • sets
  • proof technique
  • Functions
  • relations
  • orders
  • Counting
  • combinatorics
  • Integers
  • modular arithmetic
  • number representation
  • Graphs
  • discrete structures
  • Vectors

Tools you'll use

  • Python 3
  • Math.js (optional module)
  • JavaScript (optional module)

Details to know

  • Certificate on completionIssued after your final project is reviewed
  • 10 module checkpointsA quiz and a practical task close each module
  • Self-pacedStudy any time; your progress is saved

How every lesson works

Each lesson follows the same four steps, so you always know what comes next.

  1. 01

    Watch & Learn

    A short animated video explains one idea at a time.

  2. 02

    Guided Practice

    Work through an example step by step and check the result.

  3. 03

    Quiz & Challenge

    Short questions check the idea has landed before you move on.

  4. 04

    Mini Project

    Build something useful from a project brief.

Learn at your own pace

This is a self-paced course. There are no live classes and no fixed timetable.

  • Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
  • Pick up where you left offYour progress is saved to your account.
  • Ask when you're stuckUse Ask Mentor inside the learning platform.

Your path in 3 phases

Each phase ends with something you have built and checked.

  1. 01

    Modules 1 to 3

    Logic, relations and counting

    Evaluate Boolean statements, write short proofs, classify functions and relations in code, and count arrangements and selections.

    You build: Guided project: Logic, proof and relations notebook section.

  2. 02

    Modules 4 to 6

    Numbers, graphs and matrices

    Use modular arithmetic and binary representation, prove graph facts with executable checks, and compute with vectors and matrices in plain Python.

    You build: Guided project: Counting and number-representation notebook section; Graph and linear-algebra notebook section.

  3. 03

    Modules 7 to 10

    Probability, numerics and optimisation

    Compute probabilities exactly and by simulation, control rounding error, solve small optimisation problems, and optionally port to Math.js.

    You build: Guided project: Probability, numerics and optimisation notebook section; Optional Math.js port with shared test vectors.

Full curriculum

10 modules and 58 lessons, 35 to 60 hours of study

01Logic, sets and proof technique6 lessons, 3 to 4 hours

Lessons

  • Truth tables for compound conditions with itertools.product
  • Implication, converse and contrapositive checked by table
  • De Morgan's laws and an equivalence checker
  • Quantifiers over finite domains with all() and any()
  • Set algebra with Python sets and inclusion-exclusion for two sets
  • Direct proof, contradiction and induction with a written checklist

After this module you can

  • Enumerate all 2^n assignments of a Boolean formula in Python and classify it as a tautology, a contradiction or contingent.
  • Implement implies(p, q) and show by exhaustive table that p -> q equals its contrapositive but not its converse.
  • Write three short paper proofs and judge each against an explicit checklist, using code only to hunt counterexamples and never as proof.
02Functions, relations and orders6 lessons, 3 to 4 hours

Lessons

  • Functions as mappings: domain, codomain, range and totality
  • Injective, surjective and bijective maps with the pigeonhole principle
  • Composition and inverse functions
  • Relations as sets of pairs: reflexive, symmetric, antisymmetric, transitive
  • Equivalence relations and partitions: grouping by key
  • Partial orders: minimal elements, chains and antichains

After this module you can

  • Represent a finite function as a Python dict, compute its range, and decide whether it is total on a stated domain.
  • Classify a finite function as injective, surjective, bijective or neither by code, and use the pigeonhole principle to prove a collision must exist.
  • Test whether a relation is a partial order and find its minimal and maximal elements, a longest chain and a largest antichain on small sets.
03Counting and combinatorics6 lessons, 3 to 4 hours

Lessons

  • Sum and product rules for passwords, IDs and codes
  • Permutations, factorial growth and repeated letters
  • Combinations and binomial coefficients
  • Distributing identical items: multisets and stars and bars
  • Inclusion-exclusion and complement counting
  • Counting with recurrences and memoisation

After this module you can

  • Count the structures built by sequences of independent choices and by disjoint alternatives, then confirm the count by enumeration.
  • Count ordered arrangements with n!, partial permutations P(n, k) and arrangements with repeated items, and explain why brute-force permutation search fails past about 12 items.
  • Derive a recurrence for a counting problem, compute it with memoisation, and verify it against brute-force enumeration.
04Integers, modular arithmetic and number representation6 lessons, 3 to 4 hours

Lessons

  • Division with remainder and Python's floor semantics
  • The Euclidean algorithm, lcm and Bezout coefficients
  • Congruence and modular arithmetic with check digits and cycles
  • Modular exponentiation and modular inverses
  • Binary, hexadecimal and two's complement integers
  • Primes, factorisation and counting divisors

After this module you can

  • State the division theorem, predict // and % for negative operands in Python, and use divmod to convert units and wrap indices.
  • Compute gcd with the Euclidean algorithm, derive lcm from it, and recover Bezout coefficients with the extended algorithm, checking a*x + b*y = gcd.
  • Factor integers by trial division up to isqrt(n), build a sieve, and use the factorisation to count divisors.
05Graphs and discrete structures6 lessons, 3 to 4 hours

Lessons

  • Graph representations and the handshake lemma
  • Paths, connectivity and components by breadth-first search
  • Trees: n-1 edges, acyclic, connected
  • Bipartite graphs and two-colouring with odd-cycle witnesses
  • Directed acyclic graphs and dependency ordering
  • Euler trails and degree parity

After this module you can

  • Build a graph from an edge list as an adjacency dict, compute degrees, and use the handshake lemma (sum of degrees = 2 * edges) to rule out impossible degree sequences.
  • Compute connected components and the minimum number of edges between two vertices using breadth-first search, returning None when no path exists.
  • Decide whether a connected graph has an Euler circuit or trail from the number of odd-degree vertices, and explain the Konigsberg bridges.
06Vectors and matrices6 lessons, 3 to 4 hours

Lessons

  • Vectors, scaling and the dot product
  • Norms, distance and cosine similarity
  • Matrix-vector products as linear maps
  • Matrix multiplication, identity and transpose
  • Solving linear systems by Gaussian elimination
  • 2D transformations and the order of composition

After this module you can

  • Implement vector addition, scalar multiplication and the dot product for lists, with shape checks, and interpret the dot product as a weighted sum.
  • Compute Euclidean length, distance and cosine similarity, handle the zero vector, and interpret orthogonality.
  • Express rotation, scaling, reflection and shear as 2x2 matrices, apply them to points, and show that the order of composition changes the result.
07Probability connections6 lessons, 3 to 4 hours

Lessons

  • Sample spaces and events by enumeration with exact fractions
  • Conditional probability and Bayes' rule from counts
  • Independence, the product rule and redundancy
  • Random variables and linearity of expectation
  • Monte Carlo simulation checked against exact answers
  • Hash collisions and the birthday bound

After this module you can

  • Enumerate an equally likely sample space in Python and compute event probabilities as exact Fractions.
  • Compute P(A given B) by restricting the sample space and apply Bayes' rule to a screening or filtering problem exactly.
  • Compute the probability of at least one collision among k random values in m buckets and the expected number of colliding pairs, and compare both with simulation.
08Numerical approximation6 lessons, 3 to 5 hours

Lessons

  • Binary64 floats: what 0.1 and 2^53 really are
  • Rounding error, tolerant comparison and cancellation
  • Exact arithmetic with Fraction and Decimal, and their costs
  • Bisection root finding with a guaranteed error bound
  • Newton's method, convergence speed and failure cases
  • Numerical integration and differentiation: truncation versus rounding error

After this module you can

  • Inspect the exact value of a float, explain the 1/11/52 bit layout, and predict which decimals and integers are exactly representable.
  • Compare floats with math.isclose using sensible tolerances, show accumulated rounding error in a loop, and recognise catastrophic cancellation.
  • Estimate integrals with the trapezoid rule, measure how the error shrinks with step size, and find the step size where finite-difference derivatives stop improving.
09Optimization foundations5 lessons, 2 to 4 hours

Lessons

  • Objectives, constraints and feasible regions by exhaustive search
  • Gradient descent on one variable and the learning rate
  • Least squares fitting by gradient descent and the closed form
  • Convexity, local minima and multiple starts
  • Discrete optimization: when greedy fails on knapsack

After this module you can

  • State an optimization problem as an objective plus constraints, enumerate the feasible integer points, and report the best one with its slack.
  • Implement gradient descent for a single-variable function, relate the update to the derivative, and predict convergence, oscillation and divergence from the learning rate.
  • Solve the 0/1 knapsack exactly by dynamic programming, compare it with the value-density greedy rule, and produce a counterexample where greedy is not optimal.
10Optional Math.js lab5 lessons, 2 to 4 hours

Lessons

  • Installing Math.js and evaluating expressions in Node.js
  • Number, BigNumber and Fraction types in Math.js
  • Matrices in Math.js: det, inv and lusolve versus the Python solver
  • Parsing user formulas safely with scopes
  • Porting a Python model to JavaScript with shared test vectors

After this module you can

  • Create a pinned Node.js project, import Math.js as an ES module, and evaluate expressions with math.evaluate while recording the installed version.
  • Configure Math.js to use BigNumber or Fraction instead of double, observe the effect on 0.1 + 0.2 and 1/3 * 3, and state the limits of each type.
  • Port a small Python model (binomial counts and cosine similarity) to JavaScript, generate test vectors from Python, and show agreement or documented differences.

What you'll build

5 guided projects along the way, then a final project.

  • Logic, proof and relations notebook section

    after module 2
  • Counting and number-representation notebook section

    after module 4
  • Graph and linear-algebra notebook section

    after module 6
  • Probability, numerics and optimisation notebook section

    after module 9
  • Optional Math.js port with shared test vectors

    after module 10

Final project

Discrete and applied mathematics notebook with executable models. Choose one option: Build-order and reliability model notebook | Numerical methods and optimisation error-budget notebook | Encoding, checksums and hashing analysis notebook

What you submit

Source and artifact submission: a repository or zip with modules, tests, a README notebook (Markdown, optional Jupyter), and a proofs section with at least two proofs meeting the checklist.

How it's reviewed

Trainer-reviewed demonstration: the learner explains each model, changes one parameter live and predicts the effect before running. Marked against the course project review rubric.

Where you'll use it

  • Check a modular check digit or two's-complement field in an identifier scheme.
  • Compare floating-point values safely and pick a stopping rule for a numerical method.

Roles that use these skills

  • Software engineer
  • Data analyst
  • Machine learning engineer

Earn the certificate by building, not watching

  1. Complete the lessons and pass each module checkpoint.
  2. Build your final project and demonstrate it.
  3. OUTLEARN reviews your project and issues your certificate. It is not issued automatically.

Frequently asked questions

Is module 10 required?

No. Module 10 is an optional Math.js lab.

Which language is used?

Python 3 is the primary lab language.

How is Mathematics for Programmers: Discrete and Applied Foundations structured, and is it open now?

It has 10 modules and 58 lessons. It is not yet released to learners.

Be first in when Mathematics for Programmers: Discrete and Applied Foundations opens

Email us and we will tell you as soon as enrolment opens.

Notify me when it opens
FreeOpens soon
Notify me