TeX source:
\begin{split} \mathbf{X} &= 1\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}1\\1\end{bmatrix}\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\end{bmatrix} - 1\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}-1\\1\end{bmatrix}\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}-1&1\end{bmatrix} \\ &= \frac{1}{\sqrt{2}}\begin{bmatrix}1\\1\end{bmatrix}\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\end{bmatrix} - \frac{1}{\sqrt{2}}\begin{bmatrix}1\\-1\end{bmatrix}\cdot\frac{1}{\sqrt{2}}\begin{bmatrix}1&-1\end{bmatrix} = |+\rangle\langle+| - |-\rangle\langle-|. \end{split}