Let $\mathscr{H}$ be a $\mathbb{C}$-Hilbert space and $T \in L(\mathscr{H})$ linear and continuous. Define $$ W(T) := \{ \langle Tx, x \rangle: \| x \| = 1 \}. $$ Then $\sigma(T) \subset \overline{W(T)}$, where $\sigma(T)$ denotes the spectrum of $T$.
In class, we have proven this by showing $\left(\overline{W(T)}\right)^{\complement}\subset \varrho(T) := \left(\sigma(T)\right)^{\complement}$ like it is done here or here.
I am wondering how we can directly show the inclusion, e.g. $\lambda \in \sigma(T) \implies \lambda \in \overline{W(T)}$.
If $\lambda\in\sigma(T)$ then $\lambda- T$ is not invertible, meaning either that $\lambda-T$ is not injective or not surjective, as bijective continuous maps into Banach spaces are invertible by the open mapping theorem. In order to see the result you are interested in we investigate these to cases separately.
The case of $\lambda-T$ not being injective means there is a $z\in H$ with $(\lambda- T)z=0$, ie $Tz=\lambda z$ and $z$ is an eigenvector with eigenvalue $\lambda$. Hence after normalising $z$ one finds $\frac{\langle z, Tz\rangle}{\|z\|^2}=\lambda$ and $\lambda\in W(T)$.
In the case of $\lambda-T$ not being surjective we further specialise to to subcases. For the first sub-case we suppose that the image of $\lambda-T$ is not dense in $H$, while in the second sub-case we suppose that it is dense, ie $\lambda-T$ is "almost surjective". Strictly speaking it is not necessary to divide the non-surjectivity into these two sub-cases, as the argument for dense image can also be made to work for non-dense image. The gain is however that one sees that for the first sub-case one has $\lambda\in W(T)$, while in the second one can only show $\lambda\in\overline{W(T)}$.
Now if the image is not dense then the closure $\overline{\mathrm{Im}(\lambda-T})$ is a proper subspace of $H$ and as such admits a non-zero orthogonal complement. Let $z$ be in this complement, then: $$\lambda-\frac{\langle z,Tz\rangle }{\|z\|^2}=\frac{\langle z,(\lambda-T)z\rangle}{\|z\|^2}=0,$$ and $\lambda\in W(T)$.
Finally in the last case if the image is dense (but not closed), there must be a sequence of vectors $z_n$ with $\|z_n\|=1$ and $(\lambda-T)z_n\to0$, otherwise $\lambda-T$ would be bounded from below and would necessarily have a closed image. It follows that $$\lambda-\frac{\langle z_n,Tz_n\rangle}{\|z_n\|^2} = \frac{\langle z_n, (\lambda-T)z_n\rangle}{\|z_n\|^2}\to0,$$ hence $\lambda\in\overline{W(T)}$.
The division of the spectrum into these 3 cases is more or less classical. You have:
See for example this wikipedia page.