Answer
The values of the constant $a$, such that the following function is continuous for all real numbers.,
$$
f(x)=\left\{\begin{array}{ll}{\frac{a x}{\tan x},} & {x \geq 0} \\ {a^{2}-2,} & {x<0}\end{array}\right.
$$
are
$$
a=-1,2
$$
Work Step by Step
$$
f(x)=\left\{\begin{array}{ll}{\frac{a x}{\tan x},} & {x \geq 0} \\ {a^{2}-2,} & {x<0}\end{array}\right.
$$
since $f(x)$ is continuous then
$$
\lim _{x \rightarrow 0^{-}} f(x)=\lim _{x \rightarrow 0^{+}} f(x)=f(a).
$$
So
$$
\lim _{x \rightarrow 0^{-}} f(x)=\lim _{x \rightarrow 0^{-}}\left(a^{2}-2\right)=a^{2}-2
$$
and
$$
\begin{split}
\lim _{x \rightarrow 0^{-}} f(x) &=\lim _{x \rightarrow 0^{+}} \frac{a x}{\tan x} \\
&\quad\quad\quad\left[\text {The fraction part is } \frac{0}{0} \text { so we can use L'Hospital's } \right] \\
& =\lim _{x \rightarrow 0^{+}} \frac{a }{\sec^{2}x}\\
&=a
\end{split}
$$
Therefore, we have
$$
a^{2}-2=a
$$
$\Rightarrow$
$$
a^{2}-a-2=0 \Rightarrow (a-2)(a+1)=0 \Rightarrow a=-1,2
$$