# Apply Chain rule to vector function with chained dot and cross product?

Okay, I got

$\mathbf{v}=(\mathbf{u}_{n-1}-\mathbf{u}_{n})\times(\mathbf{u}_{n}-\mathbf{u}_{n+1})$

and

${e}_{n}=\mathbf{v}\cdot\mathbf{v}=((\mathbf{u}_{n-1}-\mathbf{u}_{n})\times(\mathbf{u}_{n}-\mathbf{u}_{n+1}))^{2}$

with $\mathbf{u}_n=(u_{n,x},u_{n,y},u_{n,z})$

I would like to compute the partial differtial of $e_n$ with respect to $u_{n,x}$

What I tried:

$\frac{\partial e_{n}}{\partial u_{n,x}}=\frac{\partial(\mathbf{v}\cdot\mathbf{v})}{\partial u_{n,x}}$

$=\left(\frac{\partial\mathbf{v}}{\partial u_{n,x}}\cdot\mathbf{v}+\frac{\partial\mathbf{v}}{\partial u_{n,x}}\cdot\mathbf{v}\right)$

$=2\left(\frac{\partial\mathbf{v}}{\partial u_{n,x}}\cdot\mathbf{v}\right)$

$=2\cdot\mathbf{v}\cdot\left(\frac{\partial(u_{n-1}-u_{n})}{\partial u_{n,x}}\times(u_{n}-u_{n+1})+\frac{\partial(u_{n}-u_{n+1})}{\partial u_{n,x}}\times(u_{n-1}-u_{n})\right)$

$=2\cdot\mathbf{v}\cdot\left(\begin{pmatrix}-1\\ 0\\ 0 \end{pmatrix}\times(u_{n,x}-u_{n+1,x})+\begin{pmatrix}1\\ 0\\ 0 \end{pmatrix}\times(u_{n-1,x}-u_{n,x})\right)$

Can I do this this way, or do I have to use the Chain rule? If so, why?

• If you define partial derivative as $\frac{\partial e_n}{\partial u_{n,x}}$, why does the last result have the matrix form? Mar 27 '14 at 14:13
• Do you think I should use square brackets to show that these are vectors?
– Dirk
Mar 31 '14 at 15:17
• Nope, but you do need to check your result. Mar 31 '14 at 15:27

You have defined $$v:=(a-x)\times(x-b),\quad \psi:=v\cdot v\ ,$$ and want to know ${\partial\psi\over\partial x_1}$. You begin correctly with $${\partial \psi\over\partial x_1}=2v\cdot{\partial v\over\partial x_1}\ .\tag{1}$$ In order to compute the vector ${\partial v\over\partial x_1}$ we note that $${\partial\over\partial x_1}(a-x)=(-1,0,0)^T,\quad{\partial\over\partial x_1}(x-b)=(1,0,0)^T\ ,$$ which shines up in your calculation. Since the vector product is bilinear we now get $${\partial v\over\partial x_1}=(-1,0,0)^T\times(x-b)+(a-x)\times(1,0,0)^T=(1,0,0)^T\times(b-a)=(0,a_3-b_3,b_2-a_2)^T\ .$$Now plug this into $(1)$; maybe some simplification will result.
Let's see: $$\frac{\partial e_n}{\partial u_{n,x}}=\frac{\partial (\mathbf{v}\cdot \mathbf{v})}{\partial u_{n,x}}=\left(\frac{\partial \mathbf{v}}{\partial u_{n,x}}\right)\cdot \mathbf{v}+\mathbf{v}\cdot\left(\frac{\partial \mathbf{v}}{\partial u_{n,x}}\right)=2\mathbf{v}\cdot\left(\frac{\partial \mathbf{v}}{\partial u_{n,x}}\right) \tag{1}$$ which is the formula you have obtained and it's correct. Now, \begin{align} \frac{\partial \mathbf{v}}{\partial u_{n,x}}&=\frac{\partial}{\partial u_{n,x}}[(\mathbf{u}_{n-1}-\mathbf{u}_n)\times(\mathbf{u}_{n}-\mathbf{u}_{n+1})]\\ &=\left[\frac{\partial (\mathbf{u}_{n-1}-\mathbf{u}_n)}{\partial u_{n,x}}\right]\times(\mathbf{u}_{n}-\mathbf{u}_{n+1})+(\mathbf{u}_{n-1}-\mathbf{u}_n)\times \left[\frac{\partial (\mathbf{u}_{n}-\mathbf{u}_{n+1})}{\partial u_{n,x}}\right]\\ &=(-1,0,0)\times(\mathbf{u}_{n}-\mathbf{u}_{n+1})+(\mathbf{u}_{n-1}-\mathbf{u}_n)\times(1,0,0)\\ &=(-1,0,0)\times(\mathbf{u}_{n}-\mathbf{u}_{n+1})-(1,0,0)\times (\mathbf{u}_{n-1}-\mathbf{u}_n)\\ &=(1,0,0)\times(\mathbf{u}_{n+1}-\mathbf{u}_{n-1}) \end{align} where I have used standard relations for the cross product: $\textbf{a}\times\textbf{b}=-\textbf{b}\times\textbf{a}$, $(-\textbf{a})\times\textbf{b}=-\textbf{a}\times\textbf{b}$ and $\textbf{a}\times(\textbf{b}+\textbf{c})=\textbf{a}\times\textbf{b}+\textbf{a}\times\textbf{c}$.
By plugging this result in $(1)$ and having into account the formula $(\textbf{a}\times\textbf{b})\cdot(\textbf{c}\times\textbf{d})=(\textbf{a}\cdot\textbf{c})(\textbf{b}\cdot\textbf{d})-(\textbf{a}\cdot\textbf{d})(\textbf{b}\cdot\textbf{c})$ we obtain: $$\frac{\partial e_n}{\partial u_{n,x}}=2\{(u_{n-1,x}-u_{n,x})[(\textbf{u}_{n}-\textbf{u}_{n+1})\cdot(\textbf{u}_{n+1}-\textbf{u}_{n-1})]+(u_{n+1,x}-u_{n,x})[(\textbf{u}_{n-1}-\textbf{u}_{n})\cdot(\textbf{u}_{n+1}-\textbf{u}_{n-1})]\}.$$ This can be written in components, but it does not seem to simplify too much.
In the special case that $\{\textbf{u}_n\}$ form an orthonormal sets of vectors $\textbf{u}_n\cdot \textbf{u}_m=\delta_{n,m}$ the result becomes more compact: $$\frac{\partial e_n}{\partial u_{n,x}}=2(2u_{n,x}-u_{n-1,x}-u_{n+1,x}).$$