2
$\begingroup$

Given a vector $X = [x_1, x_2,\ldots,x_n]^T$, how do you differentiate the function $\dfrac{\sum\limits_{i=1}^n |x_i|}{\left(\sum\limits_{i=1}^n x_i^2\right)^{\frac12}}$ with respect to each $x_i$ where $x_i \in [0,1]$

  • 0
    Write $|x_i|=\mathrm{sgn}(x_i) x_i$, it's not differentiable when $x_i=0$ anyway. Then note $\partial_ir=x_i/r$ and use the quotient rule.2011-09-06

1 Answers 1

3

Since $\|x\|^2=\sum\limits_{j=1}^nx_i^2$, we get that $\frac{\partial}{\partial x_k}\|x\|^2=2x_k$.

The chain rule says that $\frac{\partial}{\partial x_k}\|x\|^2=2\|x\|\frac{\partial}{\partial x_k}\|x\|$.

Thus, we get that $\frac{\partial}{\partial x_k}\|x\|=\frac{x_k}{\|x\|}$. This also gives that $\frac{\mathrm{d}}{\mathrm{d}x}|x|=\frac{x}{|x|}$.

These and the quotient rule yields $ \frac{\partial}{\partial x_k}\frac{\sum\limits_{i=1}^n |x_i|}{\|x\|}=\frac{\frac{x_k}{|x_k|}\|x\|-\frac{x_k}{\|x\|}\sum\limits_{i=1}^n|x_i|}{\|x\|^2} $