The pic is from Andrew Ng's Machine Learning Class. It's about derivation in EM algorithm.
I am not sure how to transfer the second line to the third line.
Anyone has some good idea?
So first you can move the $\frac{1}{2}$ out, then you can switch the first sum and the gradient (as the gradient is a linear operator).
So you get:
$A=-\frac{1}{2}\sum_{i=1}^{m}\nabla_{\mu_{l}}\sum_{j=1}^{k}w_{j}^{i}f^{i}(\mu_{j})$
(with $f^{i}(\mu)=(x^{i}-\mu)^{T}\Sigma^{-1}(x^{i}-\mu)$)
The second sum collapses as the gradient is taken with respect to $\mu_{l}$ which is only present in the l-term of the second sum.
Then you have :
$A=-\frac{1}{2}\sum_{i=1}^{m}\nabla_{\mu_{l}}w_{l}f(\mu_{l})$
You can move the $w_{l}$ out of the gradient also which leads to:
$A=-\frac{1}{2}\sum_{i=1}^{m}w_{l}\nabla_{\mu_{l}}f(\mu_{l})$
Then you only developp f and you get the third line.
(In details:
$f^{i}(\mu_{l})=(x^{i})^{T}\Sigma_{l}^{-1}x^{i}-(x^{i})^{T}\Sigma_{l}^{-1}\mu_{l}-\mu_{l}^{T}\Sigma_{j}^{-1}x^{i}+\mu_{l}^{T}\Sigma_{l}^{-1}\mu_{l}$
The first term we don't care about as its derivative wth respect to $\mu_{l}$ is 0. And as all the terms are scalar we can transpose the second term without asking ourselves too much questions ($\Sigma$ being symmetrical as a covariance matrix helps a lot too (its inverse is symmetrical too: why)):
$f^{i}(\mu_{l})=Constant-((x^{i})^{T}\Sigma_{l}^{-1}\mu_{l})^{T}-\mu_{l}^{T}\Sigma_{l}^{-1}x^{i}+\mu_{l}^{T}\Sigma_{l}^{-1}\mu_{l}$ (we have transposed the second term)
$f^{i}(\mu_{l})=Constant-(\Sigma_{l}^{-1}\mu_{l})^{T}((x^{i})^{T})^{T}-\mu_{l}^{T}\Sigma_{l}^{-1}x^{i}+\mu_{l}^{T}\Sigma_{l}^{-1}\mu_{l}$ (We used $(AB)^{T}=(B)^{T}(A)^{T}$)
$f^{i}(\mu_{l})=Constant-(\mu_{l})^{T}(\Sigma_{l}^{-1})^{T}(x^{i})-\mu_{l}^{T}\Sigma_{l}^{-1}x^{i}+\mu_{l}^{T}\Sigma_{l}^{-1}\mu_{l}$
$f^{i}(\mu_{l})=Constant-(\mu_{l})^{T}(\Sigma_{l}^{-1})(x^{i})-\mu_{l}^{T}\Sigma_{l}^{-1}x^{i}+\mu_{l}^{T}\Sigma_{l}^{-1}\mu_{l}$ (We used ($\Sigma^{-1})^{T}=\Sigma^{-1}$) Which gives us the answer.)