What's the dimension of dA/dZ after vectorized?

In logistic regression, assume n examples in total, so dim(A) = (1, n) = dim(Y) = dim(z).

  1. What is the dimension of dA/dZ?
  2. Why?

(Please note that the symbol da/dz means the derivative of A to Z, which is different from the “dz” in our code.)


The activation function is applied “elementwise”, so the derivatives are also computed “elementwise”. That means that the shape of \displaystyle \frac {\partial A}{\partial Z} is the same shape as A and Z. In Prof Ng’s notation, that would be 1 x m, where m is the number of input samples.