Define differentiability of $\cos{|x|}$ and $\sin{|x|}$ at $x=0$
It is said that $\cos|x|$ is continuous and $\sin|x|$ is discontinuous at $x=0$. $$ Lf'(0)=\lim_{h\to 0^-}\frac{\cos|0+h|-\cos|0|}{h}=\lim_{h\to{0}}\frac{\cos h-1}{h}=Rf'(0) $$ Thus $\cos|x|$ is continuous. Fine, but applying chain rule, let $|x|=t$ $$ \frac{d}{dx}\cos|x|\bigg|_{x=0}=\frac{d}{dx}\cos t\bigg|_{x=0}=\frac{d(\cos t)}{dt}.\frac{dt}{dx}\bigg|_{x=0}=-\sin t.\frac{dt}{dx}\bigg|_{x=0}=-\sin t.\frac{d|x|}{dx}\bigg|_{x=0} $$ As $|x|$ is not differentiable at $x$=$0$, how can we define the derivative of $\cos|x|$ at $x=0$ ?


Since the functions, $|x|,\;\cos(x),\;\sin(x)$ are continuous, and since a composition of continuous functions is continuous, it follows that the functions $\cos(|x|)$, and $\sin(|x|)$ are both continuous.
With regard to differentiability . . .
By the chain rule, if two functions are both differentiable, their composition is also differentiable.
However, if one or both of two functions is not differentiable, the chain rule is not applicable, so yields no information.
Thus, for the question of whether $\cos(|x|)$ or $\sin(|x|)$ is differentiable at $x=0$, the chain rule doesn't apply.
Instead, we can argue as follows . . .
If $x\ge 0$, then $\cos(|x|)=\cos(x)$.
If $x < 0$, then $\cos(|x|)=\cos(-x) = \cos(x)$.
Thus, $\cos(|x|)=\cos(x)$, for all $x$.
Hence, since $\cos(x)$ is differentiable, so is $\cos(|x|)$.
On the other hand, $\sin(|x|)$ is not differentiable at $x=0$, since at $x=0$, the slope from the right is $1$, and the slope from the left is $-1$.
More precisely, let $f(x) = \sin(|x|)$.
If we restrict the domain of $f$ to $[0,\infty)$, we have $f(x) = \sin(|x|)=\sin(x)$, so on that domain, we have $f'(0)=\cos(0)=1$.
If we restrict the domain of $f$ to $(-\infty,0]$, we have $f(x) = \sin(|x|)=\sin(-x)=-\sin(x)$, so on that domain, we have $f'(0)=-\cos(0)=-1$.