I am new with vectorization and Kronecker products. I need to write the scalar value
$$\mathbf{a}^{T}\mathbf{X}\left(\mathbf{X}^{T}\mathbf{X}\right)^{-1}\mathbf{X}^{T}\mathbf{a}$$
in terms of $\mathrm{vec}\left(\mathbf{X}\right)$ not $\mathbf{X}$, where:
$\mathbf{X}$ is $N\times R$
$\mathbf{a}$ is $N\times1$
$N\geq R$
Note: The vectorization of a matrix is a linear transformation which converts the matrix into a column vector. Specifically, the vectorization of an $m \times n$ matrix $A$, denoted by $\mbox{vec} (A)$, is the $mn \times 1$ column vector obtained by stacking the columns of the matrix $A$ on top of one another.