Has this energy a maximum in $B$? Suppose $\mathcal{H}$ is an Hilbert space and $\langle ., . \rangle$ his scalar product.
Suppose $T:\mathcal{H} \to \mathcal{H}$ is linear, continuos, compact and self-adjoint.
If we define $J:\mathcal{H} \to \mathbb{R}$ as $J(x)=\langle Tx, x \rangle$ for all $x \in \mathcal{H}$, can we conclude $J$ has a maximum in $B=\{x \in \mathcal{H}: \|x\| \leq 1\}$?
I know that if $\mathcal{H}$ is separable I can use the fact that $B$ is sequentially compact and I can work with a maximizing sequence.
But If I do not know the separability of $\mathcal{H}$?
Does the same statement hold?
I tried proving that $J_{|B}:B \to \mathbb{R}$ is weakly superior semi-continuos. In fact if $u_n \rightharpoonup u$ then $J(u_n) \to j(u)$. Is it enough to conclude?

By the spectral Theorem there exists an orthonormal set $\{x_n\}_{n\in \mathbb N}$, and a sequence
$\{\lambda_n\}_{n\in \mathbb N}$  of real numbers converging to zero, such that
$$
  T(x) = \sum_{n\in \mathbb N} \lambda _n\langle x,x_n\rangle x_n, \quad \forall x\in  \mathcal H
  $$
It follows that
$$
  J(x) = \langle T(x),x\rangle  = \sum_{n\in \mathbb N} \lambda _n|\langle x,x_n\rangle |^2,
  $$
so the supremum of $J$ on $B$ is clearly equal to the maximum of the $\lambda _n$,  as long as there exists at least one
positive $\lambda _n$,  and zero otherwise.
In the first case $J$ attains its maximum at $x_n$, where $n$ is such that $\lambda _n = \max_k\lambda _k$, and in the second case,
$J$ attains its maximum at zero.

Alternatively you may choose a maximizing  sequence $\{x_n\}_n$ and set $K$ to be the Hilbert subspace generated by that sequence.  Notice that $K$ is separable, even if the whole space isn't. So you may now employ your argument based on sequencial compactness of the unit ball of $K$!
