How can I solve this maximization problem with inequality constraint on the Frobenius norm? $$
\max_{C\in \mathbb{S}^n} x^TCx\\
s.t. \|C\|_{tr}^2\leq b
$$
where $\|C\|_{tr}^2=tr(C^TC)=tr(CC)$, $C$ is a symmetric matrix.

Through some calculations, I have an idea as follows:
$$
L=x^TCx-\lambda(\|C\|_{tr}^2-b)
$$
Calculating $\frac{\partial L}{\partial C}$ and $\frac{\partial L}{\partial \lambda}$, we have
$$
\frac{\partial L}{\partial C}=xx^T=\lambda C\\
\frac{\partial L}{\partial \lambda}=tr(CC^T)=b
$$
that is
$$
C=\frac{xx^T}{\lambda}
$$
plugging the term into the second equation, we have
$$
tr(xx^T/\lambda)=\sqrt{b}\\
tr(xx^T/\lambda)=1=\sum{x_i^2}/\lambda\\
\lambda = \|x\|^2=\sum{x_i^2}
$$
Hence, the solution is
$$
C^*=\sqrt{b}*\frac{xx^T}{\|x\|^2}
$$
