Absolute Value derivative

112 Views Asked by At

What would the following derivative be?

$$ \frac{\partial}{\partial x_k} |x_i - x_j| =?$$ Where

$$ \frac{\partial x_i}{\partial x_k} = \delta_{ik}$$

For context, what I'm actually trying to do is write

$ \frac{\partial}{\partial x_k} |x_i - x_j|^{-1} = -\frac{1}{|x_i-x_j|^2}(\delta_{il} + \delta_{jl})$

How can this be done? Explicitly.

Some more context

I have

$$U = \frac{1}{2} \sum_{i,j} \frac{(-1)^{i+j} e^2(1-\delta_{ij})}{|x_i-x_j|}$$

Apparently, it's true that

$$-\frac{\partial U}{\partial x_k} = -\frac{1}{2} \sum_{i,j} (-1)^{i+j} e^2(1-\delta_{ij}) \frac{1}{|x_i-x_j|^2}(\delta_{ik} + \delta_{jk})$$

Very very important, note the PLUS sign in the parentheses (over the deltas). I had omitted everything else earlier because I think its irrelevant, but I guess maybe there is a clue I am missing? Anyway, see, I need a PLUS sign, not a MINUS sign, i.e.

$$(\delta_{ik} + \delta_{jk}) \neq (\delta_{ik} - \delta_{jk})$$

And I dunno how to get it...

1

There are 1 best solutions below

0
On

A couple of things to keep in mind. First, the absolute value function is not differentiable on its domain. Moreover, the only way to express it in terms of algebraic functions is piecewise, so the derivative again will have to be defined piecewise. You know that \begin{eqnarray} |x_i - x_j| = x_i - x_j \text { if } x_i > x_j \\ |x_i - x_j| = x_j - x_i\text{ if } x_j > x_i. \end{eqnarray}

Then \begin{eqnarray} \frac{\partial}{\partial x_k}|x_i - x_j| = \frac{\partial}{\partial x_k}(x_i - x_j) = \delta_{k, i} - \delta_{k, j} \text { if } x_i > x_j \\ \frac{\partial}{\partial x_k}|x_i - x_j| = \frac{\partial}{\partial x_k}(x_j - x_i) = \delta_{k, j} - \delta_{k, i} \text{ if } x_j > x_i. \end{eqnarray}