I have this equation which is basically a maximum likelihood equation for EM-algorithm. $$L(\theta) = \sum_{i=1}^n{\ln{(\sum_{j=1}^kw_jp_j(x_i;\theta_j))}}$$ I'm trying to derive a partial derivative by $\theta_j$ from it. What I'm getting is: $$\frac{\partial L}{\partial \theta_j} = \sum_{i=1}^n{w_j\over p(x_i)}\frac{\partial p_j(x_i;\theta_j)}{\partial \theta_j}$$ where $$p(x_i)=\sum_{j=1}^kw_jp_j(x_i;\theta_j)$$ This derivative should be equal to 0 and I can multiply it by $p_j(x_i;\theta_j)$ and get $$\frac{\partial L}{\partial \theta_j} = \sum_{i=1}^n{w_jp_j(x_i;\theta_j)\over p(x_i)}\frac{\partial p_j(x_i;\theta_j)}{\partial \theta_j}=\frac{\partial \sum_{i=1}^n g_{ij}p_j(x_i;\theta_j)}{\partial \theta_j}=0$$ Which is almost as it should be. But the problem is that I somewhere miss the logarithm as it should look like this: $$\frac{\partial \sum_{i=1}^n g_{ij}\ln p_j(x_i;\theta_j)}{\partial \theta_j}=0$$ Where am I wrong?
$g_{ij}={w_jp_j(x_i;\theta_j)\over p(x_i)}$ which is obtained in the first step of the EM-algorithm.
It is not because your derivative is zero that you can multiply all the terms in your summation by different weights $p_j(x_i;\theta_j)$ (they are different because they change with $x_i$). You should as mentioned by Math Lover, multiply and divide by $p_j(x_i;\theta_j)$ and get $$\frac{\partial L}{\partial \theta_j}(\theta) = \sum_{i=1}^n{w_jp_j(x_i;\theta_j)\over p(x_i)}\frac{1}{p_j(x_i;\theta_j)} \frac{\partial p_j(x_i;\theta_j)}{\partial \theta_j}=\frac{\partial \sum_{i=1}^n g_{ij}\log(p_j(x_i;\theta_j))}{\partial \theta_j}=0.$$