Here is my problem:

In problem (a), I thought that
$\frac{\partial}{\partial\theta_i}l_i(\theta)=(\sum_{k=1}^{p}x_{ik}\theta_k-Y_i)x_{ij}$
Thus $\nabla_{\theta}l_i(\theta)=[\frac{\partial}{\partial\theta_1}l_i(\theta) \; \frac{\partial}{\partial\theta_2}l_i(\theta) \cdots \; \frac{\partial}{\partial\theta_p}l_i(\theta)] = (X_i^T\theta-Y_i)[x_{i1}\;x_{i2}\;\cdots\;x_{ip}]=(X_i^T\theta-Y_i)X_i^T$
But as you and I already know, it's not the answer. I wonder how can I successfully explain it by using $\sum$. Where am I wrong? Please help me.