Derivative of 1-norm 
Let $A\in \mathcal{R}^{n\times n} $ be a real matrix and $x_0,x\in \mathcal{R}^{n\times 1} $.
  What is the gradient of the following function at $x$ assuming $Ax \neq x_0$:
  $\|Ax-x_0\|_1$

 A: You are probably aware of the fact that the mapping is not differentiable. However, it is convex and hence, basically all the information one wants to know from some kind of derivative is encoded in the subgradient. In this case you have
$$
\partial(\|Ax-x_0\|_1) = A^T\partial\|Ax-x_0\|_1.
$$
In general, the subgradient is multivalued. In case $(Ax_0)_k\neq x_k$ for all $k$, then the subgradient is single-valued and is
$$
\partial(\|Ax-x_0\|_1) = A^T\mathrm{sign}(Ax-x_0).
$$
However, as soon as $Ax$ and $x_0$ coincide in one component, the subgradient will be multivalued. However, using the same formula as the last one will still give you one particular subgradient.
A: Solving in coordinates, one gets the formula $\frac{\partial}{\partial x_k} \|x\|_p = \frac{x_k |x_k|^{p-2}}{\|x\|_{p}^{p-1}}$. For $p=1$ and with obvious existence conditions $x_i \ne 0$ we can write 
$\newcommand{\sgn}{\operatorname{sgn}}$
$$D\| x\|_1 = (\sgn(x_1), \ldots, \sgn(x_n))=sgn(x)$$
$$D\| Ax-b\|_1 = \sgn(Ax-b)A$$
where in the last expression we used the chain rule.
