On this page
A computer reads your handwritten 7 by turning it into numbers, multiplying each number by a weight, adding everything up and picking the digit with the highest score. Learning means adjusting those weights after each mistake. Below is a version you can run with a pencil.
What does a computer see when you write a number?
It sees numbers, not shapes. In MNIST, the standard practice set for this task, each digit is a 28 × 28 grid of pixels, and each pixel holds a grey level from 0 to 255 (MNIST dataset card). That makes 784 numbers per digit.
MNIST has 60,000 training images and 10,000 test images; half the images were drawn by US Census Bureau employees and half by high school students (MNIST dataset card). Yann LeCun, Léon Bottou, Yoshua Bengio and Patrick Haffner described it in 1998: each digit was scaled to fit a 20 × 20 box, then centred in the 28 × 28 grid (LeCun et al., 1998, Proceedings of the IEEE).
How does a neural network turn pixels into a guess?
The simplest version gives each digit, 0 to 9, its own grid of 784 weights. To score an image for 7, multiply each pixel by the matching weight in the 7-grid and add the products. Do the same for the other nine digits. The highest score is the guess. A positive weight means “ink here is evidence for this digit”; a negative one means “evidence against”.
The 1998 paper tested this kind of linear classifier, where “each input pixel value contributes to a weighted sum for each output unit”; it had 7,850 adjustable numbers and got 12% of test digits wrong (LeCun et al., 1998). A network with 300 hidden units between pixels and answer got 4.7% wrong, and LeNet-5, a convolutional network “specifically designed to deal with the variability of 2D shapes”, got 0.95% wrong.
How does the network learn its weights?
It practises: show an image, compare the answer with the right one, nudge the weights to shrink the error, repeat.
The standard method for the nudges is back-propagation, which Rumelhart, Hinton and Williams described in 1986 as a procedure that “repeatedly adjusts the weights of the connections in the network so as to minimize a measure of the difference between the actual output vector of the net and the desired output vector” (Nature, 1986). Their abstract adds that hidden units “come to represent important features of the task domain”.
Variety helps too: LeNet-5's test error fell from 0.95% to 0.8% when training included distorted copies of the digits (LeCun et al., 1998).
Can you train a digit reader with paper and pencil?
Yes. Draw two 3 × 3 grids, W1 and W0, with 0 in every cell. Number the cells 1 to 9 like a phone keypad. A “1” is ink on cells 2, 5 and 8. A “0” is ink on the ring around the centre: 1, 2, 3, 4, 6, 7, 8, 9.
A grid's score is the sum of its weights on the inked cells. The rule: if the right digit does not score higher, add 1 to its grid on every inked cell and subtract 1 from the other grid there.
Show a “1”. Both score 0, a tie, so it counts as wrong. W1 gets +1 on cells 2, 5, 8; W0 gets −1.
Show a “0”. W1 scores 2 and W0 scores −2, so it guesses 1. Wrong: add 1 to W0 on the eight ring cells, subtract 1 from W1.
W1 is now +1 at the centre, 0 on cells 2 and 8, −1 elsewhere. W0 is its mirror image.
Test a clean “1” (1 against −1) and a clean “0” (−6 against 6). Both correct.
Show a slanted “1” on cells 3, 5, 7. W1 scores −1, W0 scores 1, so it says 0. Wrong. After the rule, cell 5 is +2 in W1 and −2 in W0; cells 3 and 7 are 0 in both.
Re-test. Both clean digits and the slanted 1 now come out right.
That is the whole loop: guess, compare, nudge. Real networks use 784 pixels, ten digits, finer nudges from back-propagation and far more examples. Step 5 shows why those examples come from many different writers: a reader trained only on neat ones is fooled by the first sloppy one.
What does this mean for using AI in your studies?
A digit reader matches patterns; it has no idea what seven means. Larger AI systems also learn by adjusting weights from examples, which helps explain how large language models produce answers and why AI can make confident maths mistakes. If you send handwritten working to an AI, photograph the problem clearly.
If weighted sums are where you get stuck, the Fermi Concept Library has every concept in mathematics and computing, each with its own lesson. Fermi's AI tutor can work out what you already know and build a plan for the session, so you go from this toy grid to the full idea one step at a time.
Run the grids once and you have trained a neural network by hand.



