The ground state wave function is
\[\Psi = e^{i\varphi} \Psi_g.\]Then the state vector could be written just with the deffinition:
Hamiltonian should act on the state vector as it acts on the wave function:
\[ \hat{\mathcal{H}} \Psi = \hat{\mathcal{H}} (\alpha \Psi_e + \beta \Psi_g) = \alpha E_e \Psi_e + \beta E_g \Psi_g.\]Thus, we can write the Hamiltonian as the matrix:
\[ \hat{\mathcal{H}}\begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \begin{pmatrix} \alpha E_e \\ \beta E_g \end{pmatrix}.\]
Let's rewrite Schrödinger's equation component by component:
\[i\hbar \begin{pmatrix} \dot{\alpha} \\ \dot{\beta} \end{pmatrix} = \begin{pmatrix}
E_e \alpha \\ E_g \beta \end{pmatrix}.\]
We got the system of two independent equations for $\alpha$ and $\beta$, which have the complex exponent solutions:
\[ \alpha(t) = \alpha(0) e^{-\frac{iE_et}{\hbar}}, \quad \beta(t) = \beta(0) e^{-\frac{iE_gt}{\hbar}}.\]
Let's calculate straght forward:
\[ \langle x(t) \rangle = \frac{1}{2} \begin{pmatrix} e^{\frac{iE_et}{\hbar}} & e^{\frac{iE_gt}{\hbar}} \end{pmatrix} \begin{pmatrix} 0 & a \\ a & 0 \end{pmatrix} \begin{pmatrix} e^{-\frac{iE_et}{\hbar}} \\ e^{-\frac{iE_gt}{\hbar}} \end{pmatrix} = \frac{a}{2} \left( e^{\frac{it}{\hbar} (E_e - E_g) } + e^{-\frac{it}{\hbar} (E_e - E_g) } \right) = a \cos \frac{(E_e-E_g)t}{\hbar} \]