<s>[INST] Hamiltonian for a magnetic field An atom has an electromagnetic moment, $\mu = -g\mu_B S$ where S is the electronic spin operator ($S=S_x,S_y.S_z$) and $S_i$ are the Pauli matrices, given below. The atom has a spin $\frac{1}{2}$ nuclear magnetic moment and the Hamiltonian of the system is 
\begin{gather*}
    H = -\mu .B + \frac{1}{2}A_0S_z
\end{gather*}
The first term is the Zeeman term, the second is the Fermi contact term and $A_0$ is a real number. Obtain the Hamiltonian in matrix form for a magnetic field, $B=B_x,B_y,B_z$. Show that when the atom is placed in a magnetic field of strength B, aligned with the z axis, transitions between the ground and excited states of the atom occur at energies: 
\begin{gather*}
    E= g\mu_B B + \frac{1}{2}A_0
\end{gather*}
The Pauli Matrices are:
\begin{gather*}
    S_x = \frac{1}{2}
\begin{bmatrix}
    0 & 1 \\ 1 & 0
\end{bmatrix} ,
    \ S_y = \frac{1}{2}
\begin{bmatrix}
    0 & -i \\ i & 0
\end{bmatrix} ,
   \ S_z = \frac{1}{2}
\begin{bmatrix}
    1 & 0 \\ 0 & -1
\end{bmatrix} 
\end{gather*}
Where do I even start for a solution to this problem I am unclear as to how to formulate the B matrix. If I can get that hopefully the second part will become apparent to prove
 [/INST] The Hamiltonain is calculated as
\begin{align}
H =&  \, g \mu_B \, \left(B_x S_x + B_y S_y + B_z S_z\right) \, + \, \frac{1}{2}A_0 S_z = \\
=&  \, \frac{g \mu_B}{2} \, \left(B_x \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} + B_y  \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} + B_z  \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\right) \, + \, \frac{1}{4}A_0  \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \\
=& \, \frac{g \mu_B}{2} \, \begin{bmatrix} B_z & B_x-iB_y \\ B_x+iB_y & -B_z \end{bmatrix} \, + \, \frac{1}{4}  \begin{bmatrix} A_0 & 0 \\ 0 & -A_0 \end{bmatrix} \\
\end{align}
In the case of a constant magnetic field aligned with the $z-$axis, $B_x = B_y=0$ and $B_z = B$. Then 
$$H = \, \frac{g \mu_B}{2} \, \begin{bmatrix} B_z & 0 \\ 0 & -B_z \end{bmatrix} \, + \, \frac{1}{4}  \begin{bmatrix} A_0 & 0 \\ 0 & -A_0 \end{bmatrix} = \frac{1}{2}\begin{bmatrix} g\mu_B\, B_z+\frac{1}{2}A_0 & 0 \\ 0 & -  \, g\mu_B\,B_z-\frac{1}{2}A_0 \end{bmatrix} $$ 
By solving the linear eigenvalue equations
$$H \, | \psi \rangle = \lambda\, | \psi \rangle $$ you would get the basis energy states (the eignevectors $| \psi \rangle$) and their energy levels (the eigenvalyes $\lambda$). Since $H$ is a 2 by 2 matrix, so 
$$ | \psi \rangle = \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix}$$ the equation is
$$\begin{bmatrix} \frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 & 0 \\ 0 & -  \, \frac{1}{2} g\mu_B\,B_z-\frac{1}{4}A_0 \end{bmatrix} \, \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix} = \lambda \, \begin{bmatrix}\psi_1 \\ \psi_2 \end{bmatrix}$$ so it is easy to see that the egienvectros are
$$\begin{bmatrix} 1 \\ 0 \end{bmatrix} \text { and } \begin{bmatrix} 0 \\ 1\end{bmatrix}$$ with energy levels
$$ \frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 \,\, \text { and }\,\, - \frac{1}{2} g\mu_B\, B_z-\frac{1}{4}A_0$$ respectively. There are only two eigenstates and the transition from on to the other happens when the energy is equal to the difference of the energy levels, i.e. 
$$\left(\frac{1}{2} g\mu_B\, B_z+\frac{1}{4}A_0 \right) - \left( - \frac{1}{2} g\mu_B\, B_z-\frac{1}{4}A_0\right) =  g\mu_B\, B_z+\frac{1}{2}A_0$$
</s>