why does linear regression converge slower if we use two layers of linear module?
I have tested linear regression of 1d input and 1d output by pytorch using three different ways. 


One is using the formula from linear algebra, 
the other one is using nn.Linear(1,1). These two always give identical solution. 
However, when I use two layers: nn.Linear(1,2) and nn.Linear(2,1) sequentially for the third approach, the result does not converge at first. After I set learning rate much smaller and epoch number much bigger, it finally shows its convergence. 


In theory, because composition of linear transform is again linear transform, they shall give the same answer no matter one layer and two layers.
Intuitively, I thought more neurons and layers make things more efficient. But this shows its opposite and I do not understand.

The code is in github. Please directly jump in the last shell for the third approach.
The expected result is given in both first and second approaches in the notebook.

This is not surprising. With 2 Linear layers which, as you know, effectively express what a single Linear layer could, you're introducing a bunch of redundant degrees of freedom - different assignments of values to the two layers, which result in the same effective transformation. The optimizer can therefore "walk around" different solutions, which look the same in terms of the loss function (because they mathematically are the same), without converging to a single one. In other words, you cannot converge to a solution if there is an infinite number of them, all looking the same to you.
