TITLE: differentiation of 1-norm of a vector
QUESTION [6 upvotes]: Assume you want to find the minimum of the following expression
$\|x\|_1 + \alpha \|Ax-b\|_2$ where $x\in R^N$.
So basically I want to calculate the derivative of $\|x\|_1$ so I could finally set the equation to zero and solve for $x^*$. 
What is the best approach to tackle this problem?

REPLY [9 votes]: The differentials of the Manhattan and Frobenius norms are 
$$\eqalign{
 d\,\|X\|_1 &= {\rm sign}(X) : dX \cr
 d\,\|X\|_2 &= \frac{X}{\|X\|_2} : dX \cr
}$$
where the sign function is applied element-wise, and the colon represents the Frobenius product, i.e. $\,\,A\!:\!B = {\rm tr}(A^TB)$
Letting $Y=(AX-B)$, the current function and its differential can be written as 
$$\eqalign{
 f &= \|X\|_1 + \alpha\|Y\|_2 \cr\cr
 df &= {\rm sign}(X) : dX + \frac{\alpha Y}{\|Y\|_2} : dY \cr
    &= {\rm sign}(X) : dX + \frac{\alpha Y}{\|Y\|_2} : A\,dX \cr
    &= {\rm sign}(X) : dX + \frac{\alpha A^TY}{\|Y\|_2} : dX \cr
}$$
Since $df=\big(\frac{\partial f}{\partial X}:dX\big)\,$ the derivative is
$$\eqalign{
  \frac{\partial f}{\partial X} &= {\rm sign}(X) + \frac{\alpha A^TY}{\|Y\|_2} \cr
  &= {\rm sign}(X) + \frac{\alpha A^T(AX-B)}{\|AX-B\|_2} \cr
}$$
This is slightly different than the accepted answer because $B$ appears in the numerator.  But I cannot spot the problem in Nicolas' derivation.