From the perceptron to neural networks
One artificial neuron is a simple formula. Connect many, stack them in layers, and you get the most flexible function-approximators ever built. This chapter builds a neural network piece by piece — and tells the story of how it was invented.
A neuron takes some numbers, multiplies each by a weight (how important it is), adds them up with a bias (a threshold), and passes the result through a simple function — the activation. That is all. A perceptron is one such neuron that answers yes/no. A neural network is many neurons arranged in layers, where the outputs of one layer are the inputs of the next. "Deep" simply means many layers.
This chapter builds networks. How they learn — the slope, the minus sign, the update — is explained from scratch with an apple price in Chapter 10, and the backward pass in Chapter 14.
- the history: from McCulloch–Pitts (1943) and Rosenblatt's perceptron (1958) to deep learning and SciML (Scientific Machine Learning);
- every part of a neuron — input, weight, bias, weighted sum, activation, output — with a live diagram;
- how a perceptron learns, and the theorem that says when it succeeds;
- the XOR (exclusive OR) problem — what one neuron cannot do — and how a hidden layer fixes it;
- layers, the forward pass step by step, activation functions, and why depth helps.
A student passes if their marks $x$ are at least 40. One neuron does this: weight $w = 1$, bias $b = -40$, step activation. It computes $z = 1\cdot x - 40$ and outputs $1$ ("pass") if $z \ge 0$, else $0$. With two inputs — say admission needs Maths + Physics $\ge 100$ — use $w_1 = w_2 = 1$, $b = -100$: the neuron now draws a line $x_1 + x_2 = 100$ in the plane and says "yes" on one side. The weights decide what matters; the bias sets the threshold. Every network in this chapter is built from neurons like this one.
1. A short history, in 20 milestones
Click a milestone. Dashed buttons are milestones of scientific machine learning.
To see where neural networks sit among artificial intelligence (AI), machine learning, deep learning, ChatGPT-style language models and scientific machine learning, explore the interactive map of AI in Chapter 9 or on the book home page.
The pattern to notice: the core ideas — weighted sums, learning rules, the chain rule — are old. What changed after 2006 was data, computing power (GPUs (Graphics Processing Units)), and engineering tricks that made deep networks trainable. SciML (from 2017) asks: what if the "data" is a differential equation?
2. Anatomy of an artificial neuron
The biological picture — dendrites collect signals, the cell body adds them, the axon fires if the total exceeds a threshold — inspired the model, but an artificial neuron is simply this formula:
For inputs $x_1, \dots, x_n$, weights $w_1, \dots, w_n$ and bias $b$: $$\underbrace{z = w_1x_1 + w_2x_2 + \dots + w_nx_n + b = \mathbf w\cdot\mathbf x + b}_{\text{weighted sum (pre-activation)}}, \qquad \underbrace{a = \sigma(z)}_{\text{activation (output)}}.$$ $\sigma$ is the activation function. The weights and bias are the neuron's parameters: they are learned from data.
McCulloch & Pitts, "A logical calculus of the ideas immanent in nervous activity", Bull. Math. Biophys. 5 (1943) 115–133; Goodfellow, Bengio & Courville, Deep Learning, MIT Press (2016), chapter 6.3. The perceptron: the first learning machine

Frank Rosenblatt's perceptron (1958) is a single neuron with a step activation: it outputs 1 ("yes") if $z \ge 0$ and 0 ("no") otherwise. With two inputs, the set where $w_1x_1 + w_2x_2 + b = 0$ is a straight line — the decision boundary. The perceptron says "yes" on one side and "no" on the other. Its novelty was a rule to learn $\mathbf w$ and $b$ from examples.
Prediction: $\hat y = \operatorname{step}(\mathbf w\cdot\mathbf x + b) \in \{0, 1\}$. For each training example $(\mathbf x, y)$ in turn, update $$\mathbf w \leftarrow \mathbf w + \eta\,(y - \hat y)\,\mathbf x, \qquad b \leftarrow b + \eta\,(y - \hat y),$$ with learning rate $\eta > 0$. If the prediction is right, $y - \hat y = 0$ and nothing changes; if it is wrong, the boundary is pushed towards classifying that example correctly. One pass through all examples is an epoch.
Rosenblatt, "The perceptron: a probabilistic model for information storage and organization in the brain", Psychological Review 65(6) (1958) 386–408.Use labels $y_i \in \{-1, +1\}$ and suppose the data are linearly separable with margin: there is a unit vector $\mathbf u$ (bias absorbed as an extra input fixed to 1) with $y_i\,\mathbf u\cdot\mathbf x_i \ge \gamma > 0$ for all $i$, and $\|\mathbf x_i\| \le R$. Then the perceptron algorithm makes at most $(R/\gamma)^2$ mistakes, whatever the order of the examples — so it stops after finitely many updates with a separating line.
Novikoff, "On convergence proofs on perceptrons", Proc. Symposium on the Mathematical Theory of Automata 12 (1962) 615–622; Shalev-Shwartz & Ben-David, Understanding Machine Learning, Cambridge University Press (2014), chapter 9.4. The XOR problem — and the idea of a hidden layer
XOR ("exclusive or") outputs 1 when exactly one input is 1: $(0,0)\mapsto0$, $(0,1)\mapsto1$, $(1,0)\mapsto1$, $(1,1)\mapsto0$. The two blue points sit on one diagonal, the orange on the other; no single line separates them. Minsky and Papert's book Perceptrons (MIT Press, 1969) made such limitations precise, and funding and interest in neural networks collapsed for over a decade — the first "AI winter".
The way out was already known: combine neurons. XOR = "OR, but not AND". One hidden neuron computes OR, another computes AND, and an output neuron combines them: $$h_1 = \operatorname{step}(x_1 + x_2 - 0.5)\ (\text{OR}),\quad h_2 = \operatorname{step}(x_1 + x_2 - 1.5)\ (\text{AND}),\quad y = \operatorname{step}(h_1 - h_2 - 0.5).$$ The hidden layer re-describes the input in new coordinates $(h_1, h_2)$ in which the problem is linearly separable. That is the essential idea of every neural network: layers learn useful representations.
5. From neurons to layers to networks
Put $m$ neurons side by side, all reading the same inputs, and you have a layer. Writing each neuron's weights as a row of a matrix $W$ (Chapter 4), the whole layer is one line: $$\mathbf a = \sigma(W\mathbf x + \mathbf b), \qquad W \in \mathbb R^{m\times n},\ \mathbf b \in \mathbb R^m,$$ with $\sigma$ applied to each entry. Stack layers — the output of one is the input of the next — and you have a multilayer perceptron (MLP), also called a fully connected feed-forward network:
With $\mathbf a^{(0)} = \mathbf x$, for $\ell = 1, \dots, L$: $$\mathbf z^{(\ell)} = W^{(\ell)}\mathbf a^{(\ell-1)} + \mathbf b^{(\ell)}, \qquad \mathbf a^{(\ell)} = \sigma\big(\mathbf z^{(\ell)}\big),$$ except that the last layer usually has no activation (regression) or a sigmoid (yes/no probability). Layers $1, \dots, L-1$ are hidden. The network is the composition $u_\theta = f^{(L)}\circ\dots\circ f^{(1)}$ with parameters $\theta = \{W^{(\ell)}, \mathbf b^{(\ell)}\}$.
Goodfellow, Bengio & Courville (2016), chapter 6; Higham & Higham, "Deep learning: an introduction for applied mathematicians", SIAM Review 61(4) (2019) 860–891.The forward pass, one neuron at a time
Evaluating a network — the forward pass — is nothing more than computing $z$ and $a$ for each neuron, layer by layer, left to right. Step through it:
6. Inside a network: what each neuron does
A network with one hidden layer computes $u(x) = c + \sum_{i=1}^{N} a_i\,\sigma(w_i x + b_i)$. Read it slowly: each hidden neuron makes one S-shaped piece $a_i\sigma(w_ix+b_i)$ — the weight $w_i$ sets how steep it is, the bias $b_i$ where it switches, and the output weight $a_i$ how tall it is and which way up. The network's answer is simply the sum of the pieces. Training moves, stretches and flips the pieces until their sum matches the target.

- Neurons = 1. One piece can only make one S-shape: the network underfits.
- Neurons = 2, 3, 6. Each extra neuron adds one more bend. Count the bends in the target — you need roughly that many neurons.
- Activation = ReLU. Pieces become ramps, and the output becomes a broken line (piecewise linear). Its second derivative is zero almost everywhere — why ReLU is a poor choice for PINNs that need $u''$.
- Target = step or |x|. Smooth tanh pieces struggle with corners; you need steep pieces (large $w_i$) and patience.
- Target = fast wiggle. High frequencies are learned last — spectral bias. Try the sine activation.

A one-hidden-layer tanh network has 10 hidden neurons and one input. How many S-shaped pieces does its output add up?
Right: one piece per hidden neuron. (31 is the number of parameters: 10 weights $w_i$, 10 biases $b_i$, 10 output weights $a_i$ and one output bias $c$.)
7. Why activation functions — and which?
Without activations, every layer is a matrix, and a product of matrices is just another matrix: $$W^{(2)}\big(W^{(1)}\mathbf x + \mathbf b^{(1)}\big) + \mathbf b^{(2)} = \underbrace{W^{(2)}W^{(1)}}_{W}\mathbf x + \underbrace{W^{(2)}\mathbf b^{(1)} + \mathbf b^{(2)}}_{\mathbf b}.$$ A hundred linear layers are no more powerful than one: they can only draw straight lines and flat planes. The nonlinearity $\sigma$ is what lets networks bend.
| Activation | Formula | Good for | Watch out |
|---|---|---|---|
| step | $1$ if $z\ge0$, else $0$ | the original perceptron; logic | derivative is 0: cannot be trained by gradients |
| sigmoid | $1/(1+e^{-z})$ | output probabilities | saturates: $\sigma' \le 1/4$, gradients vanish in deep nets |
| tanh | $\tanh z$ | PINNs and smooth regression | also saturates for large $|z|$ |
| ReLU (Rectified Linear Unit) | $\max(0,z)$ | deep networks in vision and language | $\sigma''= 0$: useless when the loss contains $u''$ |
| softplus | $\ln(1+e^z)$ | a smooth ReLU | slower to compute |
| sine | $\sin z$ | oscillatory signals (SIREN (Sinusoidal Representation Network)) | needs careful initialisation |
8. Why go deep?
One hidden layer can already approximate any continuous function (Chapter 13) — so why use many? Because depth lets a network reuse computations. Composing a simple "tent" function with itself $k$ times creates $2^k$ linear pieces, using only two ReLU neurons per layer; a single hidden layer needs about $2^k$ neurons to do the same. Some functions are exponentially cheaper to represent with depth.
For every $k$ there are functions computed by ReLU networks with $O(k^3)$ layers and $O(1)$ neurons per layer that cannot be approximated by networks with $O(k)$ layers unless they have $\Omega(2^k)$ neurons.
Telgarsky, "Benefits of depth in neural networks", Proc. COLT 2016, PMLR 49, 1517–1539.Depth brings its own difficulty: gradients are products of many factors (chain rule), which can shrink to zero or blow up — the vanishing and exploding gradient problem (Hochreiter 1991; Glorot & Bengio, AISTATS 2010). Three engineering ideas tamed it: ReLU activations, careful initialisation, and residual connections $\mathbf a^{(\ell+1)} = \mathbf a^{(\ell)} + f(\mathbf a^{(\ell)})$ (He, Zhang, Ren & Sun, CVPR 2016). A residual layer is one Euler step of an ODE (Ordinary Differential Equation) — Chapter 6 meets deep learning.
9. Every term, in one table
| Term | Symbol | Meaning |
|---|---|---|
| input / feature | $\mathbf x$ | the numbers fed in: coordinates $(x,t)$ in a PINN, pixels in an image |
| weight | $w_{ij}$, $W$ | strength of the connection from neuron $j$ to neuron $i$; learned |
| bias | $b_i$, $\mathbf b$ | shift of the threshold; lets a neuron fire even when inputs are 0; learned |
| pre-activation | $z = \mathbf w\cdot\mathbf x + b$ | the weighted sum, before the activation |
| activation function | $\sigma$ | the nonlinear function applied to $z$ (tanh, ReLU, …) |
| activation / output | $a = \sigma(z)$ | what the neuron sends on |
| neuron (unit) | one weighted sum + activation | |
| layer | $\sigma(W\mathbf a + \mathbf b)$ | neurons reading the same inputs; input, hidden and output layers |
| width / depth | neurons per layer / number of layers | |
| parameters | $\theta$ | all weights and biases — what training changes |
| hyperparameters | choices made before training: width, depth, activation, learning rate, epochs | |
| forward pass | computing the output from the input, layer by layer | |
| prediction / target | $\hat y$ / $y$ | what the network outputs / the correct answer |
| loss | $L(\theta)$ | a number measuring how wrong the predictions are (Chapter 13) |
| gradient | $\nabla_\theta L$ | direction in parameter space that increases the loss fastest |
| backpropagation | the chain rule, applied from output to input, to compute the gradient | |
| learning rate | $\eta$ | step size of each parameter update |
| epoch / batch / iteration | one pass over all data / a subset used for one update / one update | |
| training / validation / test set | data to fit / data to tune and stop / data kept for the final honest check | |
| overfitting / underfitting | memorising noise / too simple to capture the pattern | |
| generalisation | performing well on data not seen during training |
A neuron has $\mathbf w = (2, -1)$, $b = 0.5$ and ReLU activation. What is its output for $\mathbf x = (1, 3)$?
Right: $z = 2\cdot1 - 1\cdot3 + 0.5 = -0.5$ and $\operatorname{ReLU}(-0.5) = 0$.
Why can a single perceptron not learn XOR?
Right. A hidden layer creates new features ($h_1$ = OR, $h_2$ = AND) in which a line does separate the classes.
How many parameters has a network with layer sizes 1 → 10 → 10 → 1?
Right: $(1\cdot10+10) + (10\cdot10+10) + (10\cdot1+1) = 20 + 110 + 11 = 141$.
- A neuron computes $a = \sigma(\mathbf w\cdot\mathbf x + b)$; a layer computes $\sigma(W\mathbf x + \mathbf b)$.
- The perceptron (1958) learns a separating line; it converges on separable data (Novikoff) but cannot solve XOR.
- Hidden layers build new representations in which hard problems become easy.
- Without nonlinear activations, depth is useless; with them, depth can be exponentially efficient.
- Next chapter: how the weights are learned — loss, backpropagation, and training in practice.
Further reading
- F. Rosenblatt, Psychological Review 65(6) (1958) 386–408; M. Minsky & S. Papert, Perceptrons, MIT Press, 1969 (expanded edition 1988).
- I. Goodfellow, Y. Bengio & A. Courville, Deep Learning, MIT Press, 2016 — chapters 1 (history) and 6 (free at deeplearningbook.org).
- M. Nielsen, Neural Networks and Deep Learning, Determination Press, 2015 — chapter 1 builds from perceptrons, free online.
- J. Schmidhuber, "Deep learning in neural networks: an overview", Neural Networks 61 (2015) 85–117 — detailed history.
- C. F. Higham & D. J. Higham, SIAM Review 61(4) (2019) 860–891.