Linear model in matrix form is
$ \mathbf{y}=\mathbf{X}\beta+\epsilon\textrm{ where }\epsilon\sim\mathbb{N}\left(0,\sigma^{2}\mathbf{I}\right). $
If $ \mathbf{K}^{\prime}\left(\mathbf{X}^{\prime}\mathbf{X}\right)^{-} \mathbf{K} $ is nonsingular, then
$ \textrm{rank}\left[\mathbf{K}^{\prime}\left(\mathbf{X}^{\prime}\mathbf{X}\right)^{-} \mathbf{K}\right] = \textrm{rank}\left(\mathbf{K}^{\prime}\right). $ (From Linear Models by Searle)
I'm struggling to understand the last expression invloving ranks. Is this a result of any theorem? I'd highly appreciate if you explaing this to me. Thanks