Derivates with respect to a vector
$f =X^T Y$ looks like this
\begin{equation}
 f= \begin{pmatrix}
  \sum_i x_iy_{i1}\\
  \sum_i x_iy_{i2}\\
  \vdots\\
  \sum_i x_iy_{in}\\
 \end{pmatrix}
\end{equation}
where $x_i$ is the $i^{th}$ element of $X$ and $y_{ij}$ is the $(i,j)^{th}$ element of $Y$.
Now, to get the gradient w.r.t $X$, is equivalent to deriving each element of $f$ w.r.t each element of $X$. This will lead to a 2D matrix:
\begin{equation}
 \nabla_X f = 
 \begin{pmatrix}
  \frac{\partial}{\partial x_1} f_1 &amp; \ldots &amp; \frac{\partial}{\partial x_n} f_1\\
  \vdots &amp; \vdots &amp; \vdots \\
  \frac{\partial}{\partial x_1} f_n &amp; \ldots &amp; \frac{\partial}{\partial x_n} f_n
 \end{pmatrix}
\end{equation}
We can therefore easily see that 
\begin{equation}
\frac{\partial}{\partial x_j} f_i
=
y_{ij}
\end{equation} 
Therefore $\nabla_X f = Y$.