Positive quadratic minimization under one affine constraint (source code)

= Positive quadratic minimization under one affine constraint
{title2=$\min_{a^Tz=b}z^THz=b^2/(a^TH^{-1}a)$}

Let $H$ be a symmetric <positive-definite matrix>, $a\ne0$, and $b\in\mathbb R$. Then
$$
z_* =\frac{bH^{-1}a}{a^TH^{-1}a}
$$
is the unique solution of minimizing the <quadratic form> $z^THz$ under the affine <optimization constraint> $a^Tz=b$. The minimum value is $b^2/(a^TH^{-1}a)$.

The denominator is positive because $H^{-1}$ is a <positive-definite matrix>. The <Lagrange multiplier> equations $2Hz=\lambda a$ give the displayed candidate and verify the constraint. For a global proof, any feasible perturbation $u=z-z_*$ satisfies $a^Tu=0$. Hence
$$
z^THz-z_*^THz_*=2z_*^THu+u^THu=u^THu.
$$
This is positive for every nonzero $u$. The result also handles several independent quadratic blocks by taking $H$ to be their <block diagonal matrix> and concatenating their variables.