I have trouble getting my head around manipulating Dirac notation, it's still new to me and I'm not used to it. I'm following the rotating wave approximation derivation for Rabi oscillations and light matter interactions.
I have $|e\rangle$, $|g\rangle$ as excited and ground state of a two level atom, my interaction Hamiltonian is $\hat{H}_I$.
I have calculated $$|e\rangle \langle e| \hat{H}_I |g\rangle \langle g| + |g\rangle \langle g| \hat{H}_I |e\rangle \langle e| = \frac{1}{2} \hbar Xe^{i\omega t} |g\rangle \langle e| + \frac{1}{2}\hbar X^*e^{-i\omega t} |e\rangle \langle g|, $$
where $X=-eE_0d_{12}/\hbar$ and $d_{12}$ is the dipole matrix element. This should reduce down to
$$\hat{H}_I = \frac{1}{2} \hbar Xe^{i\omega t} |g\rangle \langle e| + \frac{1}{2}\hbar X^*e^{-i\omega t} |e\rangle \langle g| $$
given that $|e\rangle \langle e| +|g\rangle \langle g| =1 $ by completeness. I am sure this is just a simple step but I am unsure of what to do and what not to do manipulating Dirac notation, I don't know how to proceed. Spent a few hours getting this far, would be grateful if someone dug me out.