TITLE: How to differentiate the function $f(\mathbf x) = \|\mathbf x\|^2 \mathbf x$?
QUESTION [2 upvotes]: Let $f:\mathbb R^n\to\mathbb R^n$ be given by the equation $f(\mathbf x)=\|\mathbf x\|^2 \mathbf x$. Show that $f$ is of class $C^\infty$ and that $f$ carries the unit ball $B(\mathbf 0;1)$ onto itself in a one-to-one fashion. Show, however, that the inverse function is not differentiable at $\mathbf 0$. 

How does one differentiate a function involving the Euclidean norm? It's simple enough if it was just the norm itself, but multiplied by a vector I'm not sure how to go about it.

REPLY [0 votes]: Let $f : \mathbb R^n \to \mathbb R^n$ be defined by
$$f (\mathrm x) := \| \mathrm x \|_2^2 \, \mathrm x = (\mathrm x^\top \mathrm x) \, \mathrm x$$
Hence,
$$\begin{array}{rl} \mathrm d f &= (\mathrm d \mathrm x^\top \mathrm x) \, \mathrm x + (\mathrm x^\top \mathrm d \mathrm x) \, \mathrm x + (\mathrm x^\top \mathrm x) \, \mathrm d \mathrm x\\\\ &= (\mathrm x \mathrm x^\top) \, \mathrm d \mathrm x + (\mathrm x \mathrm x^\top) \, \mathrm d \mathrm x + \| \mathrm x \|_2^2 \, \mathrm d \mathrm x\\\\ &= (2 \, \mathrm x \mathrm x^\top + \| \mathrm x \|_2^2 \, \mathrm I_n) \, \mathrm d \mathrm x\end{array}$$
Thus, the Jacobian matrix of $f$ is
$$\nabla f (\mathrm x) = 2 \, \mathrm x \mathrm x^\top + \| \mathrm x \|_2^2 \, \mathrm I_n$$
{"set_name": "stack_exchange", "score": 2, "question_id": 1084095}