Problems in proving the differentiability of a function

I have to prove if this function is differentiable.

$$f(x,y)= \begin{cases} \frac{\cos x-\cos y}{x-y} \iff x \neq y \\-\sin x \iff x=y \end{cases}$$

if $x \neq y$ it is continuous, but i want to see if it is continuous in x=y too.

i can rewrite f as $$f(x,y)= \begin{cases} \frac{g(x)-g(y)}{x-y} \iff x \neq y \\ g'(x)=g'(y) \iff x=y \end{cases}$$

and see that $lim_{xy \to xx} g(x,y)=g'(x)$. THus, it is continuous. Also, the partial derivatives exist: $$f_x(x,y)=\begin{cases} \frac{-\sin x(x-y)-\cos x+\cos y}{(x-y)^2} \\ -\cos(x) \end{cases}$$ $$f_y(x,y)=\begin{cases} \frac{\sin y(x-y)+\cos x-\cos y}{(x-y)^2} \\ 0 \end{cases}$$ If I proved that they are continuous, too, for the theorem of the total differential, the function would be differentiable. Still, I'm not sure this is the right way of reasoning.

$\cos x-\cos y=-2\sin\frac{x+y}2\,\sin\frac{x-y}2$ and $\operatorname {sinc}u=\frac{\sin u}{u}$ is a known analytical function. So $f(x,y)=-\sin\frac{x+y}2\operatorname {sinc}\frac{x-y}2$.

This seems like a perfectly OK way to do your work.

ALternatively, you might look at the function

$$h(u, y) = f(u+y, y).$$

Writing that out, you get $$h(u, y) = f(u+y,y)= \begin{cases} \frac{\cos(u+y)-\cos(y)}{u} \iff u+y \neq y \\ -\sin(y) \iff u = 0 \end{cases}$$

Which you can rewrite as $$h(u, y) = f(u+y,y)= \begin{cases} \frac{\cos(u+y)-\cos(y)}{u} \iff u \neq 0 \\ -\sin(y) \iff u = 0 \end{cases}$$

In these rotated coordinates, it might be a little easier to prove things.

One has $$f(x,y)=-\int_0^1\sin\bigl((1-t)y+t\,x\bigr)\ dt\qquad\forall\ (x,y)\in{\mathbb R}^2\ .$$ This shows that $f\in C^\infty({\mathbb R}^2)$.