Suppose I have an electron in a magnetic field given by:
$$\vec{B}=B\hat{z}$$
The potential energy of this system is given by:
$$U=-\vec{\mu} \cdot \vec{B}=\frac{g\mu_B}{\hbar}\vec{S} \cdot \vec{B}$$
Here, $\vec{\mu}$ is the magnetic moment of the electron, $g$ is the Lande $g$-factor, $\mu_B$ is the Bohr Magneton, and $\vec{S}$ is the spin of the electron.
This shows that from a statistical mechanics perspective, electrons with spin oriented in the direction of the magnetic field have higher energy than the ones with spin antiparallel to $B$. Moreover, magnetic moment and spin point in the opposite directions.
Anyway, when solving, we simply note that:
$$\vec{S}\cdot\vec{B}=\hat{S_3} B_z$$
Since the electrons are either in $|\uparrow\rangle$ or in the $|\downarrow\rangle$ state, the expectation value of this is nothing but the eigenvalues corresponding to these states, i.e. $\frac{\hbar}{2}$ and $-\frac{\hbar}{2}$ respectively.
This is how we obtain the energy for parallel and antiparallel configurations of the spin and the magnetic field.
From what I understand, till now, we were basically finding the expectation value of $\hat{U}$ for parallel and antiparallel spins.
In general, we should have,
$$\hat{U}=\frac{g\mu_B}{\hbar}\vec{S} \cdot \vec{B}=\frac{g\mu_B}{\hbar}\frac{\hbar}{2}\vec{\sigma} \cdot \vec{B}\approx\mu_B\space\hat{\sigma_3}{B_z}$$
To obtain the energy of the parallel configuration, we would take $\langle\uparrow |\hat{U}|\uparrow\rangle$.
Similarly, we can obtain an expression for the antiparallel configuration.
My question is, whether:
$$\hat{U}=+\mu_B\space \hat{\sigma_3} B_z$$
or is it:
$$\hat{U}=-\mu_B\space \hat{\sigma_3} B_z \ \ \ ?$$
Since magnetic moment and angular momentum should be in the opposite direction for negatively charged particles, I believe it should be the former. Wikipedia agrees with this viewpoint.
However, in many texts on quantum statistical mechanics, like Pathria for example, the latter is said to be true.
Can someone point out which one of the two expressions is correct?