2

I need to evaluate the expression

$$ {\partial \over \partial \mathbf a} \arctan(\mathbf{|a \times b| \over a^T b}) $$

where $ \mathbf {a,b} \in \mathbf R^3 $ are functions of nodal positions on a chain: $ \mathbf a = \mathbf {x_{i-1} - x_i} $ and $\mathbf{b=x_i - x_{i+1}}$.

This is a vector derivative of a scalar function so we expect to get a vector at the end (in fact, a force).

Making the small angle approximation we can say $\arctan \theta \approx \theta$, and then using the product rule we have

$$ {{{\partial \over \partial \mathbf a} (\mathbf{|a \times b|})}\over\mathbf a^T \mathbf b} + {{\partial \over \partial \mathbf a} (\mathbf a^T \mathbf b)^{-1} (|\mathbf a \times \mathbf b|)} $$

Just looking at the first term for now:

$$ {\partial \over \partial \mathbf a} \mathbf{| a \times b |} = {\partial \over \partial \mathbf a}((\mathbf{a \times b})^T(\mathbf{a \times b}))^{1/2}\\ ={1 \over 2 \mathbf {|a \times b|}} (({\partial \over \partial \mathbf a}(\mathbf{a \times b})^T)(\mathbf{a \times b})+ (\mathbf{a \times b})^T({\partial \over \partial \mathbf a}(\mathbf{a \times b}))) $$

Now the difficulty I'm having is that presumably $ {\partial \mathbf a^T \over \partial \mathbf a} = \mathbf I^{3\times3}$ which is a matrix, not a vector, and thus can't be crossed with $\mathbf b^T $, which is nonsensical. Is this correct, and if not, how do I proceed with the derivation?

2 Answers2

0

Use the identity $$ \frac{\partial}{\partial a} \|a\times b\|^2 = 2(b\times(a\times b))^T $$

so that

$$ \begin{align} \frac{\partial}{\partial a} \frac{\|a\times b\|}{a^Tb} &= \frac{\partial}{\partial a} \left( (\|a\times b\|^2)^{1/2} \frac{1}{a^Tb} \right) \\ &= \frac{1}{a^Tb} \frac{1}{2\|a\times b\|} \frac{\partial}{\partial a} \|a\times b\|^2 - \frac{\|a\times b\|}{(a^Tb)^2} \frac{\partial}{\partial a}(a^Tb) \\ &= \frac{(b\times(a\times b))^T}{(a^Tb)\|a\times b\|} - \frac{\|a\times b\|b^T}{(a^Tb)^2} \end{align} $$ (I added the missing $a^Tb$ factor thanks to Ted Black's comment below).

I will also add that I am using the convention for $\partial / \partial a$ in which $\partial f(a) / \partial a$ is a row. This convention is designed so that the equation $$f(a+h) = f(a) + \frac{\partial f(a)}{\partial a}h + O(|h|^2)$$ holds, assuming $f:\mathbb{R}^n\to\mathbb{R}$ and $a,h$ are vectors written as columns. You will also see a lot of other conventions. For example, there is the one that Ted mentioned, where $\partial f(a)/\partial a$ is a column. This convention is designed so that the equation $$f(a+h) = f(a) + \left\langle\frac{\partial f(a)}{\partial a},h\right\rangle + O(|h|^2)$$ holds, where again $a,h\in\mathbb{R}^n$ are written as columns. If you choose this convention, then the answers I gave need to be transposed.

Jackozee Hakkiuz
  • 5,583
  • 1
  • 14
  • 35
  • you are missing the $1/(\mathbf{a}^T\mathbf{b})$ factor in the first part. Also strictly speaking what you are calculating is $\partial/\partial \mathbf{a}^T$ since the differential is $d\mathbf{a}$ (you can see that since the partial derivative you have calculated is a transpose vector). – Ted Black Oct 07 '23 at 17:49
  • Hi @TedBlack. Thanks for your comment. I modified my answer according to your correction. Regarding the row/column conventions, a while ago I used to have a favourite one but now prefer to be agnostic. I needed to provide the answer in one form or another, so I chose the "numerator layout" convention (as it is called in the wiki). – Jackozee Hakkiuz Dec 10 '23 at 09:52
0

Denote $$ c = \frac{\|\mathbf{a \times b}\|}{\mathbf{a}^T \mathbf{b}} = \frac{\alpha}{\beta} $$

Using Lagrange's identity $\alpha^2 = \|\mathbf{a}\|^2\|\mathbf{b}\|^2 - \beta^2 $, it holds $$ \alpha (d\alpha) = \|\mathbf{b}\|^2 \mathbf{a}^T (d\mathbf{a}) - \beta (d\beta) $$ Moreover $d\beta = \mathbf{b}^T (d\mathbf{a})$.

From here \begin{eqnarray*} dc &=& \frac{1}{\beta} (d\alpha)- \frac{\alpha}{\beta^2} (d\beta)\\ \frac{\partial c}{\partial \mathbf{a}} &=& \frac{\|\mathbf{b}\|^2}{\alpha \beta} \mathbf{a} - \left[ \frac{1}{\alpha}+ \frac{\alpha}{\beta^2} \right] \mathbf{b} \end{eqnarray*}

Steph
  • 3,665