Let $$ f(x_1,x_2) = \frac{1}{\sqrt{x_1^2+x_2^2+1}} \left(x_1,x_2,1 \right) $$

For $i = 1,2$ we have

$$ \partial_{x_i} f = \frac{1}{\sqrt{x_1^2+x_2^2+1}}\left(\partial_{x_i}x_1,\partial_{x_i}x_2,0 \right) +\frac{-x_i}{\left(x_1^2+x_2^2+1\right)^{3/2}}(x_1,x_2,1) = \frac{1}{\left(x_1^2+x_2^2+1\right)^{3/2}} \left[\left(x_1^2+x_2^2+1\right)\left(\partial_{x_i}x_1,\partial_{x_i}x_2,0\right) - x_i(x_1,x_2,1) \right] $$

The gradient of such function, after some computation I get the following matrix

$$ \nabla f = \frac{1}{\left(x_1^2+x_2^2+1\right)^{3/2}} \begin{pmatrix} x_2^2+1 & - x_1x_2 & -x_1 \\ -x_1x_2 & x_1^2+1 & -x_2 \end{pmatrix} $$

Is it correct?

  • $\begingroup$ the gradient is not a matrix. Maybe you mean the jacobian matrix. $\endgroup$ – Masacroso Feb 28 '18 at 15:53
  • $\begingroup$ The gradient is a matrix if your function is a vector, which is my case. $\endgroup$ – user8469759 Feb 28 '18 at 15:54
  • $\begingroup$ @Masacroso: tha gradient of a vector function is an standard definition in some contexts. (eres el mismo del rincon?) $\endgroup$ – yemino Feb 28 '18 at 16:03
  • 1
    $\begingroup$ @Masacroso It's not my language... math.stackexchange.com/questions/156880/…, this guy calls "gradient" essentially the same thing. $\endgroup$ – user8469759 Feb 28 '18 at 16:09
  • $\begingroup$ @user8469759 alright, first time I heard of it $\endgroup$ – Masacroso Feb 28 '18 at 16:12

The calculus of the partial derivates are correct. But the definition that I know of the matrix gradient is the transpose matrix that you wrote.

  • $\begingroup$ I think that depends from how you consider vectors, right? (If rows or columns) $\endgroup$ – user8469759 Feb 28 '18 at 15:55
  • $\begingroup$ In definition that I know, the gradient of a vector function $f$ is a matrix which rows are the gradient of the components of $f$, so the gradient is the same matrix if $f$ is a row or a column vector. But you must to revise the definition that you are using. $\endgroup$ – yemino Feb 28 '18 at 16:02
  • $\begingroup$ Actually I'm not using any definition. I'll check later my analysis book. $\endgroup$ – user8469759 Feb 28 '18 at 16:04
  • $\begingroup$ @yemino I saw sometimes multivariable calculus written as $xA$ instead of $Ax$, for some jacobian matrix $A$. It is rare (as rare as call "gradient" to the jacobian matrix :p) but exists. Im the same guy of the rincon. $\endgroup$ – Masacroso Feb 28 '18 at 16:16

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.