Writing the matrix representation of a Hamiltonian Ive been scratching my head for the last couple days about this one question:
Consider a particle $|P\rangle$ and its anti-particle $|\bar{P}\rangle$ as a two level system with identical energy E. The Hamiltonian is given by;
$$ \hat{H} = E(|P\rangle\langle P| + |\bar{P}\rangle\langle\bar{P}|) + V(|\bar{P}\rangle\langle P| + |P\rangle\langle\bar{P}|) $$
Where V is a real number. The question requires me to write down the $2 \times 2$ matrix representation of $\hat{H}$ in the basis of $|P\rangle$ and $|\bar{P}\rangle$. We also assume that the basis is orthonormal.
I don't really know how to go about this, I bet it is something easy and obvious but this is new to me.
Attempted solution:
As far as I know you're supposed to  write the matrix as this:
$$
\begin{bmatrix}
\langle P|\hat{H}|P\rangle & \langle P|\hat{H}|\bar{P}\rangle \\
\langle\bar{P}|\hat{H}|P\rangle & \langle\bar{P}|\hat{H}|\bar{P}\rangle 
\end{bmatrix} 
$$
In this case for the top left entry i get;
$$
\langle P|E|P\rangle\langle P|P\rangle + \langle P|E|\bar{P}\rangle\langle\bar{P}|P\rangle + \langle P|V|\bar{P}\rangle\langle P|P\rangle + \langle P|V|P\rangle\langle\bar{P}|P\rangle = E
$$
Doing the same procedure for the other entries I end up with the matrix;
$$
\begin{bmatrix}
E & V \\
V & E 
\end{bmatrix} 
$$
Is this it? It seems way too easy and basic to me.
Thanks in advance.
 A: That looks okay.  The combination of vectors in the first term is the identity operator, |P)(P| + |Q)(Q|, and the other is a permutation (row swap).
A: It seems to be the correct answer. A general state in the two level system will be given by
$$|\psi\rangle = \alpha|P\rangle +\beta|\bar{P}\rangle$$
with $|\alpha|^{2}+|\beta|^{2}=1$. Consider the action of the Hamiltonian $\hat{H}$ on $|\psi\rangle$,
$$[E(|P\rangle\langle P| + |\bar{P}\rangle\langle\bar{P}|) + V(|\bar{P}\rangle\langle P| + |P\rangle\langle\bar{P}|)](\alpha|P\rangle +\beta|\bar{P}\rangle)=$$ $$\ \ \ \ \alpha[E(|P\rangle\langle P|P\rangle+|\bar{P}\rangle\langle\bar{P}|P\rangle)+V(|\bar{P}\rangle\langle P|P\rangle + |P\rangle\langle\bar{P}|P\rangle)]+\\\beta[E(|P\rangle\langle P|\bar{P}\rangle+|\bar{P}\rangle\langle\bar{P}|\bar{P}\rangle)+V(|\bar{P}\rangle\langle P|\bar{P}\rangle + |P\rangle\langle\bar{P}|\bar{P}\rangle)]$$
But we know that $\langle P|P\rangle = \langle\bar{P}|\bar{P}\rangle = 1$ and $\langle P|\bar{P}\rangle = 0$ because the basis is orthonormal, so the above equation reduces to:
$$\hat{H}|\psi\rangle = \alpha(E|P\rangle+V|\bar{P}\rangle)+\beta(E|\bar{P}\rangle+V|P\rangle)=(\alpha E+\beta V)|P\rangle+(\alpha V+\beta E)|\bar{P}\rangle$$
If we use the matrix representation $\alpha|P\rangle +\beta|\bar{P}\rangle\to (\alpha \ \ \ \beta)^{T}$ and the matrix you state in your question, we have:
$$\begin{pmatrix} E & V \\
V & E \end{pmatrix}
\begin{pmatrix} \alpha \\
\beta \end{pmatrix} = \begin{pmatrix} \alpha E+\beta V \\
\alpha V+\beta E \end{pmatrix}$$
Which you can easily tell is the same as what we got by doing the complete operation, but much simpler.
