Gradient of $\lVert a \times b \rVert_2$ with respect to $b$

121 Views Asked by At

Suppose we have vectors $a = \begin{pmatrix} a_1 \\ a_2 \\ a_3\end{pmatrix}$ and $b = \begin{pmatrix} b_1 \\ b_2 \\ b_3\end{pmatrix}$. I would like to find the gradient of $f = \lVert a \times b \rVert_2$ with respect to $b$, that is $\nabla f$ with respect of $b$.

I know I can find the gradient by taking partial derivatives with respect to the inputs, but it's not clear what are the inputs in this case. Is it just $b$, since I'm taking the gradient with respect to $b$? Or maybe it's both $a$ and $b$?

The gradient of $f = \lVert a \times b \rVert_2$ with respect to $b$ is apparently equivalent to $$\frac{(a \times b) \times a}{\lVert a \times b \rVert_2}$$

But why?

If this was a normal derivative of a square root (i.e. the length), the denominator somehow would make sense to me, but I'm a bit lost, mostly because of the doubts that I tell you above.

I also know that cross product is not in general associative.


I have really not much experience with calculus in multiple dimensions, so maybe this is easy, but usually terminology and notation is what causes the confusion to me.

4

There are 4 best solutions below

0
On

I know I can find the gradient by taking partial derivatives with respect to the inputs, but it's not clear what are the inputs in this case. Is it just $b$, since I'm taking the gradient with respect to $b$? Or maybe it's both $a$ and $b$?

You wanted to have the gradient with respect to $b$, meaning that $a$ is constant. You can write the function as:

$$ f(\vec{b}) = || \vec{a} \times \vec{b} || $$ Meaning the gradient will be $$ \nabla_b f = \left ( \frac{\partial f}{\partial b_1} , \frac{\partial f}{\partial b_2} , \frac{\partial f}{\partial b_3} \right ) $$

@LutzL 's comment is the sophisticated way to calculate the derivative instead of writing the whole expression for $f$ and deriving.

0
On

You have rightly observed that for any differentiable function $g$ $$ ∇\|g(b)\|_2=\frac{\langle g(b),∇g(b)\rangle}{\|g(b)\|_2} $$ For $g(b)=a×b$ the derivative is the linear function $v\mapsto a×v$ and $$ ⟨a×b,a×v⟩=\det(a×b,a,v)=\det(v,a×b,a)=⟨v,(a×b)×a⟩ $$ so that $$ ∇\|g(b)\|_2=\frac{(a×b)×a}{\|g(b)\|_2}. $$

It is equally true that $$ ⟨a×b,a×v⟩=\|a\|^2⟨b,v⟩-⟨a,b⟩⟨a,v⟩ $$ so that also $$ ∇\|g(b)\|_2=\frac{\|a\|^2\,b-⟨a,b⟩\,a}{\|g(b)\|_2}. $$


Here the gradient $∇f$ is connected to the derivative $df$ via $df(x)[v]=⟨∇f(x),v⟩$, where the left side is the directional derivative in direction $v$ at some point $x$.

0
On

For typing convenience, define the scalars $$\eqalign{ \alpha &= \|a\|,\quad \beta = \|b\| ,\quad \gamma = (a\cdot b) ,\quad \lambda = \|a\times b\| \\ }$$ Write the Lagrange identity in terms of these new variables. $$\eqalign{ {\|a\times b\|^2} &= {\|a\|^2\|b\|^2 - (a\cdot b)^2} \\ \lambda^2 &= \alpha^2\beta^2 - \gamma^2 \\ }$$ Then differentiate the equation, assuming the vector $a$ is held constant. $$\eqalign{ 2\lambda\,d\lambda &= \alpha^2\,d\beta^2 - 2\gamma\,d\gamma \\ &= \alpha^2(2b\cdot db) - 2\gamma(a\cdot db) \\ \lambda\,d\lambda &= \Big(\alpha^2b - \gamma a\Big)\cdot db \\ \frac{\partial\lambda}{\partial b} &= \frac{\alpha^2b - \gamma a}{\lambda} \\ &= \frac{b(a\cdot a) - a(b\cdot a)}{\|a\times b\|} \\ &= \frac{(a\times b)\times a}{\|a\times b\|} \\ }$$ The final line is due to the BAC-CAB rule.

0
On

To supplement the answers already here, I present a quite simple and (almost) straightforward calculation.

Recall that $\,df(b) = \langle\frac{\partial f}{\partial b}, db\rangle\,$ and compute

$$ d\|a\times b\|^2 = d\langle a\times b, a\times b\rangle = 2\langle a\times db,a\times b\rangle = 2\langle \left(a\times b\right)\times a, db\rangle,$$ where we have used that the scalar triple product $\langle a\times b, c\rangle$ is invariant under cyclic permutations of $a,b,c$. On the other hand, by the chain rule
$$d\|a\times b\|^2 = 2\|a\times b\|\,d\|a\times b\|,$$ so that we have $$ d\|a\times b\| = \frac{d\|a\times b\|^2}{2\|a\times b\|} = \left\langle\frac{\left(a\times b\right)\times a}{\|a\times b\|}, db\right\rangle\,$$ and the result follows from inspection, $$ \frac{\partial \|a\times b\|}{\partial b} = \frac{\left(a\times b\right)\times a}{\|a\times b\|}\,. $$