Wikipedia:Reference desk/Archives/Mathematics/2009 December 19

= December 19 =

Differentiability of a function from R^2 to R at the origin
Hi all,

could anyone tell me if the function $$f(x,y)=\frac{x^2y}{x^2+y^2}$$ with f(0,0)=0 is differentiable at (0,0)? I've shown it to be continuous at 0, and that directional derivatives exist in every direction at the origin, but I'm not sure whether or not it's differentiable at the origin (in the Fréchet derivative sense), and how to prove it if it is or prove it isn't if not.

Thanks for the help, Typeships17 (talk) 05:18, 19 December 2009 (UTC)


 * $$f(x,0)$$ doesn't look continuous to me, it is 1 everywhere except when x=0 when it is 0. Dmcq (talk) 07:21, 19 December 2009 (UTC)
 * Since $$f(x, 0) = \frac{x^2 \cdot 0}{x^2 + 0} = 0$$ for every $$x \in \mathbb{R}$$, $$f(x, 0)$$ is indeed continuous (...but you have probably just made a silly mistake anyway ;)). -- PS T  10:46, 19 December 2009 (UTC)
 * Oops silly me above about f(x,0) being 1, I left the y out of the numerator! Zero most certainly doesn't mean not present. Sorry. Dmcq (talk) 12:43, 19 December 2009 (UTC)
 * $$\begin{align}

\frac{\partial f}{\partial x} (0, 0) &{}= \lim_{h \to 0}\frac{f(h, 0) - f(0, 0)}{h} = \lim_{h \to 0}\frac{\frac{h^2\cdot 0}{h^2}}{h} = 0. \end{align}$$
 * $$\begin{align}

\frac{\partial f}{\partial y} (0, 0) &{}= \lim_{h \to 0}\frac{f(0, h) - f(0, 0)}{h} = \lim_{h \to 0}\frac{\frac{0\cdot h}{h^2}}{h} = 0. \end{align}$$


 * Therefore, if f is differentiable at $$(0, 0)$$, necessarily $$D(f) = \begin{bmatrix}

0 \\ 0 \end{bmatrix}$$; we shall appeal directly to the definition of a Fréchet derivative:


 * $$\begin{align}

\lim_{(h_1, h_2) \to (0, 0)}\frac{f(h_1, h_2) - f(0, 0) - \begin{bmatrix} 0 \\ 0 \end{bmatrix}\cdot \begin{bmatrix} h_1 \\ h_2 \end{bmatrix}}{\sqrt{h_1^2 + h_2^2}} &{}= \lim_{(h_1, h_2) \to (0, 0)}\frac{f(h_1, h_2)}{\sqrt{h_1^2 + h_2^2}} \\ &{}= \lim_{(h_1, h_2) \to (0, 0)}\frac{h_1^2h_2}{(h_1^2 + h_2^2)^{3/2}} \\ &{}= \lim_{r \to 0}\frac{r^3\sin(\theta)(\cos(\theta))^2}{r^{3}} \\ &{}= \sin(\theta)(\cos(\theta))^2 \\ \end{align}$$.


 * Since the final limit in the sequence is not defined is not 0, f is not differentiable at $$(0, 0)$$. Hope this helps (... and I also hope that I have not muddled anything here; I am in a bit of a hurry ...I did muddle something, but have now corrected it). -- PS T  07:32, 19 December 2009 (UTC)


 * Too much in a hurry? Indeed what you have proved is that f is not differentiable at the origin 0. If it were, the differential at 0 would be 0, because both partial derivatives vanish there. But in any other direction the directional derivative is not 0 (in your line &minus;2 there should be r4 r3 in the denominator I think).
 * Note also that this f is continuous at 0 (in fact everywhere), and homogeneous of degree 1, that is $$f(tv)=tf(v)$$ for any t in R and v in R2. Any homogeneous function of degree 1 has all directional derivatives at the origin: $$\partial_t f(tv)\big|_{t=0}=f(v).$$ But it is F-differentiable iff it is linear: if it is differentiable you have $$f(v)=Df(0)v.$$ (and of course this f is not linear). --pma (talk) 08:33, 19 December 2009 (UTC)
 * You are right (I have corrected my error above). Thanks for correcting me! -- PS T  09:25, 19 December 2009 (UTC)
 * ...But is not the directional derivative of f (at the origin), equal to zero in every direction, per the following computation ($$v = (v_1, v_2)$$ denotes an arbitrary vector):


 * $$\begin{align}

\lim_{t \to 0} \frac{f(tv_1, tv_2) - f(0, 0)}{t} &{}= \lim_{t \to 0} \frac{f(tv_1, tv_2)}{t} \\ &{}= \lim_{t \to 0} \frac{t^2v_1^2tv_2}{t^2v_1^2 + t^2v_2^2} \\ &{}= \lim_{t \to 0} \frac{tv_1^2v_2}{v_1^2 + v_2^2} \\ &{}= 0 \\ \end{align}$$


 * You are of course right that f is not differentiable at the origin, but I think that its directional derivative (at the origin) along every direction is 0 (or maybe I have made another muddle...). ;) -- PS T  11:04, 19 December 2009 (UTC)


 * You're welcome! ( not another muddle: the same ;-) ) To summarize, the relevant facts to recall are:
 * 1. The directional derivative of a map $$f$$ at x wrto the direction v is by definition the derivative of the composed map $$t\mapsto x+tv\mapsto f(x+tv)$$ at $$t=0.$$ The directional derivative at $$x$$ in the direction $$v$$ is usually denoted $$\partial_v f(x),$$ that is $$\partial_v f(x):=\partial_t f(x+tv)\big|_{t=0};$$
 * 2. if $$f$$ is F-differentiable at $$x$$ then $$f$$ has all directional derivatives at $$x$$, and $$\partial_v f(x)=Df(x)v$$ (this is a plain consequence of the differentiability of a composition);
 * 3. if $$f$$ 1-homogeneous then $$f$$ has all directional derivatives at $$x=0$$, and $$\partial_v f(0)=f(v) $$ (this is immediate from $$f(tv)=tf(v)$$ just applying the definition, that is deriving wrto t);
 * 4. Having all directional derivatives does not imply being F-differentiable. Due to the preceding remarks, a counterexample is any 1-homogeneous, not linear function (actually the OP's one is possily the simplest such example; note that it has nonvanishing directional derivatives at the origin in all directions that are not parallel to (0,1) or to (1,0) ).--pma (talk) 11:23, 19 December 2009 (UTC)
 * Thanks, but I think there has been a misunderstanding. My point was that the directional derivative of f in every direction is zero, whereas you had said that it was never zero except when the direction corresponded to either of the partial derivatives of f, so I was wondering whether I had made a mistake. I saw my mistake of saying that f is differentiable at the origin, once you pointed it out, but I still cannot see why my assertion that the directional derivative of f (at the origin) is zero in every direction, is incorrect. Sorry for not making myself clear. ;) -- PS T  11:47, 19 December 2009 (UTC)
 * Don't you agree with my point 3? I think there's a factor t missing in the denominator at line &minus;2, in your last post. No matter, I also make these muddles; some of them survived hidden in my notes after years!  --pma (talk) 11:53, 19 December 2009 (UTC)
 * You are right again ;)!!! I cannot believe I made that mistake. Yes, I should have read your points a bit more carefully. Thanks! -- PS T  12:18, 19 December 2009 (UTC)
 * By the way I believe you should next try $$f(x,y)=\frac{x^2y}{x^4+y^2}$$ with f(0,0)=0 &lt;evil cackle /&gt;  Dmcq (talk) 13:03, 19 December 2009 (UTC)
 * I prefer a simpler example: f(x,y)=1 if y=x2 and x≠0, f(x,y)=0 everywhere else. Algebraist 14:52, 19 December 2009 (UTC)
 * This response has been fantastic, thankyou all very much! If you don't mind me asking, why is it that in PST's post taking the Frechet derivative directly, the denominator is $$h_1^2+h_2^2$$ rather than $$\sqrt{h_1^2+h_2^2}$$, which is surely $$\|(h_1,h_2)\|$$? Thanks again to everyone for their help! Typeships17 (talk) 15:45, 19 December 2009 (UTC)
 * You're completely right. Maybe he worked hard the past night! it happens to me too to make wrong computations the day after. I took the liberty of re-edit his post and correct; I sincerely apologize in advance if this is considered uncorrect (either socially or mathematically) ;-). --pma (talk) 16:07, 19 December 2009 (UTC)
 * Yes, you are right actually; I have had late (really late!) nights for the past one week, but that is another story. ;) Thanks for correcting my posts; I do not mind. -- PS T  06:42, 20 December 2009 (UTC)
 * That's great, thanks all! :) Typeships17 (talk) 17:09, 19 December 2009 (UTC)

Distance from a point to a line
find the distance from the line whose equation is 5x_12y+6=0         to p1(2;3)  —Preceding unsigned comment added by 79.141.23.101 (talk) 15:07, 19 December 2009 (UTC)

(added heading JohnBlackburne (talk) 15:13, 19 December 2009 (UTC))
 * See Distance from a point to a line. -- Meni Rosenfeld (talk) 15:53, 19 December 2009 (UTC)


 * If you looked here earlier I've since updated it, thinking when I looked at it of something to add then not stopping until I'd rewritten it, so you may want to look again. --JohnBlackburne (talk) 22:46, 19 December 2009 (UTC)

Plotting a fractal curve defined by binary digits
Consider the functions $$x:[0,1]\to[0,1]$$ and $$y:[0,1]\to[0,1]$$ defined via binary representation this way: for all $$t\in[0,1]$$ with binary expansion $$\textstyle t=\sum_{k>0}2^{-k}t_k,$$ (choose the one with finitely many 1's in case of double representation), the values $$\textstyle x(t)$$ and $$\textstyle y(t)$$ have binary expansions

$$\textstyle x(t):=\sum_{k>0}2^{-k}x_k$$

$$\textstyle y(t):=\sum_{k>0}2^{-k}y_k,$$

where the binary sequences $$\textstyle(x_k)_{k>0}$$ and $$\textstyle(y_k)_{k>0}$$ are respectively:

$$\textstyle x_k:=\operatorname{card}\,\{ j\in\N \,:\,1\le j<k,\, t_{2j-1}=t_{2j}=1-t_{2k}\}\,+\,t_{2k-1}\mod2,$$

$$\textstyle y_k:=x_k+t_{2k}\mod2.$$

I'd like to plot the graphs of $$\textstyle x,$$ and $$\textstyle y$$ and the curve in $$\textstyle [0,1]\times[0,1]$$ with parametric cartesian representation $$\textstyle (x(t),y(t)),$$ possibly with some finite sum approximations. I'm trying with Maple but something goes wrong. Would anybody teach me how to do it? The reason I'm interested, is that these pictures (if the computations I've just made are correct) should possibly give a nice addition to a certain wiki article... I'm not saying which one now, in the hope of making people more curious and plot the graph for me. Thank you, --pm a (talk)  20:41, 19 December 2009 (UTC)


 * Should "$$t_{2j-1}=t_{2j}=1+t_{2k}$$" be mod 2? –Henning Makholm (talk) 08:39, 20 December 2009 (UTC)
 * Yes, exact, everything is mod 2, thanks. I've changed the sign in front of $$t_{2k}$$ to avoid the ambiguity.--pm a (talk)  09:30, 20 December 2009 (UTC)
 * In any case, (almost) every point in [0,1]×[0,1] will arise as a possible value of (x(t),y(t)), which makes your curve easy to plot – it's a square full of ink!
 * To see this, let some arbitrary x and y (and thus xk, yk) be fixed. In general, the first k bits of x and y are given by the first 2k bits of t. By induction on k, assume that we have chosen bits up to t2k-2 to give us the desired bits up to xk-1 and yk-1. Now t2k must be 0 or 1 according to whether xk=yk or not. And once we know t2k, the value of the entire card{...} bracket is given, and you can solve for t2k-1.
 * The only snag is that this procedure might produce a tk sequence that is identically 1 from some point onwards and therefore is not actually hit by your mapping. But there are at most countably many such cases, so they'll hardly show on your graph. –Henning Makholm (talk) 09:00, 20 December 2009 (UTC)


 * You got it immediately, excellent. That is a binary representation of the Hilbert curve, and as you are saying, it makes a continuous bijection between non-dyadic points in [0,1] and pairs of non-dyadic points in [0,1]. I was curious to translate it in a binary form, and the above expressions are what I got. I made it because I'd like to see separately the graphs of the two coordinate functions x(t) and y(t) and possibly add the pictures to the article (the curve x(t),y(t) is a square full of ink, as you are saying). But I'm not very fond of plotting programs. --pm a  (talk)  09:30, 20 December 2009 (UTC)


 * Oops, I missed the point about plotting the coordinate functions separately. Can't help you with that, I'm afraid. Not experienced with plotting programs either; I usually end up doing ad-hoc perl scripts that emit pbm's :-)
 * (And I didn't say that your function was continuous; in fact it was not clear to me in this formulation that it would be continuous at the dyadic rationals). –Henning Makholm (talk) 09:48, 20 December 2009 (UTC)
 * Thanks anyway. Note that $$H(t):=(x(t),\,y(t))$$ represents the Hilbert curve exactly as shown in the linked picture, with the self-similar parametrization. Thus $$H(0)=(0,0);$$ $$H(1/2)=H(1/6)=H(5/6)=(1/2,1/2),$$ $$H(1)=(1,0),$$ &c. In particular the above $$x_k$$ and $$y_k$$ do define continuous functions, although it is not apparent from the formulas (unless, of course, I made a mistake in deriving them). If I'm not wrong your inversion argument also says that the above $$x_k$$ and $$y_k$$ define a bijection between the Cantor spaces of binary sequences 2 N+→2 N+&times;2 N+, actually a homeomorphism, which makes sense.--pm a  (talk)  11:20, 20 December 2009 (UTC)

So, I'll try to plot these graphs in the holidays. For whom is interested: the above xk and yk actually define a homeomorphism  h: 2 N+→2 N+&times;2 N+ such that for all binary sequences t and t' that are binary expansions of the same dyadic rational, the corresponding h(t):=(x,y) and h(t'):=(x',y') give binary expansions of the same pair of dyadic rationals (there are only a small number of cases to check). Therefore this map passes to the quotient, as it has to be, producing a continuous surjective map H:I→I&times;I, which is the (Hilbert variant of the) Peano map shown in the linked article, from which I deduced the above definition of xk and yk.--pm a  (talk)  13:31, 22 December 2009 (UTC)

To the interested reader: I learnt how to make decent graphs of the above functions with Maple. Here they are.... Note that for time 0≤t≤1/2, x(t) varies from 0 to 1/2 while y(t) covers the whole interval [0,1]. --pm a (talk)  23:56, 24 December 2009 (UTC)