# The theory behind backpropogation, gradient calculation

I am reading a book about Neural Networks, that explains the backpropagation algorithm. It explains that the error function is the sum of error of all inputs, and that the algorithm minimizes this sum, which makes perfect sense to me, but than in goes on stating that to achieve that the gradient is calculated for each input, and then summed up. This last step is not understable to me.

Is it implying that the gradient of the sum of all errors (from all inputs) is equal to sum of gradients (from all inputs), that is - that the sum of gradients equals the gradient of sum?

This seems to me like an non trivial step, but it is not explained in the book.

• This is a basic property of the gradient, namely linearity: $\nabla (\alpha f + \beta g) = \alpha \nabla f + \beta \nabla g$. Commented Sep 18, 2015 at 15:08
• right, thanks. somehow this linearity was counterintuitive to me. Commented Sep 18, 2015 at 16:54

The gradient, just like the derivative, is linear: for functions $f,g$ on the same variables and scalars $\alpha,\beta$: $$\nabla(\alpha f + \beta g) = \alpha \nabla f + \beta \nabla g.$$