A complete eigenvector basis for the restricted operator Let $X$ be a (not necessarily bounded) selfadjoint linear operator on a Hilbert space $H$ and let $M$ be a closed subspace such that $X(M) \subset M$. 

Suppose that $X$ admits an orthonormal basis of eigenvectors. Does it follow that $X|_M$ admits an orthonormal basis of eigenvectors too?

I think that the answer is 'yes' if $X$ commutes with the orthoprojection of range $M$: 
$$PX \subset XP,$$
but I don't know what happens without this hypothesis. What do you think? 
Thank you.
 A: Here are the details of Jonas's suggestion.  Let $X$ be self-adjoint with dense domain $D(X)$, and let $M$ be a closed subspace with $M\subseteq D(X)$ and $X(M)\subseteq M$.  Let $P$ be the orthogonal projection onto $M$.  Then $D(PX) = D(X)$ while $D(XP)=H$ as $P$ has range $M\subseteq D(X)$.  For $\xi\in H$, let $\xi_0=P(\xi), \xi_1=\xi-P(\xi)$, and let $\eta\in D(X)$.  Then $$ (PX\eta|\xi) = (PX\eta|\xi_0) + (PX\eta|\xi_1) = (PX\eta|\xi_0)
= (X\eta|P\xi_0) = (X\eta|\xi_0) $$
as $PX\eta\in M$ and $\xi_1\in M^\perp$.  As $\xi_0\in M\subseteq D(X)$ and $X$ is self-adjoint,
$$ (X\eta|\xi_0) = (\eta|X\xi_0) = (\eta|PX\xi_0) = (P\eta|X\xi_0) = (XP\eta|\xi_0), $$
as $X\xi_0 \in X(M) \subseteq M$.  Similarly, $(XP\eta|\xi_1) = 0$ as $XP\eta \in X(M) \subseteq M$ and $\xi_1\in M^\perp$.   As $\xi$ was arbitrary, this shows that $XP\eta=PX\eta$.  So we've shown that
$$ D(PX) \subseteq D(XP), PX\eta=XP\eta \ (\eta\in D(X)) \implies
PX \subseteq XP. $$
As the OP claimed, this is enough.  If $e$ is an eigenvector of $X$ then $PXe = P\lambda e = \lambda Pe$, and by the above, this also is equal to $XPe$.  So $Pe\in M$ is an eigenvector for $X$ (unless it's zero!)  As the original collection of eigenvectors has desne linear span, so does the projection onto $M$.
