\begin{align*} &\text{ maximize } \sum_{i=0}^{N_s - 1} a_i^2 h_i^2 \\ &\text{subject to} \sum_{i=0}^{N_s - 1} a_i^2 \leq N_s P \end{align*}
Assume $h_0 \geq h_1 \geq \cdots \geq h_{N_s - 1}$
It is obvious that choosing $a_0 = \sqrt{N_s P}$ and $a_1 = \cdots = a_{N_s - 1} = 0$ will achieve the maximum but I couldn't prove it using Lagrange multipliers or otherwise.
Here's my working:
The lagrangian is $$\mathcal{L}(a_0, a_1, ..., a_{N_s - 1}, \lambda) = \sum_{i=0}^{N_s - 1} a_i^2 h_i^2 - \lambda \sum_{i=0}^{N_s - 1} a_i^2 + \lambda N_s P $$ \begin{align*} \frac{\partial \mathcal{L}}{\partial a_j } &= 2 h_j^2 a_j - 2\lambda a_j = 0\\ \frac{\partial \mathcal{L}}{\partial \lambda} &= -\sum_{i=0}^{N_s - 1} a_i^2 + N_s P = 0 \end{align*}
How to argue about the maximum mathematically?
I also learnt that Lagrange multipliers method can only be used with equality constraints, not inequality constraints.
Can we still use Lagrange with inequality constraints under some circumstances?
How about solving this from first principles...
For ease of notation, I'll index from $1$ through $n$, instead of $0$ throus $N-1$. Also, let $r^2 := NP_s$ in your notation. Then $$ \begin{split} \max_{a \in \mathbb R^n,\;\sum_{i=1}^n a_i^2 \le r^2}\sum_{i=1}^n h_i^2a_i^2 &= \inf_{\lambda \ge 0}\max_{a \in \mathbb R^n}\sum_{i=1}^n h_i^2a_i^2 + \lambda(r^2 - \sum_{i=1}^na_i^2)\\ &= \inf_{\lambda \ge 0}\lambda r^2 +\underbrace{\max_{a \in \mathbb R^n} \sum_{i=1}^n (h_i^2 - \lambda)a_i^2}_{(*)}\\ &= \inf_{\lambda \ge 0}\lambda r^2 +\begin{cases}0,&\mbox{ if }\lambda \ge \max_i h_i^2,\\+\infty,&\mbox{ else}\end{cases}\\ &=\inf_{\lambda \ge \max_i h_i^2}r^2\lambda = r^2\max_i h_i^2, \end{split} $$ and the optimum is obtained at $\lambda = h_{i^*}^2$, where $i^*$ is any index for which $h_i$ is maximal. You may call the first step in the derivations above the "method of Lagrange multipliers" ...
Now, with this optimal value of $\lambda$, problem (*) can be rewritten as
$$ r^2h_{i^*}^2 = r^2h_{i^*}^2 + \max_{a \in \mathbb R^n}\sum_{i=1}^n(h_i^2-h_{i^*}^2)a_i^2, $$
which holds iff $\max_{a \in \mathbb R^n}\sum_{i=1}^n(h_i^2-h_{i^*}^2)a_i^2 = 0$.