$ f $ is differentiable in $ (0,0). $ Definition: Let $V\subseteq{\mathbb{R}^{m}}$ an open set, $a\in V$ y  $f\colon V\to\mathbb{R}^{n}$ a function. We will say that $f$ is differentiable in $a,$ if exists a linear transformation $f'(a)\colon\mathbb{R}^{m}\to\mathbb{R}^{n}$
such that
\begin{equation}
f(a+h)=f(a)+f'(a)(h)+r(h),\qquad\lim_{h\rightarrow 0}{\dfrac{r(h)}{\lVert h\rVert}}=0.
\end{equation}
Let $ a \in \mathbb {R}$ be. Define the function $ f \colon \mathbb {R}^ {2} \to \mathbb {R} $ given by
\begin{equation}
f(x,y)=\left\{\begin{matrix}
\dfrac{x\sin^{2}(x)+axy^{2}}{x^{2}+2y^{2}+3y^{4}} & (x,y)\neq(0,0)\\ 
0 & (x,y)=(0,0)
\end{matrix}\right.
\end{equation}
Find the value of $ a $ so that $ f $ is differentiable by $ (0,0). $
My attempt:
We observed that
\begin{equation}
\dfrac{\partial f}{\partial x}(0,0)=0=\dfrac{\partial f}{\partial y}(0,0).
\end{equation}
If $(x,y)\in\mathbb{R}^{2}\setminus\{(0,0)\},$ then
\begin{equation}
\dfrac{\partial f}{\partial x}(x,y)=\dfrac{\sin^{2}(x)(2y^{2}+3y^{4}-x^{2})+x\sin(2x)(x^{2}+2y^{2}+3y^{4})+ay^{2}(2y^{2}+3y^{4}-x^{2})}{(x^{2}+2y^{2}+3y^{4})^{2}}
\end{equation}
\begin{equation}
\dfrac{\partial f}{\partial y}(x,y)=\dfrac{2axy(x^{2}-3y^{4})-4xy\sin^{2}(x)(1+3y^{2})}{(x^{2}+2y^{2}+3y^{4})^{2}}
\end{equation}
If $\dfrac{\partial f}{\partial y}(x,y)=0,$ then
\begin{align}
2axy(x^{2}-3y^{4})-4xy\sin^{2}(x)(1+3y^{2})=0&\quad\Longleftrightarrow\quad a(x^{2}-3y^{4})=2\sin^{2}(x)(1+3y^{2})\\
&\quad\Longleftrightarrow\quad a=\dfrac{2\sin^{2}(x)(1+3y^{2})}{x^{2}-3y^{4}}
\end{align}
\begin{equation}
f(x,y)=\left\{\begin{matrix}
x\sin^{2}(x) & (x,y)\neq(0,0)\\ 
0 & (x,y)=(0,0)
\end{matrix}\right.
\end{equation}
\begin{equation}
\dfrac{\partial f}{\partial x}(0,0)=0=\dfrac{\partial f}{\partial y}(0,0)
\end{equation}
From this it follows that $\dfrac{\partial f}{\partial x}(x,y)$ and $\dfrac{\partial f}{\partial y}(x,y)$ are continuous by $(0,0)$ y $f$ is differentiable by $(0,0).$
Are my arguments correct?
Any suggestion is welcome.
 A: We have that
$$\dfrac{\partial f}{\partial x}(0,0)=\lim_{h\to 0}\frac{\dfrac{h\sin^{2}(h)}{h^{2}}}{h} =\lim_{h\to 0}\dfrac{h\sin^{2}(h)}{h^3}=1$$
$$\dfrac{\partial f}{\partial y}(0,0)=\lim_{k\to 0}\frac{\dfrac{0}{2k^{2}+3k^4}}{k} =0$$
then by definition we need to check that
$$\lim_{(h,k)\to (0,0)}\frac{\dfrac{h\sin^{2}(h)+ahk^{2}}{h^{2}+2k^{2}+3k^{4}}-h}{\sqrt{h^2+k^2}} =\lim_{(h,k)\to (0,0)} \dfrac{h\sin^{2}(h)+ahk^{2}-h^3-2hk^2-3hk^4}{(h^{2}+2k^{2}+3k^{4})\sqrt{h^2+k^2}}=0$$
which is true indeed by $a=2$
$$\dfrac{h\sin^{2}(h)+ahk^{2}-h^3-2hk^2-3hk^4}{(h^{2}+2k^{2}+3k^{4})\sqrt{h^2+k^2}}=\dfrac{h(h^2+O(h^4))+2hk^{2}-h^3-2hk^2-3hk^4}{(h^{2}+2k^{2}+3k^{4})\sqrt{h^2+k^2}}=$$
$$=\dfrac{-3hk^4+O(h^5)}{(h^{2}+2k^{2}+3k^{4})\sqrt{h^2+k^2}}$$
then use polar coordinates.
A: A somewhat different approach:
In order to be differentiable, a function must be continuous and have a continuous derivative (or have a derivative with an essential singularity).  Continuity requires that the limit as you approach the point be the same, regardless of direction of your approach.
Suppose we approach along the line $x=y=\epsilon$.  Then we have (using the fact that $\frac{d}{da}\sin^2(a)=\sin(2a)$:
$$g(\epsilon)=f(\epsilon,\epsilon) = \frac{\epsilon\sin^2(\epsilon)+a\epsilon^3}{\epsilon^2+2\epsilon^2+3\epsilon^4} = \frac{\sin^2(\epsilon)+a\epsilon^2}{3\epsilon+3\epsilon^3}=\frac{1}{3}\frac{\sin^2(\epsilon)+a\epsilon^2}{\epsilon+\epsilon^3}$$
$$g'(\epsilon)=\frac{1}{3}\frac{(\epsilon+\epsilon^3)(\sin(2\epsilon)+2a\epsilon)-(\sin^2(\epsilon)+a\epsilon^2)(1+3\epsilon^2)}{\epsilon^2+2\epsilon^4+\epsilon^6} = \frac{1}{3}\frac{\epsilon\sin(2\epsilon)+2a\epsilon^2+\epsilon^3\sin(2\epsilon)+2a\epsilon^4-\sin^2(\epsilon)-a\epsilon^2-3\epsilon^2\sin^2(\epsilon)-3a\epsilon^5}{\epsilon^2+2\epsilon^4+\epsilon^6}$$
$$\lim_{\epsilon\rightarrow0}g'(\epsilon)=\frac{1}{3}\lim_{\epsilon\rightarrow0}\frac{\epsilon\sin(2\epsilon)+2a\epsilon^2+\epsilon^3\sin(2\epsilon)+2a\epsilon^4-\sin^2(\epsilon)-a\epsilon^2-3\epsilon^2\sin^2(\epsilon)-3a\epsilon^5}{\epsilon^2+2\epsilon^4+\epsilon^6} = \frac{1}{3} \lim_{\epsilon\rightarrow0} \frac{\sin(2\epsilon)+2\epsilon\cos(2\epsilon)+4a\epsilon+3\epsilon^2\sin(2\epsilon)+2\epsilon^3\cos(2\epsilon)+8a\epsilon^3-\sin(2\epsilon)-2a\epsilon-6\epsilon\sin^2(\epsilon)-3\epsilon^2\sin(2\epsilon)-15a\epsilon^4}{2\epsilon+8\epsilon^3+6\epsilon^5} = \frac{1}{3} \lim_{\epsilon\rightarrow0} \frac{2\epsilon\cos(2\epsilon)+2a\epsilon+2\epsilon^3\cos(2\epsilon)+8a\epsilon^3-6\epsilon\sin^2(\epsilon)-15a\epsilon^4}{2\epsilon+8\epsilon^3+6\epsilon^5} = \frac{1}{3} \lim_{\epsilon\rightarrow0} \frac{2\cos(2\epsilon)+2a+2\epsilon^2\cos(2\epsilon)+8a\epsilon^2-6\sin^2(\epsilon)-15a\epsilon^3}{2+8\epsilon^2+6\epsilon^4} = \frac{1}{3} \frac{2+2a}{2} = \frac{1+a}{3}$$
Suppose we approach along the line $-x=y=\epsilon$.  Then we have:
$$h(\epsilon)=f(-\epsilon,\epsilon) = \frac{-\epsilon\sin^2(-\epsilon)-a\epsilon^3}{\epsilon^2+2\epsilon^2+3\epsilon^4} = \frac{-\epsilon\sin^2(\epsilon)-a\epsilon^3}{\epsilon^2+2\epsilon^2+3\epsilon^4}= -g(\epsilon)$$
$$h'(\epsilon)=-g'(\epsilon)$$
$$\lim_{\epsilon\rightarrow0}h'(\epsilon)=-\lim_{\epsilon\rightarrow0}g'(\epsilon)=-\frac{1+a}{3}$$
In both directions, the limit of the derivative existed, and therefore because the direction of approach doesn't matter, we require that the limits be the same.
$\frac{1+a}{3}=-\frac{1+a}{3}$, which means that $a=-1$.
