Skip to article
Insights / Artificial Intelligence
Artificial Intelligence

The Maths Behind Neural Networks: How Machines Learn Using Numbers

Artificial neural networks can appear mysterious, but underneath the apparent intelligence is something much more concrete: numbers being transformed by mathematics. A network repeatedly multiplies values, adds them together, passes the results through functions,…

READUNDERSTANDAPPLY
INSIGHT / Artificial Intelligence Read the evidence. Understand the service. Apply the thinking.
10 MIN READ 2 Sep 2026

Artificial neural networks can appear mysterious, but underneath the apparent intelligence is something much more concrete: numbers being transformed by mathematics. A network repeatedly multiplies values, adds them together, passes the results through functions, measures how wrong its predictions were and adjusts itself accordingly.

Artificial intelligence head illustration representing neural networks, machine learning and mathematical AI systems
Neural networks learn by transforming numerical inputs through layers of weighted calculations, activation functions and feedback.

You do not need a degree in linear algebra or calculus to understand the basic mechanism. The important ideas are inputs, weights, biases, activation functions, predictions, errors and adjustments. Once those pieces are connected, the learning process becomes much easier to understand.

What a neural network actually does

At its simplest, a neural network converts one collection of numbers into another. Imagine a model designed to estimate the price of a house. We might give it information such as house size, number of bedrooms, distance from a city centre, age of the property and local market data.

Each of those values becomes an input. The network transforms those inputs through one or more layers and eventually produces an output, perhaps a predicted value such as £320,000.

NEURAL NETWORK / SIMPLE FORWARD PASS INPUT → HIDDEN REPRESENTATION → OUTPUT
INPUTS
House size
Bedrooms
Distance
HIDDEN LAYER
Weighted pattern A
Weighted pattern B
Weighted pattern C
OUTPUT
Predicted house price
IN PLAIN ENGLISH

A neural network does not understand a bedroom or a city centre in the human sense. It works with numerical representations and learns how strongly different patterns should influence its output.

Weights and biases: deciding what matters

Every input entering a neuron is associated with a weight. A weight represents how strongly that input should influence the neuron’s calculation.

Suppose a simplified neuron receives three inputs: house size, number of bedrooms and distance from the city centre. Each input has a corresponding weight.

LINEAR COMBINATION EQUATION 01
z = (x₁ × w₁) + (x₂ × w₂) + (x₃ × w₃) + b
xInput value
wWeight applied to the input
bBias
zWeighted total before activation

Multiply each input by its weight, add the results together, then add the bias.

The same calculation can be written more compactly:

COMPACT NOTATION EQUATION 02
z = Σ(xᵢ × wᵢ) + b

The symbol Σ means: add together all of the corresponding input × weight calculations.

What does the bias do?

The bias gives the neuron additional flexibility. In the simple expression below, the weight controls how strongly the input affects the output, while the bias shifts the result.

WEIGHT + BIAS EQUATION 03
y = wx + b

A useful analogy is that the weight controls sensitivity while the bias adjusts the starting position.

Vectors and matrices: doing many calculations at once

Real neural networks do not usually process one input and one neuron at a time. They may process hundreds of inputs, thousands of neurons and very large collections of parameters.

Linear algebra gives us a compact and efficient way to represent these calculations. Inputs can be stored in a vector, weights in a matrix and biases in another vector.

01 / VECTOR Inputs

A one-dimensional collection of numerical values, such as x₁, x₂, x₃ and so on.

02 / MATRIX Weights

A structured table of values describing how inputs connect to neurons in the next layer.

03 / VECTOR Biases

Additional adjustable values that allow neurons to shift their response.

04 / COMPUTATION Matrix multiplication

A compact way to perform many weighted calculations efficiently and in parallel.

ONE COMPLETE LAYER EQUATION 04
z = Wx + b
xInput vector
WWeight matrix
bBias vector
zLayer output before activation

This single expression can represent thousands of individual multiplication-and-addition operations. It is also one reason GPUs are so useful for machine learning: they are designed to perform large numbers of numerical operations in parallel.

Activation functions: introducing non-linearity

If every layer only performed a linear calculation such as z = Wx + b, even a deep network would ultimately behave like a much simpler linear model. Neural networks therefore use activation functions.

ACTIVATION EQUATION 05
a = f(z)
zWeighted input
fActivation function
aActivated output
Non-linearity allows richer patterns

ReLU

One of the most widely used activation functions is the Rectified Linear Unit, or ReLU.

RECTIFIED LINEAR UNIT EQUATION 06
ReLU(z) = max(0, z)

If z is negative, the output is 0. If z is positive, the output is z itself.

Sigmoid

The sigmoid function compresses a value into the range between 0 and 1, which can be useful when an output is interpreted as a probability in binary classification.

SIGMOID EQUATION 07
σ(z) = 1 / (1 + e^(-z))

The output approaches 0 for strongly negative inputs and 1 for strongly positive inputs.

Tanh

The hyperbolic tangent function produces values between −1 and 1. Unlike sigmoid, its output is centred around zero.

HYPERBOLIC TANGENT RANGE
−1 ≤ tanh(z) ≤ 1

Forward propagation: producing a prediction

Forward propagation is the process of sending information through the network from the input towards the output. At each layer, the network performs a weighted calculation, applies an activation function and passes the result to the next layer.

01 INPUT Receive data
02 WEIGHTS Calculate z = Wx + b
03 ACTIVATION Calculate a = f(z)
04 NEXT LAYER Transform again
05 OUTPUT Produce prediction

For a two-layer network, the sequence can be written:

TWO-LAYER FORWARD PASS EQUATION 08
z₁ = W₁x + b₁
a₁ = f(z₁)
z₂ = W₂a₁ + b₂
a₂ = f(z₂)

The output of one layer becomes the input to the next.

Loss functions: measuring how wrong the model is

Forward propagation produces an answer, but that does not mean the network has learned. Learning requires a way to measure how far the prediction is from the correct answer. That is the role of the loss function.

Mean Squared Error

For regression problems, one common loss function is Mean Squared Error, or MSE.

MEAN SQUARED ERROR EQUATION 09
MSE = (1 / n) × Σ(ŷᵢ − yᵢ)²
nNumber of examples
ŷᵢPredicted value
yᵢCorrect value
²Squares each prediction error

For each example, the model calculates the difference between its prediction and the correct value, squares that difference, adds the squared errors and divides by the number of examples.

Binary cross-entropy

Classification problems often use cross-entropy-based losses. For a simple binary case, one common form is:

BINARY CROSS-ENTROPY EQUATION 10
L = −[y × ln(p) + (1 − y) × ln(1 − p)]
yCorrect class: 0 or 1
pPredicted probability
LLoss
lnNatural logarithm
WHY LOSS MATTERS

Training needs a numerical target to improve. The loss function turns “that prediction was wrong” into a number the optimisation process can work with.

Backpropagation: learning from mistakes

Once the network has measured its error, it needs to determine which parameters contributed to that error and how they should change. This is where backpropagation comes in.

Backpropagation works backwards through the computational graph and calculates how sensitive the loss is to each adjustable parameter. The mathematical mechanism uses derivatives and the chain rule.

01 PREDICTION Model produces ŷ
02 LOSS Compare ŷ with y
03 BACKWARD PASS Trace error contribution
04 GRADIENTS Calculate sensitivities
05 UPDATE Adjust parameters
IN PLAIN ENGLISH

Backpropagation tells the training process which numbers should change, and in which direction, if the model is to reduce its error.

Gradient descent: adjusting the weights

The result of backpropagation is a collection of gradients. A gradient tells us how the loss changes when a parameter changes.

A simplified weight update is:

GRADIENT DESCENT EQUATION 11
w(new) = w(old) − η × (∂L / ∂w)
wWeight being updated
LLoss
ηLearning rate
∂L / ∂wHow the loss changes when the weight changes

The optimiser moves the weight in a direction intended to reduce the loss. The learning rate controls the size of the adjustment.

If the learning rate is too large, training may overshoot useful solutions or become unstable. If it is too small, learning can become unnecessarily slow.

The complete neural-network learning cycle

The major pieces can now be connected into one learning loop.

01 INPUT Training data
02 FORWARD Produce prediction
03 LOSS Measure error
04 BACKPROP Calculate gradients
05 OPTIMISE Update and repeat
CORE TRAINING LOOP SYSTEM VIEW
x → z → a → ŷ → L → gradients → updated parameters

Training repeats this loop across batches of examples, often for many passes through the dataset.

What is an epoch?

One complete pass through the available training dataset is called an epoch. More epochs do not automatically mean a better model. If training continues inappropriately, the model can begin to overfit — performing very well on its training data while generalising poorly to new examples.

What is the network actually learning?

It is tempting to imagine that a neural network stores explicit human-readable rules. In most modern networks, that is not what happens. The model learns large collections of numerical parameters whose interactions collectively encode useful patterns.

That distinction matters because a model can produce an effective prediction without being able to provide a simple human explanation of exactly how every internal parameter contributed to it.

EXPLAINABILITY

Knowing the mathematics of the learning mechanism does not automatically make every individual model decision easy to interpret.

This becomes particularly important when AI influences financial decisions, healthcare, public services, recruitment, fraud detection, compliance or risk assessment.

Common neural-network architectures

Different network architectures apply the same fundamental building blocks — numerical representations, learned parameters, transformations and optimisation — in different ways.

01 GENERAL MAPPING Feedforward Neural Networks

Basic input-to-output modelling used across classification and regression problems.

02 SPATIAL PATTERNS Convolutional Neural Networks

Designed to learn local and spatial features, particularly in image and computer-vision tasks.

03 SEQUENCES Recurrent Neural Networks

Use recurrent connections so previous steps can influence later processing.

04 LONGER DEPENDENCIES LSTM & GRU Networks

Gated recurrent architectures designed to preserve useful information across longer sequences.

05 MODERN GENERATIVE AI Transformers

Use attention mechanisms to model relationships across sequences and underpin many modern large language models.

06 GENERATION Generative Adversarial Networks

Train a generator and discriminator in competition to produce synthetic examples.

07 CLUSTERING Self-Organising Maps

Used for clustering and visualising relationships in high-dimensional datasets.

08 FUNCTION APPROXIMATION Radial Basis Function Networks

Use radial basis functions and have been applied to classification, approximation and control problems.

Transformers are still built from maths

Transformers changed the direction of modern artificial intelligence, particularly language modelling. They rely heavily on attention mechanisms that help a model represent relationships between different elements in a sequence.

Their internal architecture is more sophisticated than the simple neuron described earlier, but the foundations remain recognisable: vectors, matrices, learned weights, transformations, activation functions, loss functions, gradients and optimisation.

01 TOKENS Represent text
02 EMBEDDINGS Convert to vectors
03 ATTENTION Model relationships
04 LAYERS Transform representations
05 OUTPUT Predict probabilities

From model mathematics to service design and AI governance

Understanding the mathematics explains how a model transforms information. It does not, by itself, tell us whether the model should be used for a particular purpose or whether the surrounding service is safe, usable and accountable.

An operational AI-enabled service may contain data preparation, a model, business rules, a user interface, human decisions, operational actions, logs and monitoring.

01 MODEL DESIGN How does the model work?

Data, features, parameters, training, evaluation, performance and technical behaviour.

02 SERVICE DESIGN How does it fit into the service?

Users, journeys, operations, casework, hand-offs, failure routes and human intervention.

03 AI GOVERNANCE How is it controlled?

Purpose, risk, accountability, evidence, logs, oversight, monitoring and challenge.

That wider service raises questions the mathematics alone cannot answer:

  • Is the input data appropriate for this use?
  • Who can challenge the model’s output?
  • When must a human intervene?
  • What happens when the model is wrong?
  • What evidence and logs are retained?
  • Who owns the final decision?
  • How is model performance monitored over time?
  • What happens when the service, data or operating context changes?
THE BIGGER PICTURE

A mathematically sophisticated model is not automatically a well-designed or well-governed service.

Final reflections: the maths is the mechanism

Artificial neural networks can produce remarkably sophisticated behaviour, but the underlying mechanism is mathematical. At the foundation are multiplication, addition, matrix operations, activation functions, error measurement and parameter adjustment — repeated at enormous scale.

Understanding those foundations helps remove some of the mystery surrounding artificial intelligence. It also reveals why model design, service design and AI governance increasingly need to be considered together.

THE FOUNDATION DIGIFIXIT / AI SYSTEM VIEW
MODEL DESIGN + SERVICE DESIGN + AI GOVERNANCE

The mathematics helps us understand how the machine learns. Service design explains how the machine fits into the organisation and user journey. AI governance establishes how the resulting system is controlled, monitored and held accountable.

What comes next?

The next question is no longer simply, “How does a neural network learn?” It is: How should people interact with increasingly capable AI systems?

For large language models, that leads naturally to prompt design and prompt engineering — how instructions, context, examples and constraints influence model output. In the next Insight, we will look at how to structure prompts more effectively, why small changes in wording can alter results, and where prompt engineering fits within the wider design and governance of AI-enabled services.

Put the thinking into practice DIGIFIXIT / INSIGHTS

Have a complex service challenge worth understanding properly?

Tell us what is not working, what is changing or what your organisation needs to understand. We can start with the evidence.

Start a conversation
Scroll to Top