I am new to Mathematics stack exchange community and has no experience in asking question so please bear with me. I am watching deep learning course from Coursera and encounter a question during the video. $$\left|\frac d{d\vec x}(\vec x\cdot\vec x)^2\right|=?$$ $$\vec x=\begin{bmatrix}x_1\\x_2\end{bmatrix}=\begin{bmatrix}3\\4\end{bmatrix}$$ I am not sure how to perform dot product on 2 vectors since they are 2x1 and 2x1 dimension. Please guide me! Thanks

Note: After some try and error, I got the answer, but I don't understand the solution.

enter image description here

  • 2
    $\begingroup$ There is something wrong in the answer, Since you are calculating a |.|, it should be indicated as $$|4|\vec x|^2 \vec x|=4|\vec x|^3$$ $\endgroup$ – user Dec 10 '17 at 14:39

By definition, the derivative of a scalar $f(x,y)$ with respect to a vector $(x,y)$ is the following vector $$\left(\frac{\partial f}{\partial x},\frac{\partial f}{\partial y}\right).$$

We have $$f(x_1,x_2)=(\vec x \cdot \vec x)^2 =\left(x_1^2+x_2^2\right)^2.$$

So the derivative in question is the vector $$(4(x_1^2+x_2^2)x_1,4(x_1^2+x_2^2)x_2).$$

At $(3,4)$, this is $$(300,400).$$


Taking the absolute value:


  • $\begingroup$ Do you mind explain the solution provided? $\endgroup$ – Mervyn Lee Dec 10 '17 at 14:19
  • $\begingroup$ If you visit the wiki article then yu will see the definition. I just computed the square of the dot product and took the partial derivatives as it was required by the definition. $\endgroup$ – zoli Dec 10 '17 at 14:45

Note that

$$(\vec x \cdot \vec x)^2=|\vec x|^4=(x_1^2+x_2^2)^2$$

Thus: $$\frac{d(\vec x \cdot \vec x)^2}{d\vec x} =\left(\frac{\partial(\vec x \cdot \vec x)^2}{\partial x_1},\frac{\partial(\vec x \cdot \vec x)^2}{\partial x_2}\right) =(4x_1(x_1^2+x_2^2),4x_2(x_1^2+x_2^2))$$

$$\left|\frac{d(\vec x \cdot \vec x)^2}{d\vec x} \right|=\sqrt{16x_1^2(x_1^2+x_2^2)^2+16x_2^2(x_1^2+x_2^2)^2}=4(x_1^2+x_2^2)^{\frac32}=4|\vec x|^3$$

You can also apply the ordinary rules using the product rule:

$$\frac{d(\vec x \cdot \vec x)^2}{d\vec x} =2(\vec x \cdot \vec x)\vec x+2(\vec x \cdot \vec x)\vec x=4\vec x|\vec x|^2$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.