Taking the Derivative: Power Rule with Respect to Vector I'm trying to take the derivative of
\begin{equation}
\phi\left(\mathbf{x}\mathbf{\theta}\right)\mathbf{x}^{\top} \left(\frac{y-\Phi\left(\mathbf{x}\mathbf{\theta}\right)}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}\right)
\end{equation}
with respect to $\mathbf{\theta}$, where
$\mathbf{\theta}$ is a $p \times 1$ column vector, $\mathbf{x}$ is a $1 \times p$ row vector, (so that $\mathbf{x}\mathbf{\theta}$ is a scalar), $\Phi$ is a function (representing the normal CDF but this doesn't matter) with derivative $\phi$. So I'm trying to compute
\begin{equation}
\nabla_{\mathbf{\theta}} \phi\left(\mathbf{x}\mathbf{\theta}\right)\mathbf{x}^{\top} \left(\frac{y-\Phi\left(\mathbf{x}\mathbf{\theta}\right)}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}\right)
\end{equation}
I know that the answer ends up being
\begin{equation}
\frac{-[\phi(\mathbf{x}\mathbf{\theta})]^2\mathbf{x}^{\top}\mathbf{x}}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}+\mathbf{L}(\mathbf{x},\mathbf{\theta})[y-\Phi(\mathbf{x}\mathbf{\theta})]
\end{equation}
where $\mathbf{L}(\mathbf{x},\mathbf{\theta})$ is the Jacobian of \begin{equation}
\frac{\phi(\mathbf{x}\mathbf{\theta})\mathbf{x}^{\top}}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}
\end{equation}
However I try to get to the answer and get overwhelmed with the problem. Any help? Thank you very much!
 A: Aha - It helps to regroup the original equation
\begin{equation}
\phi\left(\mathbf{x}\mathbf{\theta}\right)\mathbf{x}^{\top} \left(\frac{y-\Phi\left(\mathbf{x}\mathbf{\theta}\right)}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}\right)
\end{equation}
instead as
\begin{equation}
\left(\frac{\phi\left(\mathbf{x}\mathbf{\theta}\right)\mathbf{x}^{\top}}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}\right)
\left(y-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right) \\
\end{equation}
Then it's easy to see where the answer comes from; take the derivative using the product rule, where the derivative of the right term is $-\phi(\mathbf{x}\mathbf{\theta})\mathbf{x}$. It gives
\begin{equation}
\frac{-[\phi(\mathbf{x}\mathbf{\theta})]^2\mathbf{x}^{\top}\mathbf{x}}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}+\mathbf{L}(\mathbf{x},\mathbf{\theta})[y-\Phi(\mathbf{x}\mathbf{\theta})]
\end{equation}
where $\mathbf{L}(\mathbf{x},\mathbf{\theta})$ is the Jacobian of \begin{equation}
\frac{\phi(\mathbf{x}\mathbf{\theta})\mathbf{x}^{\top}}{\Phi\left(\mathbf{x}\mathbf{\theta}\right)\left[1-\Phi\left(\mathbf{x}\mathbf{\theta}\right)\right]}
\end{equation}
the desired answer.
