If $f(x,y,z)=(r \times A)\cdot (r\times B)$, where $r=(x,y,z)$, show that $\nabla f(x,y,z)=B\times (r\times A)+A\times (r\times B)$. If $f(x,y,z)=(r \times A)\cdot (r\times B)$, where $r=(x,y,z)$ and $A$ and $B$ are constant vectors, show that $\nabla f(x,y,z)=B\times (r\times A)+A\times (r\times B)$.
I'm a bit lost on this problem. I tried using cross product equalities to solve it, but I'm not getting a clean answer. I'm thinking that there's a simple way to solve it. I would greatly appreciate any solutions, suggestions, or hints.
 A: We can use $(u\times v)\cdot w=u\cdot(v\times w)$ to prove this.
First, let's distinguish between the two $r$ vectors and write the expression
$$
g(u,v)=(u\times A)\cdot(v\times B)
=u\cdot(A\times(v\times B))
=v\cdot(B\times(u\times A)).
$$
This makes $f(r)=g(r,r)$ where $r=(x,y,z)$, and differentiating in $r$ is the same as differentiating $g(u,v)$ in $u$ and in $v$ separately and inserting the value $r$ for both:
$$
\nabla_r f(r)=\nabla_r(g(r,r))
=\left(\nabla_ug(u,v)+\nabla_v g(u,v)\right)|_{u=v=r}.
$$
However, using the first expressions, we get
$$
\nabla_u g(u,v)=A\times(v\times B),\quad
\nabla_v g(u,v)=B\times(u\times A),
$$
and so
$$
\nabla_r f(r)=A\times(r\times B)+B\times(r\times A).
$$
A: Taking into account that the cross product can be written as
$$
a\times b=e_i\varepsilon_{ijk}a_jb_k,
$$
we have
\begin{align}
\nabla f&=\nabla[(r\times A)\cdot(r\times B)]\\
  &=[\nabla(r\times A)](r\times B)+(r\times A)[\nabla(r\times B)]\\
  &=[e_i\partial_i\varepsilon_{jkl}x_kA_l](r\times B)_j+(r\times A)_j[e_i\partial_i\varepsilon_{jkl}x_kB_l]\\
  &=[e_i\varepsilon_{jkl}\delta_{ik}A_l](r\times B)_j+(r\times A)_j[e_i\varepsilon_{jkl}\delta_{ik}B_l]\\
  &=[e_i\varepsilon_{jil}A_l](r\times B)_j+(r\times A)_j[e_i\varepsilon_{jil}B_l]\\
  &=e_i\varepsilon_{ilj}A_l(r\times B)_j+e_i\varepsilon_{ilj}B_l(r\times A)_j\\
  &=A\times(r\times B)+B\times(r\times A).
\end{align}
Note
I used the summation convention, i.e. when an index is repeated, a sum over 1,2,3 is intended. Furthermore, in the cross product I used the Levi-Civita symbol $\varepsilon_{ijk}$, see Vector cross product, where $e_1, e_2, e_3$ are the versors $i, j, k$ of the axes.
A: From
$$f({\bf x}):=({\bf x}\times {\bf a})\cdot({\bf x}\times{\bf b})$$
it follows from the bilinearity of the scalar and the  the vector product that
$$\eqalign{df({\bf x}).{\bf X}&=({\bf X}\times {\bf a})\cdot({\bf x}\times{\bf b})+({\bf x}\times {\bf a})\cdot({\bf X}\times{\bf b})\cr
&=\epsilon({\bf X},{\bf a},{\bf x}\times{\bf b})+\epsilon({\bf X},{\bf b},{\bf x}\times{\bf a})\cr
&={\bf X}\cdot\bigl({\bf a}\times({\bf x}\times{\bf b})+{\bf b}\times({\bf x}\times{\bf a})\bigr)\ ,\cr}$$
where $\epsilon(\ ,\ ,\ )$ denotes the triple vector product. The identity so obtained can be written as
$$\nabla f({\bf x})={\bf a}\times({\bf x}\times{\bf b})+{\bf b}\times({\bf x}\times{\bf a})\ .$$
