Show that $f(x,y)= \|x-y\|_2^2$ is differentiable

233 Views Asked by At

Problem: Show that $f: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$ with $f(x,y)=\|x-y\|_2^2$ is differentiable and compute its differential at every point in the domain of $f$
Note: $\| \cdot \|_2$ denotes the euclidian norm $d(x,y)_2 =\sqrt{\sum\limits_{i=1}^n (x_i-y_i)^2}$

One exercise I found in Zorich Analysis II. I am however in general clueless on how to show that a function is differentiable. Of course there is always the brute force way such as computing the Jacobian-Matrix and discuss its entries, however that might be a little bit difficult with the above mapping since $f: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$, that would be one hell of a matrix to compute.

I found that most people enjoy working with this definition of differentiability in $\mathbb{R}^n$

$f(x)=f(x_0)+A(x-x_0)+\|x-x_0\|\alpha (x)$ where $\alpha: U \to \mathbb{R}^n$ such that $\lim\limits_{x \to x_0} \alpha (x)=0$ and $A$ is a linear function.

I understand that the above is only a slight variation of:

Def: $f$ is at $x_0$ differentiable $\iff \exists A: \mathbb{R}^m \to \mathbb{R}^n: \displaystyle \lim_{x \to x_0} \frac{f(x)-f(x_0)-A(x-x_0)}{\|x-x_0\|}=0 $

In C.T. Michaels Analysis II the author mentions that by the definition nothing is known about the linear mapping $A$, however in most cases $A$ can easily be found by computing the Jacobian-Matrix and then verifying the definition with that Matrix.

I have read a couple of entries on this website where people attempt to show that a function is differentiable or not at some generic point. But to be honest it all seemed a bit like Voodoo-Magic to me.

Question: I am not primarily interested in the solution to this exercise but in the thought process one would have to show that $f$ defined as above is differentiable:

  • Where do you start?
  • Is there something in specific you have to notice about the function beforehand? Like symmetry, roots or anything to start discussing its differential.
  • Is it a lot of lucky guessing and in the end succeeding after a lot of failed attempts? Or is there something like a 'most natural attempt' to generally solve such exercises.
2

There are 2 best solutions below

6
On BEST ANSWER

Note this is the map $(x,y)\mapsto (x-y)\cdot (x-y)$, that is $(x,y)\mapsto x\cdot x-2x\cdot y+y\cdot y$. It suffices we show each of the summands is differentiable. But two of the summands are $\lVert \cdot \rVert ^2$; which we know how to differentiate, and the central summand is bilinear, so it is not too hard to obtain their derivative. In fact, we obtain that $$Df(x,y)(a,b)=2x\cdot a-2(x\cdot b+a\cdot y)+2 b\cdot y\\=2x\cdot(a-b)-2y\cdot(a-b)=2(x-y)\cdot (a-b)$$

Note that if $g(x,y)=x\cdot x$, then $Df(x,y)(a,b)=2x\cdot a$ and if $h(x,y)=y\cdot y$ then $Dh(x,y)(a,b)=2y\cdot b$. This is easily proven by say $$g(x+k,y+k)-g(x,y)=2x\cdot h+\lVert h\rVert ^2$$ $$h(x+k,y+k)-h(x,y)=2y\cdot k+\lVert k\rVert ^2$$ and noting $\lVert h\rVert,\lVert k\rVert \leqslant \lVert (h, k)\rVert$.

Claim Let $B:\Bbb R^n\times\Bbb R^m\to\Bbb R^p$ bilinear. Then $DB(x,y)(a,b)=B(x,b)+B(a,y)$. More generally, if $T:\Bbb R^{i_1}\times\cdots \Bbb R^{i_k }\to\Bbb R^p$ multilinear, $$DT(x_1,\ldots,x_k)(a_1,\ldots,a_k)=\sum_{j=1}^k T(x_1,\ldots,a_j,\ldots,x_k)$$

Proof I give the proof for the bilinear case, I leave the other proof out.

Indeed, suppose $B:\Bbb R^n\times\Bbb R^m\to\Bbb R^p$ is bilinear. Then $$B(x+h,y+k)=B(x,y)+B(x,k)+B(h,y)+B(h,k)$$

Thus $$B(x_0+h,y_0+k)-B(x_0,y_0)=B(x_0,k)+B(h,y_0)+B(h,k)$$

Let $A:\Bbb R^n\times \Bbb R^n\to\Bbb R $ be the map that sends $(a,b)$ to $B(x_0,b)+B(a,y_0)$. This is linear, and the above gives $$B(x_0+h,y_0+k)-B(x_0,y_0)=A(h,k)+B(h,k)$$

It suffices we show that $B(h,k)$ os $o(\lVert h,k\rVert)$. Let $e_i,e_j$ be the canonical bases for $\Bbb R^n,\Bbb R^m$. If $h=(h_1,\ldots,h_n),k=(k_1,\ldots,k_m)$ then $$B(h,k)=\sum_{i,j} h_ik_j B(e_i,e_j)$$ and $|h_j|,|k_i|\leqslant \lVert h,k\rVert$, so if $C=\sum_{i,j}\lVert B(e_i,e_j)\rVert $ (a constant depending only on $B$ and the basis of choice)

$$\lVert B(h,k)\lVert\leqslant C\lVert h,k\rVert^2$$

5
On

When solving this kind of problems, your eyes are often more important than your memory. I mean: look at the function and try to collect as much information as you can. For instance, your function is sum of squares, and this may be really helpful. Then you can try to apply the criterion of the directional derivative: if $$L=\lim_{\varepsilon \to 0} \frac{f(x+\varepsilon h_1,y+\varepsilon h_2)-f(x,y)}{\varepsilon}$$ exists, is linear in $h_1$ and $h_2$, and is continuous in $(x,y)$, then $f$ is differentiable at $(x,y)$ (and $L=Df(x,y)(h_1,h_2)$. Sometimes this is easier to apply than the mere definition of derivative in several variables.

But do not forget that intructors tend to construct functions for which the only tool is the direct analysis of $f(x+u,y+v)-f(x,y)$.