Solving a problem involving continuity of a piecewise function I'm trying to solve the following problem:

Determine which $n\in\mathbb{N}$ make the following function
  $f:\mathbb{R}^3\rightarrow \mathbb{R}$ continuous at the origin:
$   f(x,y,z)=\left\{
      \begin{array}{cr}
       
 \frac{(\cos^2\left(|x|+|y|\right)-1)\sin(y^2+z^2)}{(x^2+y^2+z^2)^{n/2}}
 & \text{if } (x,y,z) \neq 0\\
        0 & \text{if } (x,y,z) = 0\\
      \end{array}  \right. $

It's obvious that $f$ is continuous at the origin if $n\leq 2$, since:
$\left|\frac{(\cos^2\left(|x|+|y|\right)-1)\sin(y^2+z^2)}{(x^2+y^2+z^2)^{n/2}}\right|\leq\frac{|\cos^2\left(|x|+|y|\right)-1|\,|y^2+z^2|}{|x^2+y^2+z^2|}\leq\frac{|\cos^2\left(|x|+|y|\right)-1|\,|y^2+z^2|}{|y^2+z^2|}=|\cos^2\left(|x|+|y|\right)-1|\rightarrow 0$
I'm almost sure the function isn't continuous if $n> 2$ but I can't seem to find a way to prove it.
 A: I think it is continuous for $n=3$ too. If we let $r$ be the length of the vector $(x,y,z)$, then the expression for nonzero $r$ simplifies to
$$\frac{(\cos^2(pr)-1)\sin(qr^2)}{r^n}$$
where $p\in[0,\sqrt 2]$ and $q\in[0,1]$ depend on the direction of $(x,y,z)$, but not on its magnitude. If we develop the cosine and sine to the second degree each, we get the approximation
$$\frac{-(pr)^2\cdot qr^2}{r^n}=2p^2qr^{4-n}$$
so as long as $n<4$ this ought to converge towards $0$.
On the other hand for $n\ge4$ we can consider the ray $(x,y,z)=(0,r,0)$. Along this line $p=q=1$, so $f$ fails to go towards $0$ for $n=4$ and actually blows up for $n>4$.
Making this rigorous using L'Hôpital's rule is left as an exercise for the reader :-)
A: The question is for $n$ integer, but we can take $a\in\mathbb R$ instead of $n$. We denote $f_a$ the corresponding function. We have for $(x,y,z)\neq (0,0,0)$ 
$$f_a(x,y),z)=-\frac{\sin^2(|x|+|y|)\sin (y^2+z^2)}{(x^2+y^2+z^2)^{a/2}}.$$
Now, fix a real number $m$. We have 
$$f_a(x,mx,mx)=-\frac{\sin(2|mx|)\sin(2m^2x^2)}{(1+2m^2)^{a/2}|x|^a}\overset{0}{\sim}-\frac{4|m^3||x|^{3-a}}{(1+2m^2)^{a/2}},$$
hence $f_a$ cannot be continuous if $3-a\leq 0$ hence $a\geq 3$. Conversely, if $a<3$ we have thanks to then inequality $|\sin t|\leq |t|$:
\begin{align*}
|f_a(x,y,z)|&\leq\frac{(|x|+|y|)(y^2+z^2)}{(x^2+y^2+z^2)^{a/2}}\\
&\leq \sqrt 2\frac{\sqrt{x^2+y^2}(y^2+z^2)}{(x^2+y^2+z^2)^{a/2}}\\
&\leq \sqrt 2(x^2+y^2+z^2)^{\frac{3-a}2},
\end{align*}
and we can conclude since the exponent is positive.
