Gradient of scalar potential Say we have scalar potential in a form 
$$
U = A \ln (\vec{a} \times \vec{r})^2 e^{-\vec{b} \cdot \vec{r}}.
$$
How would one calculate gradient $\vec{E}=-\nabla U$ of such potential? 
A is a constant, $\vec{a}$ is a constant vector and $\vec{r}=(x, y, z)$.
 A: Cross-product by a constant is linear, taking the square of a vector is quadratic so by differencing composed functions, 
$$
d(ln((a\times r)^2)) = \frac{1}{(a\times r)^{2}} d((a\times r).(a\times r)) 
= \frac{2}{(a\times r)^{2}} d(a \times r).(a \times r) 
= \frac{2}{(a\times r)^{2}} (a \times dr).(a\times r)
$$
for the exp part : 
$$
d(e^{-b.r}) = e^{-b.r} d(-b.r) = e^{-b.r} (-b.dr)
$$
and by combining the two with product differentiation rule : 
$$
dU = \frac{2}{(a\times r)^{2}} e^{-b.r} (a\times r).(a \times dr) + ln((a\times r)^2) e^{-b.r} (-b.dr) = e^{-b.r}\left(\frac{2(a\times r).(a \times dr)}{||a\times r||^2} - ln(||a\times r||^2) b.dr\right)
$$
We want to rewrite it as an inner product of dr, so we use the rules of scalar triple product then vector triple product
$$
dU = e^{-b.r}\left(\frac{2 dr.((a\times r \times a)}{||a\times r||^2} - ln(||a\times r||^2) b.dr\right)
= e^{-b.r}\left(\frac{2 (||a||^2 r - (r.a)a).dr}{||a\times r||^2} - ln(||a\times r||^2) b.dr\right)
= e^{-b.r}\left(2\frac{||a||^2 r - (r.a)a}{||a\times r||^2} - ln(||a\times r||^2) b\right).dr 
$$
And you read gradU by removing .dr .
A: $(\vec{a}\times \vec{r})_k = \epsilon_{ijk}a_ix_j$ hence $(\vec{a}\times \vec{r})^2 = \epsilon_{ijk}a_ix_j\epsilon_{lmk}a_lx_m$ consequently,
\begin{align} \partial_n (\vec{a}\times \vec{r})^2 = \epsilon_{ijk}\epsilon_{lmk}a_ia_l\partial_n(x_mx_j)&= \epsilon_{ijk}\epsilon_{lmk}a_ia_l[\delta_{nm}x_j+x_m\delta_{nj}] \\
&= \epsilon_{ijk}\epsilon_{lnk}a_ia_lx_j+\epsilon_{ink}\epsilon_{lmk}a_ia_lx_m\\
&= 2\epsilon_{ijk}\epsilon_{lnk}a_ia_lx_j \\
&= 2(\delta_{il}\delta_{jn}-\delta_{in}\delta_{jl})a_ia_lx_j \\
&= 2(\vec{a} \cdot \vec{a} \, x_n - a_n \vec{a} \cdot \vec{r})
\end{align}
On the other hand, $\partial_n \vec{b} \cdot \vec{r} = \partial_n b_ix_i = b_i \delta_{in} = b_n$ assuming that $\vec{b}$ is constant. So,
\begin{align} \partial_n U &= \partial_n [A\ln(\vec{a}\times \vec{r})^2e^{-\vec{b}\cdot \vec{r}}] \\
&= A\left(\partial_n [\ln(\vec{a}\times \vec{r})^2]e^{-\vec{b}\cdot \vec{r}}+\ln(\vec{a}\times \vec{r})^2\partial_n[e^{-\vec{b}\cdot \vec{r}}]\right) \\
&= A\left(\frac{2(\vec{a} \cdot \vec{a} \, x_n - a_n \vec{a} \cdot \vec{r})}{(\vec{a}\times \vec{r})^2}-b_n\ln(\vec{a}\times \vec{r})^2\right)e^{-\vec{b}\cdot \vec{r}} \\
\end{align}
Thus, provided I haven't made some silly mistake,
$$ \vec{E} = -\nabla U = A\left(\frac{2[(\vec{a} \cdot \vec{a}) \, \vec{r} -  (\vec{a} \cdot \vec{r})\vec{a}]}{(\vec{a}\times \vec{r})^2}-\ln(\vec{a}\times \vec{r})^2\vec{b}\right)e^{-\vec{b}\cdot \vec{r}} $$
