Simple question about projection operators In John Preskill's lecture notes, I've encountered a brief discussion about observables. He writes some operator $A$ in a Hilbert space as 
$$A=\sum_n{a_nP_n},$$
where $P$ is the projection operator and $a_n$ denotes an eigenvalue. My question is, why does he say that $P_n=|n\rangle \langle n|$ if $a_n$ is a non-degenerate eigenvalue? From my understanding, $P_n$ is usually written this way, with only one element, $1$, for the n-th row and n-th column. What would $P_n$ look like if $a_n$ was degenerate? Also, does this formula assume a specific basis representation for $P_n$?
 A: If an eigenvalue is degenerate it means that there are multiple linearly independent (orthogonal, in the case of hermitian operators) eigenvectors with the same eigenvalue $a_n$. Explicitely, there is a set of orthogonal vectors $|n_k\rangle$, $k=1...K$, such that $A|n_k\rangle=a_n|n_k\rangle$. Notice that any linear combination of these eigenvector is still an eigenvector of eigenvalue $a_n$, hence this set form a basis for the eigenspace of $A$ with eigenvalue $a_n$.
$P_n$ in the spectral decomposition is the projector onto the space of eigenvectors with eigenvalues $a_n$, in the degenerate case this space has basis $\{|n_k\rangle\}_{k=1}^K$, hence $P_n$ looks like
$$P_n=\sum_{k=1}^K |n_k\rangle\langle n_k|$$
The non degenerate case is just the particular case with $K=1$, i.e. when the eigenspace is $1$ dimensional, and the projector is the familiar one.
The expression
$$A=\sum_n a_n P_n $$ 
alone is not basis dependent, because it only depends on the eigenvalues of $A$. Once you chose a particular representation for $P_n$, like the one I wrote earlier, then you committed to a particular basis. You could express the projectors in any other basis and still have a valid expression.
A: When we write the operator this way we are expanding it in terms of the eigenstates of the operator. This is evident by making it act on any one of the eigenstates say $|m\rangle$. 
$$\begin{align}
A|m\rangle=a_m|m\rangle=\sum_n a_n|n\rangle\langle n|m\rangle\\
= \sum_n a_n|n\rangle\delta_{n,m}=a_m|m\rangle
\end{align}$$
The validity of going from the first line to the second line hinges on the fact that all the eigenstates are orthogonal. But if we have degeneracy, we can take linear combination of the degenerate states that are no longer orthogonal but are still the eigenstates. 
