Derivative of sigmoid function that contains vectors

You have $$w^Tx=\sum_{i=1}^D w_ix_i$$ For the derivative with respect to $w_i$ you can write the function as $$\frac 1{1+e^{-\sum_{j=1}^D w_jx_j}}=\frac 1{1+e^{-\sum_{j=1,j\ne i}^D w_jx_j}e^{-w_ix_i}}$$ The term with the sum does not contain $w_i$, so you can consider it a constant when you take the derivative.


Define the scalar variable and its differential $$\eqalign{ \alpha &= w^Tx = x^Tw \cr d\alpha &= x^Tdw }$$ The derivative of the logistic function for a scalar variable is simple. $$\eqalign{ f &= \frac{1}{1+e^{-\alpha}} \cr f' &= f-f^2 \cr }$$ Use this to write the differential, perform a change of variables, and extract the gradient vector. $$\eqalign{ df &= \big(f-f^2\big)\,d\alpha \cr &= \big(f-f^2\big)\,x^Tdw \cr &= g^Tdw \cr \frac{\partial f}{\partial w} &= g = \big(f-f^2\big)\,x \cr }$$


$$f(\boldsymbol{w}) = \dfrac{1}{1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right]}$$

$$\implies \dfrac{\partial f}{\partial w_i} = \dfrac{0\cdot(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])-1\cdot\dfrac{\partial}{\partial w_i}(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])}{(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])^2}$$ $$=-\dfrac{\dfrac{\partial}{\partial w_i}(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])}{(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])^2}$$ $$=-\dfrac{\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right]\dfrac{\partial}{\partial w_i}(-\boldsymbol{w}^T\boldsymbol{x})}{(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])^2} $$ $$=\dfrac{\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right]x_i}{(1+\exp\left[-\boldsymbol{w}^T\boldsymbol{x}\right])^2}$$ $$=f(\boldsymbol{w})\left[1- f(\boldsymbol{w})\right]x_i$$

If you take the derivative with respect to $\boldsymbol{w}$ you will simply get a stacked vector of these components.