Calculation on gradient of the dot product on $\mathbb R^n$

146 Views Asked by At

Let $f(x,y)$ denote the standard dot product of vectors on $\mathbb{R^n}$. I'd like to confirm the formula that I have for the gradient of the dot product is correct. First, I consider this to be a map from $\mathbb{R}^{2n}$ to $\mathbb{R}$ rather than one from $\mathbb{R^n} \times \mathbb{R}^n$ to $\mathbb{R}$. By this I mean: $$ f(x,y) = f(x_1,...,x_n,y_1,...,y_n) = \sum_{i = 1}^{n}x_iy_i $$ Taking partial derivatives with respect to the $2n$ variables, we have that: $$ \nabla f(x,y) = (y_1,...,y_n,x_1,...,x_n) = (y,x) $$ Is this solution correct? I have not seen anything like this online.