Let:$x=[x_1, x_2]$ and $y = [y_1, y_2]$
What is the derivative of the square of the Euclidean norm of $y-x $?
I'm not sure if I've worded the question correctly, but this is what I'm trying to solve:
$$ \frac{d}{dx}(||y-x||^2) $$
It has been a long time since I've taken a math class, but this is what I've done so far:
$$ \frac{d}{dx}(||y-x||^2)=\frac{d}{dx}(||[y_1,y_2]-[x_1,x_2]||^2) $$ Subtracting $x $ from $y$: $$ \frac{d}{dx}(||y-x||^2)=\frac{d}{dx}(||[y_1-x_1,y_2-x_2]||^2) $$ Taking the norm: $$ \frac{d}{dx}(||y-x||^2)=\frac{d}{dx}((y_1-x_1)^2+(y_2-x_2)^2) $$ Then at this point do I take the derivative independently for $x_1$ and $x_2$? This is where I am guessing: $$ \frac{d}{dx}(||y-x||^2)=[\frac{d}{dx_1}((y_1-x_1)^2+(y_2-x_2)^2),\frac{d}{dx_2}((y_1-x_1)^2+(y_2-x_2)^2)] $$ Which would result in: $$ \frac{d}{dx}(||y-x||^2)=[2x_1-2y_1,2x_2-2y_2] $$
Is this correct? Thank you for your time.
Sure, that's right.
Some sanity checks: the derivative is zero at the local minimum $x=y$, and when $x\neq y$, $$\frac{d}{dx}\|y-x\|^2 = 2(x-y)$$ points in the direction of the vector away from $y$ towards $x$: this makes sense, as the gradient of $\|y-x\|^2$ is the direction of steepest increase of $\|y-x\|^2$, which is to move $x$ in the direction directly away from $y$.