(partial) Derivative of norm of vector with respect to norm of vector I'm doing a weird derivative as part of a physics class that deals with quantum mechanics, and as part of that I got this derivative:
$$\frac{\partial}{\partial r_1} r_{12}$$
where $r_1 = |\vec r_1|$ and $r_{12} = |\vec r_1 - \vec r_2|$. Is there any way to solve this? My first guess was to set it equal to 1 or since $r_{12}$ is just a scalar, but then I realized it really depends on $r_1$ after all.
The expression appears when I try to solve
$$\frac{\nabla_1^2}{2} \left( \frac{r_{12}}{2(1+\beta r_{12})} \right)$$
($\beta$ is constant)
 A: The OP provided his solution on pastebin, which I reproduce below (it is correct). 
A better way to obtain the same result would be to recall that the directional derivative is the dot product with the gradient. The gradient of the norm being $\dfrac{\vec r_1-\vec r_2}{r_{12}}$, we obtain $$\frac{\vec r_1}{r_1}\cdot \frac{\vec r_1-\vec r_2}{r_{12}}$$
which is the same answer.

\begin{align*}
   \frac{\partial}{\partial r_1} r_{12}
   &= \frac{\partial}{\partial r_1} \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2 + (z_1 - z_2)^2} \\
   &= \frac{\partial}{\partial r_1} \sqrt{(r_1\sin\theta_1\cos\phi_1 - x_2)^2 + (r_1\sin\theta_1\sin\phi_1 - y_2)^2 + (r_1\cos\theta_1 - z_2)^2} \\
   &= \left(\frac{1}{2r_{12}}\right) \frac{\partial}{\partial r_1} \Big[ (r_1\sin\theta_1\cos\phi_1 - x_2)^2 + (r_1\sin\theta_1\sin\phi_1 - y_2)^2 + (r_1\cos\theta_1 - z_2)^2 \Big] \\
   &= \frac{1}{2r_{12}} \Big[ 2(x_1 - x_2)(\sin\theta_1\cos\phi_1) + 2(y_1 - y_2)(\sin\theta_1\sin\phi_1) + 2(z_1 - z_2)(\cos\theta_1) \Big] \\
   &= \frac{1}{r_{12}} \left[ (x_1 - x_2)\frac{x_1}{r_1} + (y_1 - y_2)\frac{y_1}{r_1} + (z_1 - z_2)\frac{z_1}{r_1} \right] \\
   &= \frac{1}{r_1 r_{12}} \Big[ r_1^2 - x_1x_2 - y_1y_2 - z_1z_2 \Big] \\
   &= \frac{1}{r_1 r_{12}} \Big[ r_1^2 - \vec r_1 \vec r_2 \Big] \\
\end{align*}
A: Since these are vectors, one can consider the following approach:
Let 
${\bf x}_1 := \overrightarrow{r}_1$, and ${\bf x}_2 : = \overrightarrow{r}_2$, then $r_1 = ||{\bf x}||^{\frac{1}{2}}$, and $r_{12} = ||{\bf x}_1 - {\bf x_2}||^{\frac{1}{2}}$.
Define the following functions:
$g({\bf x}_1) = ||{\bf x}_1 - {\bf x_2}||^{\frac{1}{2}} = \left[({\bf x}_1 - {\bf x_2})^T ({\bf x}_1 - {\bf x_2}) \right]^{\frac{1}{2}}$
$f({\bf x}_1) = ||{\bf x}||^{\frac{1}{2}}  = \left[ {\bf x}_1^T {\bf x}_1\right]^{\frac{1}{2}}$
Note that these functions are both scalar function of vectors. Also the following update should be noted
$r_{12} = g({\bf x}_1)$, and $r_1 = f({\bf x}_1)$.
$\dfrac{\partial}{\partial {r_1}} r_{12} ~=~ \dfrac{\partial}{\partial f({\bf x}_1)} g({\bf x}_1) ~=~ \dfrac{\partial}{\partial {\bf x}_1} g({\bf x}_1) ~~ \dfrac{1}{\dfrac{\partial}{\partial {\bf x}_1} f({\bf x}_1)}$ ...... chain rule
Applying Matrix Calculus and simplifying
$\dfrac{\partial}{\partial f({\bf x}_1)} g({\bf x}_1) ~=~
\dfrac{({\bf x}_1 - {\bf x_2})^T}{g({\bf x}_1)} 
\dfrac{f({\bf x}_1)}{{\bf x}^T}  ~=~ 
\dfrac{({\bf x}_1 - {\bf x_2})}{g({\bf x}_1)} 
\dfrac{f({\bf x}_1)}{{\bf x}}
$... since transpose of a scalar is a scalar
changing to the original variables,
$\dfrac{\partial}{\partial {r_1}} r_{12} ~=~\dfrac{\overrightarrow{r}_1 - \overrightarrow{r}_2}{r_{12}} \dfrac{r_1}{\overrightarrow{r}_1}$
