What is $(-1)^X?$ Why the negative number raised to X gives strange graph?
Y = (-1) ^ X

This is sine and cosine both functions in real and imaginary part.
How to explain this?
 A: If you heard about complex numbers, you should wonder how powers are evaluated in the complex.
A possible definition is with the polar representation
$$z=re^{i\theta}\implies z^x=r^xe^{i\theta x}$$ where $x$ is a real number.
Then
$$(-1)^x=(e^{i\pi})^x=e^{i\pi x}=\cos(\pi x)+i\sin(\pi x).$$

Beware that this is not the definition, because one also has
$$(-1)^x=(e^{i3\pi})^x=\cos(3\pi x)+i\sin(3\pi x)$$ and similar with other $2\pi$ increments.

More generally, a complex raised to a complex power can be defined by logarithms,
$$z^w=e^{w\log z}=e^{w(\log r+i\theta)}=e^{x\log r-y\theta+i(x\theta+y\log r)}=e^{x\log r-y\theta}(\cos(x\theta+y\log r)+i\sin(x\theta+y\log r)).$$
A: So, let's consider the function $f\left( x \right) = {\left( { - 1} \right)^x}$. It is required to determine the existence domain of this function.
In order to determine the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ let's use the well-known Euler's formula that establishes the fundamental relationship between the trigonometric functions and the complex exponential function: ${e^{i x}} = \cos \left( x \right) + i \sin \left( x \right)$, where $x$ is arbitrary real number, i.e. $x \in \mathbb R^{1}  \equiv \left( { - \infty ,\, + \infty } \right)$, and $i$ is elliptic type imaginary unit, i.e. $i^{2}=-1$.
Since for $\forall n \in \mathbb Z \equiv \{..., -3, -2, -1, 0, +1, +2, +3, ...\}$ we have $\cos \left( {\left( {2 n + 1} \right) \pi } \right) =  - 1$ and $\sin \left( {\left( {2 n + 1} \right) \pi } \right) =  0$, then we can write that $ - 1 = \cos \left( {\left( {2 n + 1} \right) \pi } \right) + i \sin \left( {\left( {2 n + 1} \right) \pi } \right) = {e^{i \left( {2 n + 1} \right) \pi }}$. Therefore, the expression ${\left( { - 1} \right)^x} = {\left( {{e^{i \left( {2 n + 1} \right) \pi }}} \right)^x} = {e^{i \left( {2 n + 1} \right) \pi  x}} = \cos \left( {\left( {2 n + 1} \right) \pi   x} \right) + i \sin \left( {\left( {2 n + 1} \right) \pi  x} \right)$ is hold true as soon as $\sin \left( {\left( {2 n + 1} \right) \pi  x} \right) = 0$.
So, the question of determination of the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is reduced to the problem of solving the equation  $\sin \left( {\left( {2 n + 1} \right) \pi  x} \right) = 0$.
As we know the equation $\sin \left( \alpha  \right) = 0$ has the solution $\alpha  = \pi  k$, where $k \in \mathbb Z$. Consequently, from $\sin \left( {\left( {2 n + 1} \right) \pi  x} \right) = 0$ we have $\left( {2 n + 1} \right) \pi  x = \pi  k$, where $k \in \mathbb Z$, $n \in \mathbb Z$, i.e. $x = \frac{{\pi  k}}{{\left( {2 n + 1} \right) \pi }} = \frac{k}{{2 n + 1}}$, where $k \in \mathbb Z$, $n \in \mathbb Z$.
So, the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is the set $\left\{ {\frac{k}{{2 n + 1}},\,\,\forall k \in \mathbb Z ,\,\,\forall n \in \mathbb Z} \right\}$. In other words, for each $x \in \left\{ {\frac{k}{{2 n + 1}},\,\,\forall k \in \mathbb Z ,\,\,\forall n \in \mathbb Z } \right\}$ the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is defined.
Remark. Above, I have used the phrase "elliptic type imaginary unit" instead the habitual set expression "imaginary unit". Here, I would not like to explain the meaning of the phrase "elliptic type imaginary unit" as well as the meaning of the phrase "elliptic complex number". Here, I would like only to note that there are three types of complex numbers:

*

*Elliptic complex numbers for which $a + \frac{{{b^2}}}{4} < 0$ in ${i^2} = a + b i$. The primitive of them is usual system of complex numbers for which ${i^2} =  - 1$ (i.e. $a=-1$ and $b=0$ in ${i^2} = a + b i$) that is called canonical: it is not difficult to prove that arbitrary system of elliptic complex numbers is algebraically isomorphic to its canonical system;

*Parabolic complex numbers for which $a + \frac{{{b^2}}}{4} = 0$ in ${i^2} = a + b i$. Arbitrary system of parabolic complex number is algebraically isomorphic to its canonical system for which ${i^2} =  0$ (i.e. $a=b=0$ in ${i^2} = a + b i$);

*Hyperbolic complex numbers for which $a + \frac{{{b^2}}}{4} > 0$ in ${i^2} = a + b i$. Arbitrary system of hyperbolic complex number is algebraically isomorphic to its canonical system for which ${i^2} =  1$ (i.e. $a=1$ and $b=0$ in ${i^2} = a + b i$).

I hope my answer can help someone.
