an extra multiplication. Introducing the auxiliary quantity for the partial products (multiplying from right to left), interpreted as the "error at level " and defined as the gradient of the input values at level : Note that is a vector, of length equal to the number of nodes in level ; each component is interpreted as the "cost attributable to (the value of) that node". The gradient of the weights in layer is then: The factor of is because the weights between level and affect level proportionally to the inputs (activations): the inputs are fixed, the weights vary. The can easily be computed recursively, going from right to left, as: The gradients of the weights can thus be computed using a few matrix multiplications for each level; this is backpropagation. Compared with naively computing forwards (using the for illustration): there are two key differences with backpropagation: Computing in terms of avoids the obvious duplicate multiplication of layers and beyond. Multiplying starting from – propagating the error backwards – means that each step simply multiplies a vector () by the matrices of weights and derivatives of activations . By contrast, multiplying forwards, starting from the changes at an earlier layer, means that each multiplication multiplies a matrix by a matrix. This is much more expensive, and corresponds to tracking every possible path of a change in one layer forward to changes in the layer (for multiplying by , with additional multiplications for the derivatives of the activations), which unnecessarily computes the intermediate quantities of how weight changes affect the values of hidden nodes. Adjoint graph For more general graphs, and other advanced variations, backpropagation can be understood in terms of automatic differentiation, where backpropagation is a special case of reverse accumulation (or "reverse mode"). Intuition Motivation The goal of any supervised learning algorithm is to find a function that best maps a set of inputs to their correct output. The motivation for backpropagation is to train a multi-layered neural network such that it can learn the appropriate internal representations to allow it to learn any arbitrary mapping of input to output. Learning as an optimization problem To understand the mathematical derivation of the backpropagation algorithm, it helps to first develop some intuition about the relationship between the actual output of a neuron and the correct output for a particular training example. Consider a simple neural network with two input units, one