Consider the function $$f(x,y)=\begin{cases} xy\dfrac{x^2-y^2}{x^2+y^2},&(x,y)\ne(0,0)\\ 0,&(x,y)=(0,0) \end{cases}$$
I can show that $f_x(0,0)=f_y(0,0)=0$.
f[x_, y_] = If[{x, y} != {0, 0}, x y (x^2 - y^2)/(x^2 + y^2), 0];
Limit[(f[0 + h, 0] - f[0, 0])/h, h -> 0]
Limit[(f[0, 0 + h] - f[0, 0])/h, h -> 0]
Hand calculations produce the same results. Because $f(0,0)=0$, the tangent plane is $z=0$.
Consider:
DynamicModule[{f},
f[x_, y_] = x y (x^2 - y^2)/(x^2 + y^2);
Manipulate[
Show[
Plot3D[{f[x, y], 0}, {x, -w, w}, {y, -w, w},
PlotStyle -> {Directive[Red], Directive[LightBlue, Opacity[.8]]},
PlotRange -> All,
BoxRatios -> Automatic,
PerformanceGoal -> "Quality"]
],
{{w, 2.5}, .01, 3}
]]
Which produces this image:
When you move the slide, things appear to flatten out. I can show that the function $f$ is continuous at (0,0). Let $\epsilon>0$. Choose $\delta=\sqrt{\epsilon/2}$. Then, whenever $0<|(x,y)-(0,0)|<\delta$, or equivalently, whenever $0<\sqrt{x^2+y^2}<\delta=\sqrt{\epsilon/2}$, then: $$\begin{align*} \left|f(x,y)-f(0,0)\right| &=\left|xy\dfrac{x^2-y^2}{x^2+y^2}-0\right|\\ &=\dfrac{|x^3y-xy^3|}{x^2+y^2}\\ &\le \dfrac{x^2|xy|+y^2|xy|}{x^2+y^2}\\ &\le2|xy|\\ &=2|x||y|\\ &\le2\sqrt{x^2+y^2}\sqrt{x^2+y^2}\\ &=2(x^2+y^2)\\ &<\epsilon \end{align*}$$
However, in order for the tangent plane to be a good approximation of f near (0,0), f must be differentiable at (0,0). There is a theorem that says that if the partial derivatives exist on an open region containing (0,0) and if they are continuous at (0,0), then f is differentiable at (0,0) and the talent plane is a good approximation of f near (0,0).
So, I compute $f_x(x,y)$.
fx[x_, y_] = D[f[x, y], x] // Simplify
And we have already verified that $f_x(0,0)=0$, so: $$f_x(x,y)=\begin{cases} \dfrac{y(x^4+4x^2y^2-y^4)}{(x^2+y^2)^2},&(x,y)\ne(0,0)\\ 0,&(x,y)=(0,0) \end{cases}$$
Now, is $f_x(x,y)$ continuous at (0,0)?
Plot3D[fx[x, y], {x, -3, 3}, {y, -3, 3},
MeshFunctions -> {#3 &}]
Which produces this image:
ContourPlot[fx[x, y], {x, -3, 3}, {y, -3, 3}]
Which produces this image.
There are a few contours that approach (0,0), but if I hover my mouse over them and approach the origin, they are all equal to 0. So I don't see a path to the origin that will give me an answer different from zero. Still, this doesn't prove that it is continuous at (0,0).
I can't come up with a hand calculation proof that $\displaystyle lim_{(x,y)\to(0,0)}f_x(x,y)=f_x(0,0),$ so I started to try to use Mathematica to show that $$\left|\dfrac{y(x^4+4x^2y^2-y^4)}{(x^2+y^2)^2}-0\right|<\epsilon\quad\text{whenever}\quad0<\sqrt{x^2+y^2}<\delta.$$
I tried
Solve[Abs[fx[x, y] - 0] < 0.1, {x, y}]
Which I had to abort. Then I tried:
Solve[-0.1 < fx[x, y] < 0.1, {x, y}]
Then I tried:
Reduce[-0.1 < fx[x, y] < 0.1, {x, y}]
Not much luck in any case. How can I go about finding a region about (0,0) so that
$$\left|\dfrac{y(x^4+4x^2y^2-y^4)}{(x^2+y^2)^2}-0\right|<0.1$$
f
withf[x_, y_] := Piecewise[{{x y (x^2 - y^2)/(x^2 + y^2), x != 0 && y != 0}}, 0]
.Piecewise
is usually better thatIf
for defining mathematical functions. $\endgroup$Plot
,NDSolve
, etc. -- evenD
: CompareD[If[x >= 0, x^2, 1], x]
vs.D[Piecewise[{{x^2, x >= 0}}, 1], x]
. Another difference is thatPiecewise
evaluates its arguments (even though it isHoldAll
);If
does not. Whether that's an advantage or not might depend, but it's a difference to keep in mind. $\endgroup$