The question is on first picuture,and the part of solution is on the second picture.I am not quite understand the second picture meaning
(2)
The differential of $g(z)$ ,$g'(z)$, should be $\frac{-e^{-z}}{(1+e^{-z})^2}$,why is the $g'(z)$ equal to $a_i^{(l)}(1-a_i^{(l)})$?


$g(z)=\frac{1}{1+e^{-z}}$,then $$g'(z)=-(1+e^{-z})^{-2}(-e^{-z})=\frac{e^{-z}}{(1+e^{-z})^2}$$ Notice that there is no negative sign.
\begin{align} g'(z) &= \frac{e^{-z}}{(1+e^{-z})^2} \\ &=\frac{1}{1+e^{-z}}\cdot \frac{e^{-z}}{1+e^{-z}} \\ &= a\cdot \left(1 - \frac{1}{1+e^{-z}}\right)\\ &= a(1-a) \end{align}
where I let $a=g(z)$.