I am learning a machine learning class online from Stanford, namely CS 229. There is one section about deep learning and back-propagation in deep learning.

The network looks like:

[![Network Structure][1]][1] 

The forward propagation can be defined as:

[![Forward Calculation][2]][2]

where g is the activation function. 

The dimensions of each variable can also be given as:

[![Dimensions][3]][3]  

Now, for back-propagation, by using chain rule, we can get:

[![Chain Rule][4]][4]

To match up with the dimensions, we have:

[![Results][5]][5]

I know that after applying chain rule, the normal way is to calculate generalized Jacobian matrix and do matrix multiplication. However, the dimension of each part in chain rule above does not match what generalized Jacobian matrix will give us. For example, for the last term in chain rule, the dimension from generalized Jacobian matrix should be (2 X 1) X (2 X 3). However, what course notes say is 2 X 3. 

Why is it true? 

Any comments are appreciated! 



  [1]: https://i.sstatic.net/FeNRC.png
  [2]: https://i.sstatic.net/ASrQU.png
  [3]: https://i.sstatic.net/3X37W.png
  [4]: https://i.sstatic.net/spLta.png
  [5]: https://i.sstatic.net/wLh8t.png