Let $\mathscr{H}$ be a complex Hilbert space and $\mathscr{B}(\mathscr{H})$ be the Banach space of bounded linear operators on $\mathscr{H}$. This is a $C^{*}$-algebra and we consider a $*$-subalgebra $\mathscr{M}$ of $\mathscr{B}(\mathscr{H})$. Define: $$\mathscr{M}' := \{T \in \mathscr{B}(\mathscr{H}): \mbox{$TS = ST$ holds for every $S \in \mathscr{M}$}\}$$
Moreover, if $\mathscr{S}$ is a vector subspace of $\mathscr{H}$, it is said to be invariant with respect to $\mathscr{M}$ if $S\psi \in \mathscr{S}$ holds for every $\psi \in \mathscr{S}$ and every $S \in \mathscr{M}$.
I want to prove the following: if there are no invariant subspaces of $\mathscr{H}$ with respect to $\mathscr{M}$, then $\mathscr{M}' = \{\alpha 1: \alpha \in \mathbb{C}\}$, where $1$ is the identity map on $\mathscr{B}(\mathscr{H})$. I have no idea how to start it. Can someone give me any help?
The key is to realize that closed subspaces correspond with orthogonal projections.
So if $\mathscr S$ is a subspace with corresponding orthogonal projection $P$, then $\mathscr S$ is invariant for $\mathscr M$ if and only if $TP=PTP$ for all $T\in\mathscr M$. Using that $\mathscr M$ is a $*$-algebra, this in turn is equivalent to $TP=PT$ for all $T\in\mathscr M$.
The other ingredient you need is that $\mathscr M'$ is a von Neumann algebra and so it is generated by its projections.