# Absolute value of a complex number with a arbitrary basis

I want to calculate the square of the absolute value of a complex number $x^{ia}$, with $x$ and $a$ being real while $i$ is the imaginary number:

$$\left|x^{ia}\right|^2=?.$$

I have trouble because the basis is not the Euler constant $e$, but an arbitrary $x$. So, the first approach would be to rewrite it like:

$$x^{ia}=r\cdot e^{ia},$$

but how can I find $r$?

As $$x=e^{ln(x)}$$ Therefore $$x^{ia}=e^{ln(x)\cdot ia}=e^{i\cdot ln(x)a}$$ So $$r=1$$ and your phase is different from what you thought.
For real $x\gt0$, we usually take $\log(x)$ to be real as well. Since $a$ is also real, we have $\log(x^{ia})=ia\log(x)$ is pure imaginary. That means that $$\left|x^{ia}\right|=\left|1\cdot e^{ia\log(x)}\right|=1$$ Therefore, $r=1$.
You have to be very carefull with the notation $x^a$ if $x$ is allowed to be an arbitrary element of $\mathbb{C}$. It's natural to define $x^a$ via $$x^a = \exp(a\cdot\ln x)$$ but that leaves the natural logarithm $\ln x$ to be defined for arbitrary $x \in \mathbb{C}$.
Now, since the exponential function is not one-to-one over the complex numbers (observe that $\exp(x) = \exp(x + i2\pi k)$ for all $x$) multiple such definitions are possible. Assume that $\ln_1$ is one possible definition of a natural logarithm over $\mathbb{C}$, and $\ln_2$ another, with $$\ln_2(x) = i2\pi + \ln_1(x).$$
Then these two definitions then yiel, in general, different values for $x^a$ if $a \notin\mathbb{N}$, since \begin{align} x^a = \exp(a\ln_1(x)) \neq exp(a\ln_1(x))\cdot\underbrace{\exp(i2\pi a)}_{\neq 1} &= \exp(a\ln_1(x) + i2\pi a) \\ &= \exp(a(\ln_1(x) + i2\pi)) \\ &= \exp(a\ln_2(x)). \end{align}