Backpropagation as a Linear Solve
In the previous post on backpropagation, we showed that backpropagation is a special case of the adjoint method. In this post we skip the adjoint description and instead derive the same result directly from the chain rule.
1. The forward relation
We denote the data by and the parameters by . The network has layers, each of which is a function that takes as input outputs from previous layers () as well as the parameters (), and produces the next layer output . The full forward pass, including all layer outputs, can be expressed as
(1)
where and is the size of .
We introduce the projection that takes out relevant layer-outputs, i.e.11 Often just picks out the last layer, i.e.
(2)
Using this the loss function can be written as
(3)
where is the data loss and is a regularization term.
2. Differentiating the network
Applying the chain rule to (1), we have
(4)
Applying the projection , it further follows that
(5)
At this point it is worth looking at the structure of the matrices. As the th layer depends only on previous outputs, the matrix is block lower-triangular with identity blocks on the diagonal22 The sparsity pattern of the strictly lower/upper part of a (block) triangular matrix is a directed acyclic graph (DAG), which is often how backpropagation is introduced.. The triangular structure makes it efficient to solve the linear system
(6)
Using it follows that
(7)
In practice, as seen in the next section, one rarely needs to form as a full matrix; it suffices to define products with it.
3. A scalar loss
Applying the chain rule to (3), we have
(8)
Given that is a vector of length we have that the product is a vector of length . It is therefore of interest to first form and then solve , so that
(9)
which is equivalent to the final result of the adjoint method (see the previous post on backpropagation). Note that here is the negative of the adjoint variable of the previous post, which absorbs the sign of there.
Cite this post
@misc{paltorp2026backpropagationlinearsolve, author = {Paltorp, Mikkel}, title = {{Backpropagation as a Linear Solve}}, year = {2026}, month = oct, url = {https://mipals.github.io/pdf/2026/10-05-backpropagation-linear-solve/backpropagation-linear-solve.pdf}, note = {Blog post}}