# How to compute conditional expectation of a log function

I've been studying the Expectation Maximization algorithm. According to the formula shown here, what I have to do in the M step is to compute a new $\theta$ that maximizes the conditional expectation of the log function, which is $\ln P[X, z|\theta]$: http://i86.photobucket.com/albums/k118/ProtoMan_03/expectation_zps2689ab59.jpg

( The picture above can be acquired in page 8 of this tutorial: http://www.seanborman.com/publications/EM_algorithm.pdf )

However, in the coin toss example below: http://www.nature.com/nbt/journal/v26/n8/full/nbt1406.html?pagewanted=all

$\ln P[X, z|\theta]$ is nowhere to be found, and they don't prove how the new $\theta^{t+1}$ they got after each iteration is better than the $\theta^t$ previously acquired.

-

Note that $$\sum_z P[z|X,\theta_n] \ln P[X,z|\theta] \\=\sum_\color{red}z\bigg(\ln P[X,z|\theta]\bigg)\color{red}{P[z|X,\theta_n]} \\=E_{Z|X,\theta_n}\bigg(\ln P[X,z|\theta]\bigg)$$ Here probability distribution is $P[z|X,\theta_n]$ and summing over $z$. So, by the definition of expectation we get the desired result.