All books that i am reading are telling that the identiy $ a^x = a^y \Longrightarrow x=y ; \,\,\,\,\, a \in \mathbb{R} - \{0,1\} $ $ \,\,\,\,$ also do not work for $a<0$, but, for example, if $ (-2)^2 = (-2)^x $, than for sure $x=2$.
Than, the identity works for $a<0$, correct?
It does not work for $a\lt 0$.
If $$(-1)^x=(-1)^2,$$ then $x=4$ is another solution.
In general, $$(-1)^x=(-1)^2\Rightarrow x=2m (m\in\mathbb Z)$$