← All articles
BlogMaths, Programming and MLOps

How to revise calculus for machine learning exams

Maths, Programming and MLOpsBy Sotiris Spyrou·Published 2026-07-30
How to revise calculus for machine learning exams

How to revise calculus for machine learning exams

To revise calculus for machine learning exams effectively, you must focus entirely on partial derivatives, the chain rule, and vector calculus rather than trying to memorise standard integrals. By connecting these mathematical mechanics directly to algorithms like gradient descent and backpropagation, you will understand exactly how neural networks update their weights.

Many university students approach their artificial intelligence maths modules by trying to relearn their entire A-Level or first-year undergraduate syllabus. This is a mistake. Machine learning exams do not test your ability to integrate complex trigonometric functions or solve abstract differential equations. Instead, examiners want to see that you can calculate gradients for loss functions and apply them to optimise model parameters. You need to strip back your revision to the calculus concepts that actually drive these algorithms. In this post, we will walk through the exact mathematical principles you need to master, showing you how they translate into the core mechanics of machine learning and how to present them to an examiner.

Mastering partial derivatives for loss functions

In machine learning, models have multiple parameters. A simple linear regression model has a weight and a bias, while a deep neural network has millions of weights. To minimise the error (the loss function), you need to know how changing each individual parameter affects the total error. This is exactly what partial derivatives do. They allow you to isolate one variable while treating all others as constants, giving you the slope of the error curve with respect to that specific parameter.

Imagine you are revising mean squared error for a linear regression exam question. The loss function is a surface in multiple dimensions. When you calculate the partial derivative of the loss with respect to a single weight, you are finding the direction of steepest ascent along that specific axis. Moving in the opposite direction gives you the foundation of gradient descent. If you cannot reliably compute partial derivatives of polynomial and exponential functions, you will struggle to pick up marks in any optimisation question.

Consider a simple loss function where L(w, b) = (y − (wx + b))2. To find the gradient with respect to the weight w, you apply the chain rule while treating b, x, and y as constants. The outer derivative is 2(y − (wx + b)), and the inner derivative with respect to w is x. Multiplying these gives the partial derivative: −2x(y − (wx + b)). Practise this process until it becomes automatic. Exam questions often ask you to derive these exact gradients for a simple network before asking you to perform a single weight update step manually.

The chain rule as the engine of backpropagation

The chain rule is arguably the most important calculus concept in deep learning. Neural networks are simply nested functions. The output of one layer becomes the input to the next layer. When you want to find out how a weight in the very first layer affects the final loss, you cannot calculate it directly. You must trace the error backwards through every intermediate layer. The chain rule provides the exact mathematical mechanism to multiply these local gradients together.

Let us map this to a standard exam scenario. An examiner might present a two-layer neural network with a sigmoid activation function and ask you to compute the gradient of the loss with respect to a specific hidden layer weight. You will need to write out the chain of partial derivatives. The loss depends on the output activation, which depends on the output pre-activation, which depends on the hidden layer activation, which finally depends on your target weight. Writing this sequence out clearly as a product of fractions is essential for securing full marks.

A common pitfall in exams is messing up the derivative of the activation function itself. The sigmoid function, σ(x), is a classic example. You should commit its derivative, σ(x)(1 − σ(x)), to memory. When you apply the chain rule, you simply slot this local gradient into your longer multiplication string. If you try to derive the sigmoid function from scratch under exam conditions, you will waste valuable time. The Full Marks Press Mathematics for AI guide covers this with worked exam questions, showing you exactly how to structure your backpropagation answers step by step.

Remember that examiners are testing your understanding of the flow of gradients. They will often introduce a very simple custom network architecture, perhaps with only three nodes, just to see if you can construct the correct chain rule equation. Practise writing out the full mathematical expression before you plug in any numbers. This approach prevents arithmetic errors from cascading through your answer and ensures you pick up method marks even if your final numerical calculation is slightly off.

Working with Jacobians in vector calculus

Once you move beyond single-variable calculus, you enter the realm of vector calculus. In machine learning, we rarely update one weight at a time. We update entire matrices of weights simultaneously. The Jacobian matrix is the tool we use to collect all the first-order partial derivatives of a vector-valued function. If you have a mathematical function that takes a vector of inputs and produces a vector of outputs, the Jacobian captures how every single output changes with respect to every single input.

In your exam, you might be asked to compute the Jacobian for a specific layer in a neural network. Consider a softmax output layer. The softmax function takes a vector of raw scores (logits) and turns them into a vector of probabilities. Because the probability of one class depends on the raw scores of all other classes, the derivative is not a single number but a matrix. The diagonal elements of this Jacobian represent the derivative of a class probability with respect to its own logit, while the off-diagonal elements represent the derivative with respect to other logits.

To revise this effectively, do not just memorise the final matrix structure. Write down a small example, perhaps a two-element vector, and manually compute the four partial derivatives required for a two-by-two Jacobian. Examiners love to test the softmax Jacobian because it perfectly demonstrates whether a student understands how vector inputs map to vector outputs. If you can confidently set up a Jacobian matrix and populate it with the correct partial derivatives, you will demonstrate a deep understanding of multivariate calculus.

The Hessian matrix and second-order optimisation

While gradient descent relies on first-order derivatives to find the slope, more advanced optimisation techniques use second-order derivatives. The Hessian matrix collects all the second-order partial derivatives of a scalar-valued function. It describes the local curvature of the loss function. If the gradient vector tells you which way is downhill, the Hessian matrix tells you whether that hill is a gentle curve or a steep, narrow ravine.

Exam questions on this topic usually involve Newton’s method or discussions about saddle points. For Newton’s method, you update the weights by multiplying the inverse of the Hessian matrix by the gradient vector. This allows the algorithm to take larger steps in areas of low curvature and smaller steps in areas of high curvature. You should be prepared to calculate a small two-by-two Hessian matrix for a given two-variable function and compute one update step.

Alternatively, you might be asked to use the Hessian to classify a critical point. By finding the eigenvalues of the Hessian matrix at a point where the gradient is zero, you can determine if you are at a local minimum, a local maximum, or a saddle point. If all eigenvalues are positive, it is a minimum. Mixed signs indicate a saddle point. Saddle points are a major issue in training deep neural networks, so understanding how the Hessian identifies them is a highly examinable concept. Practise finding the determinant and trace of small matrices to quickly evaluate these conditions.

How to answer this in an exam

When an examiner marks a calculus question in a machine learning paper, they are looking for clear mathematical communication. Mark schemes heavily reward the initial setup. Always start by writing down the general formula you are using. If you are calculating a weight update using gradient descent, write out the formula containing the learning rate

Frequently asked questions

Should I revise standard integrals for my machine learning exam? No, you should avoid trying to relearn your entire A-Level syllabus or memorising standard integrals. Machine learning exams focus instead on calculating gradients for loss functions using partial derivatives and the chain rule.

Why are partial derivatives important for machine learning? They allow you to isolate a single variable while treating others as constants to find the slope of the error curve. This helps you understand how changing an individual parameter affects the total error, which is the foundation of gradient descent.

How does the chain rule apply to neural networks? Because neural networks are nested functions, you cannot calculate how a first-layer weight affects the final loss directly. The chain rule provides the mathematical mechanism to multiply local gradients together, allowing you to trace the error backwards through every intermediate layer.

How can I maximise my marks on backpropagation exam questions? You should write out the full sequence of partial derivatives as a product of fractions before plugging in any numbers to secure method marks. Additionally, you should memorise the derivative of the sigmoid function rather than trying to derive it from scratch under timed conditions.

Revising this for an exam? The Full Marks Press guides cover it with worked exam questions and mark schemes. Get a free copy.

ShareXLinkedInWhatsApp
Sotiris Spyrou

Practitioner and author at Full Marks Press, a Verity AI imprint.