It is known that if $H$ is Hilbert space and $T$ is self-adjoint operator on $H$, then the spectrum is real and closed. But is every closed or compact subset of real numbers a spectrum of some self-adjoint operator on some $H?$ For interval I think we can find the construction but how if the set is a mess, for example, Cantor set?
Every compact subset of real line is spectrum of self-adjoint operator
functional-analysisoperator-theory
Related Solutions
I know three ways, none really elementary.
By the Spectral Theorem. You have $$ T=\int_{\sigma(T)}\lambda\,dE(\lambda). $$ Then, using the $\sigma(T)\subset\mathbb R$, $$ T^*=\int_{\sigma(T)}\overline\lambda\,dE(\lambda)=\int_{\sigma(T)}\lambda\,dE(\lambda). $$
If you know that for normal $T$ you have $$\tag1\overline{W(T)}=\overline{\operatorname{conv}}\sigma(T),$$ where $W(T)$ is the numerical range, you get easily that $T=T^*$. The problem is that the only proof of $(1)$ that I know uses the Spectral Theorem, so it is easier to do the argument directly as in the previous case.
If you have the Spectral Mapping Theorem (but again the only proof I know depends on the Spectral Theorem), you get that $T-T^*$ has real spectrum. So the selfadjoint operator $i(T-T^*)$ has imaginary spectrum, which implies that it is zero.
If $T$ is finite dimensional the conclusion is obvious as $\ker T$ is infinite dimensional. Hence there is an infinite orthonormal system $e_n$ such that $Te_n=\lambda_ne_n,$ where $\lambda_n=0.$
Assume $T:\mathcal{H}_0\to \mathcal{H}_0$ is an infinite dimensional compact operator. Let $\mathcal{H}$ denote the completion of $\mathcal{H}_0.$ Then, by continuity, the operator $T$ extends uniquely to a bounded operator $\tilde{T}:\mathcal{H}\to \mathcal{H}.$ Moreover the operator $T^*$ extends uniquely to $(\tilde{T})^*,$ which follows from the formula $$\langle T^*x,y\rangle = \langle x, Ty\rangle,\quad x,y\in \mathcal{H}_0$$ As $T^*=T$ then $(\tilde{T})^*=\tilde{T},$ i.e. $\tilde{T}$ is self-adjoint on $\mathcal{H}.$ The operator $\tilde{T}$ is compact. Indeed assume $\{x_n\}$ is a bounded sequence in $\mathcal{H}.$ For every $n$ there exists $y_n\in \mathcal{H}_0$ such that $\|y_n-x_n\|<{1\over n}.$ Hence $\{y_n\}$ is a bounded sequence in $\mathcal{H}_0.$ By assumption $\{y_n\}$ contains a subsequence $\{y_{n_k}\}$ convergent to an element $y\in\mathcal{H}_0.$ Thus $$x_{n_k}=y_{n_k}+(x_{n_k}-y_{n_k})\to y$$
If $\lambda\in \mathbb{C}\setminus \sigma(T)$ then the operator $\lambda I_{\mathcal{H}_0}-T$ admits an inverse, say $A_\lambda.$ Thus $$A_\lambda(\lambda I_{\mathcal{H}_0}-T)=(\lambda I_{\mathcal{H}_0}-T)A_\lambda=I_{\mathcal{H}_0}$$ All operators above extend uniquely to bounded operators on $\mathcal{H},$ denoted by superscript $\tilde{}$, and $$\tilde{A}_\lambda (\lambda I_{\mathcal{H}}-\tilde{T})=(\lambda I_{\mathcal{H}}-\tilde{T})\tilde{A}_\lambda=I_{\mathcal{H}}$$ Therefore $\lambda\in \mathbb{C}\setminus\sigma(\tilde{T}).$ In this way we have obtained $\sigma(\tilde{T})\subset \sigma({T}).$ As $\tilde{T}$ is infinite dimensional the set $\sigma(\tilde{T})$ is infinite and $$\sigma(\tilde{T})=\{0\}\cup\{\lambda_n\}_{n=1}^\infty$$ where $\lambda_n\to 0.$
It is possible to give an example of an incomplete inner product space $\mathcal{H}_0$ and an infinite dimensional compact operator $T:\mathcal{H}_0\to \mathcal{H}_0.$ Let $$\mathcal{H}_0=\left \{x\in \ell^2\,:\, \sum_{n=1}^\infty 4^n|x_n|^2<\infty\right\}\subset \ell^2=\mathcal{H}$$ and $$\tilde{T}x=\sum_{n=1}^\infty 2^{-n}x_ne_n$$ where $\{e_n\}_{n=1}^\infty$ denotes the standard orthonormal basis in $\ell^2.$ Observe that $\tilde{T}(\ell^2)\subset \mathcal{H}_0.$ Hence the operator $T=\tilde{T}\mid_{\mathcal{H}_0}$ maps $\mathcal{H}_0$ into $\mathcal{H}_0.$ The operator $\tilde{T}$ is compact. We will show that $T$ is compact as well. To this end, let $x^{(k)}$ be a bounded sequence in $\mathcal{H}_0\subset \ell^2.$ By the Banach-Alaoglu theorem there exists a subsequence $x^{(k_m)}$ convergent weakly to some $x\in \ell^2.$ By the compactness of $\tilde{T}$ we get $$Tx^{(k_m)}=\tilde{T}x^{(k_m)}\underset{m\to \infty}{\longrightarrow} \tilde{T}x\in \mathcal{H}_0$$
Best Answer
There are bits and pieces in the comments that I put together to an answer.
Empty set: The empty set is compact and does only arise as the spectrum of a self-adjoint operator if the Hilbert space in question is the trivial Hilbert space (see for example here Self-adjoint operator has non-empty spectrum.).
Finite set: It's instructive to see how things play out for a finite set, say $\Omega=\{\lambda_1, \dots \lambda_n\}$. Then we can pick $H=\mathbb{C}^n$ and $$ T: \mathbb{C}^n \rightarrow \mathbb{C}^n, x \mapsto \begin{pmatrix} \lambda_1 & & \\ & \ddots & \\ & & \lambda_n \end{pmatrix} x. $$
General case: Let $\Omega \subset \mathbb{R}$ compact and non-empty. Then there exists a dense, countable subset $\{ \lambda_n \in \Omega \ : \ n\in \mathbb{N} \}$ in $\Omega$ (see Prove if $X$ is a compact metric space, then $X$ is separable.). Now we can consider a similar operator as in the finite case, namely,
$$ T: \ell^2(\mathbb{N}, \mathbb{C}) \rightarrow \ell^2(\mathbb{N}, \mathbb{C}), (x_n)_{n\in \mathbb{N}} \mapsto (\lambda_n x_n)_{n\in \mathbb{N}}. $$
With a bit of work (see Spectrum of $l^p$ multiplication operator (Brezis 6.17)) one can show that for such operators one has $$ \sigma(T) = \overline{ \{ \lambda_n \ : \ n \in \mathbb{N} \} }. $$
By construction we have that $\{ \lambda_n \ : \ n \in \mathbb{N}\}$ is dense in $\Omega$. Thus, as $\Omega$ is closed, we get $\sigma(T)= \Omega$.
If you like bigger Hilbert spaces: Before Mariano Suárez-Álvarez's comment I had a similiar, but uglier construction in mind. Namely, I would have taken a Hilbert space with an orthonormal bases that is large enough to associate to every point in $\Omega$ an orthonormal basis vector and then do a similar construction as above. Namely, one can consider the Hilbert space $$ \ell^2(\Omega, \mathbb{C}) = \left\{ (x_s)_{s\in \Omega} \subseteq \mathbb{C}^\Omega \ : \ \sum_{s\in \Omega} \vert x_s \vert^2 < \infty \right\} $$ and the scalar product $$ \langle (x_s)_{s\in \Omega}, (y_s)_{s\in \Omega} \rangle = \sum_{s\in \Omega} \overline{x_s} y_s. $$ We can define the operator $$ T: \ell^2(\Omega, \mathbb{C}) \rightarrow \ell^2(\Omega, \mathbb{C}), (x_s)_{s\in \Omega} \mapsto (s x_s)_{s\in \Omega}. $$ One checks that this operator is bounded and symmetric, thus self-adjoint. Furthermore, $(\delta_{s_0,s})_{s\in \Omega}$ is an eigenvector to the eigenvalue $s_0$. Furthermore, if $\lambda\notin \Omega$, then there exists (as $\Omega$ is closed) $\varepsilon>0$ such that for all $s\in \Omega$ holds $\vert \lambda -\lambda_s\vert>\varepsilon$. Thus, the operator $T-\lambda Id$ admits the inverse $$ A: \ell^2(\Omega, \mathbb{C})\rightarrow \ell^2(\Omega, \mathbb{C}), (x_s)_{s\in \Omega} \mapsto \left( \frac{1}{s-\lambda} x_s \right)_{s\in \Omega} $$ which is bounded (with operator norm bounded by $\varepsilon^{-1}$). Thus, if $\lambda\notin \Omega,$ then $\lambda$ is not in the spectrum of $T$ and hence $\Omega = \sigma(T)$.