I am trying to define the gradient of $x^Ty$ with respect of $x$ where both $x, y$ are column vectors $\in \mathbb{R}^m$.

$\frac{\partial x^Ty}{\partial x} = [\frac{\partial x^Ty}{\partial x_1} , \frac{\partial x^Ty}{\partial x_2} , ... , \frac{\partial x^Ty}{\partial x_m}] = [y_1, y_2, ..., y_m] = y^T$

or is it

= $[\frac{\partial x^Ty}{\partial x_1} , \frac{\partial x^Ty}{\partial x_2} , ... , \frac{\partial x^Ty}{\partial x_m}]^T = [y_1, y_2, ..., y_m]^T = y$

I am quite confused since I haven't been exposed to multivariate calculus before.

  • $\begingroup$ It depends on the definition of the gradient. It is very common to use the gradient as a row vector. $\endgroup$
    – MrYouMath
    Commented Feb 9, 2018 at 11:55
  • $\begingroup$ A gradient adds an index. So it depends on what you want the first index to point on rows or columns in your visualization of the structures you are working with. In general you need to specify indices to do inner or outer product over as soon as you get something with more than 2 indices anyway. $\endgroup$ Commented Feb 12, 2018 at 5:49

1 Answer 1


There are two conventions, as long as you remain consistent, either is fine.

From the wikipedia page of matrix calculus, the column layout is known as numerator layout while the row layout is known as the denominator layout.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .