In this articel, I am trying to figure out how the authors arrived at $\hat{\pi}_k$. I am just stuck, and I appriciate any help.
Here is the problem:
$$Q_{1}(\gamma , \pi; \theta^{(m)}) = \sum_{i=1}^{n} \sum_{k=1}^{K} z^{(m)}_{ik} \log(\pi_k) - n\gamma \sum_{k=1}^{K} [\log (\epsilon + \pi_k) - \log(\epsilon)]$$
The mixing proportions are updated by maximizing the equation above with respect to the mixing proportions $\mathbf{\pi}$ subject to the constraint $\sum_{k=1}^{K} \pi_k = 1$. Hence, we introduce a Lagrange multiplier $\alpha$ to take into account the constraint and aim to solve the following set of equations:
$$\frac{\partial}{\partial \pi_k} \left[ \sum_{i=1}^{n} \sum_{k=1}^{K} z^{(m)}_{ik} \log(\pi_k) - n {\gamma} \sum_{k=1}^{K} \log\left(\epsilon+\pi_{k}\right)- \alpha \left( \sum_{k=1}^{K} \pi_k - 1 \right) \right] = 0.$$
Given that $\epsilon$ is very close to zero, a straightforward calculation gives $$\hat{\pi}_k = \max \left\{ 0, \frac{1}{1 - K\gamma} \left[ \frac{1}{n} \sum_{i=1}^{n} z_{ik}^{(m)} - \gamma \right] \right\}.$$
Update: Based on @Tony Mathew's comment (Thank you! )
Given the Lagrangian: $$ \mathcal{L} = \sum_{i=1}^{n} \sum_{k=1}^{K} z^{(m)}_{ik} \log(\pi_k) - n\gamma \sum_{k=1}^{K} \log(\epsilon + \pi_k) - \alpha \left( \sum_{k=1}^{K} \pi_k - 1 \right) $$
We need to find: $$ \frac{\partial \mathcal{L}}{\partial \pi_j} = \frac{\partial}{\partial \pi_j} \left[ \sum_{i=1}^{n} \sum_{k=1}^{K} z^{(m)}_{ik} \log(\pi_k) - n\gamma \sum_{k=1}^{K} \log(\epsilon + \pi_k) - \alpha \left( \sum_{k=1}^{K} \pi_k - 1 \right) \right] $$
for each $j$ from $1$ to $K$.
Differentiate the first term: $$ \frac{\partial}{\partial \pi_j} \left( \sum_{i=1}^{n} \sum_{k=1}^{K} z^{(m)}_{ik} \log(\pi_k) \right) = \sum_{i=1}^{n} z^{(m)}_{ij} \frac{1}{\pi_j} $$
Differentiate the second term: $$ -n\gamma \frac{\partial}{\partial \pi_j} \left( \sum_{k=1}^{K} \log(\epsilon + \pi_k) \right) = -n\gamma \frac{1}{\epsilon + \pi_j} $$ since $\epsilon$ is close to $0$, then it becomes $-n\gamma \frac{1}{\pi_j}$
Differentiate the third term: $$ -\alpha \frac{\partial}{\partial \pi_j} \left( \sum_{k=1}^{K} \pi_k - 1 \right) = -\alpha $$
Combining these, we get: $$ \frac{\partial \mathcal{L}}{\partial \pi_j} = \sum_{i=1}^{n} z^{(m)}_{ij} \frac{1}{\pi_j} - n\gamma \frac{1}{\pi_j} - \alpha = 0 $$
This equation must be solved for each $j$ from 1 to $K$. But I still do not see how they will end up as the equation in the article, given what I did above is correct.
From
$$ \frac{\partial \mathcal{L}}{\partial \pi_j} = \sum_{i=1}^{n} z^{(m)}_{ij} \frac{1}{\pi_j} - n\gamma \frac{1}{\pi_j} - \alpha = 0 $$
multiplying by $\pi_j$ we have
$$ \sum_{i=1}^{n} z^{(m)}_{ij} - n\gamma - \alpha\pi_j = 0 $$
now summing up $j$
$$ \sum_{j=1}^K\sum_{i=1}^{n} z^{(m)}_{ij} - n\gamma K - \alpha = 0 \Rightarrow \alpha = \sum_{j=1}^K\sum_{i=1}^{n} z^{(m)}_{ij} - n\gamma K $$
and finally
$$ \pi_j = \frac{\sum_{i=1}^{n} z^{(m)}_{ij}-n\gamma}{\sum_{j=1}^K\sum_{i=1}^{n} z^{(m)}_{ij} - n\gamma K} $$