differentiability and continuity of $f: \mathbb{R}^2 \to \mathbb{R}$ I have a problem with this function.
I have to study where the function is continuous  and where is differentiable.
The function is $f : \Bbb R^2 → \Bbb R$ :
$$
f(x, y) = \begin{cases}
   x + \sin(y)& x\le y \\
       y + \sin(x) & x>y \\ 
\end{cases}
$$
Continuity
(i think that is wrong):
I know that
 $$ sin(y) + x $$
is continuos in  $\mathbb{R}^2$ because $sin(y)$ and $x$ are continuos.
(for $sin(x)+ y$ is the same)
My problem is about the point $(x = y)$.
What i have to do?
I tried with:
$$
\lim_{(x,y)\to (a,a)}f(x,y)
$$
Differentiability
I compute the Partial derivative:
$$
\frac{\partial f}{\partial x} = \begin{cases}
   1& x\le y \\
       cos(x) & x>y \\ 
\end{cases}
$$
and
$$
\frac{\partial f}{\partial y} = \begin{cases}
   cos(y)& x\le y \\
       1 & x>y \\ 
\end{cases}
$$
So i think that is differentiable in $\mathbb{R}^2$\{(x,y): x=y}.
For (x = y) I used the definition of differentiability:
$$
\lim_{(h,k)\to (0,0)}(f(x+h,y+k) - f(x,y) - \frac{\partial f}{\partial y}(x,y) *h- \frac{\partial f}{\partial x}(x,y)*k)/\sqrt((h^2 + k^2))
$$
Is it correct?
 A: Let's try to see it from a more general point of view: you are given a differentiable function
$$ g:\mathbb{R}^2\to \mathbb{R},(x,y)\to g(x,y), $$
and you are asked to check continuity, and possibly differentiability of a new function
$$ f:\mathbb{R}^2\to \mathbb{R}, (x,y)\mapsto \begin{cases}
g(x,y) & x\leq y \\
g(y,x) & x>y. \end{cases} $$
Now, because your $g$ is $x+\sin(y)$, you already know it is continuous everywhere, so that $f^1=f|_{x\leq y}$ and $f^2=f|_{x>y}$ can be continuously extended to the boundary $\{x=y\}$. Therefore, it is enough to check whether the two sides coincide here. But this is the case as
$$ f^1(x,x)=g(x,x)=f^2(x,x). $$
Regarding differentiability, we proceed similarly, we compute the directional derivatives in both sides to get
$$ \partial_x f^1 = \partial_x g,\quad \partial_y f^1 = \partial_y g $$
and
$$ \partial_x f^2 = \partial_y g,\quad \partial_y f^2 = \partial_x g. $$
Then, by the same argument as before, we only need to check that these derivatives can be extended up to the boudary and coincide there (we already checked that $f^1|_{x=y}=f^2|_{x=y}$).
We have
$$ \partial_x g(x,y)|_{x=y} = 1|_{x=y} = 1 $$
and
$$ \partial_y g(x,y)|_{x=y} = \cos(y)|_{x=y}=\cos(x) $$
which is different from $1$ when $x\not\in 2\pi \mathbb{N}$.
This means that $f$ is differentiable, as you say, on $\mathbb{R}^2 \setminus \{x=y\}$. Notice that, even though the partial derivatives coincide on $x=y=2\pi\mathbb{N}$, we cannot immediately conclude that it is differentiable at these points, as the fact that the partial derivatives exist continuous in a neighborhood of these points is only sufficient, and this is not the case as they are not continuous on $\mathbb{R}^2\setminus \{x=y\neq 2\pi\mathbb{N}\}$ (the do not even exist on the slit).
To prove that the function is actually differentiable at the points $\{x=y=2\pi\mathbb{N}\}$, we must use the definition. I claim that the differential is $(1,1)$. Because it is differentiable from the right of $\{x=y\}$ and from the left, we have
$$ \lim_{h\to 0, h_1\leq h_2} \frac{| f(x,y)-f(x+h_1,x+h_2)-h_1-h_2|}{|h|} = \lim_{h\to 0, h_1\leq h_2} R_2(h) = 0, $$
similarly for $h_1>h_2$ and $R_2$. Therefore, for every $\varepsilon>0$ we can find $r>0$ such that if $0<|h|<r$, $R_1(h)<\varepsilon/2$ and $R_2(h)<\varepsilon/2$, which implies
$$ \frac{| f(x,y)-f(x+h_1,x+h_2)-h_1-h_2|}{|h|} \leq R_1(h)+R_2(h) \leq \varepsilon, $$
i.e. $f$ is actually differentiable at these points.
