Text this: Ranks of a Constrained Hermitian Matrix Expression with Applications