Let $x \in \mathbb{R}^n$
What is
$$\frac{\partial}{\partial x} [ x^Tx ]$$
My guess is: $\frac{\partial}{\partial x} [ x^Tx ] = 0$, because $[x^Tx] \in \mathbb{R}^1$, hence a real number as is interpreted as scalar in this derivation.
Let $x \in \mathbb{R}^n$
What is
$$\frac{\partial}{\partial x} [ x^Tx ]$$
My guess is: $\frac{\partial}{\partial x} [ x^Tx ] = 0$, because $[x^Tx] \in \mathbb{R}^1$, hence a real number as is interpreted as scalar in this derivation.
Let $u:\mathbb R^n\to\mathbb R$, $x\mapsto u(x)=x^Tx$. There exists a linear application $\ell_x:\mathbb R^n\to\mathbb R$, called the gradient of $u$ at $x$, such that
when $z\to0$. To compute $\ell_x$, note that $$ u(x+z)=(x+z)^T(x+z)=x^Tx+z^Tx+x^Tz+z^Tz=u(x)+2x^Tz+o(\|z\|), $$ hence $$ \ell_x(z)=2x^Tz. $$ Every linear form $\ell$ on $\mathbb R^n$ has the form $\ell:z\mapsto w^Tz$ for some $w$ in $\mathbb R^n$ hence one often identifies $\ell$ with $w$ (technically, this is identifying the dual of $\mathbb R^n$ with $\mathbb R^n$). In the present case, one may identify the gradient $\ell_x$ of $u$ at $x$ (a linear application from $\mathbb R^n$ to $\mathbb R$) with the vector $2x$ (an element of $\mathbb R^n$), and indeed, one often reads the formula $$ (\text{grad}\ u)(x)=2x. $$