Is $(\sqrt{-7})^2$ defined in the real domain? Obviously $\sqrt{-7}$ is undefined in the real domain (since $-7 \lt 0$), however I'm wondering if $(\sqrt{-7})^2$ is as well.
Per my understanding, using the following rule (listed in my textbook exactly as written):
$$
\sqrt{a^n} = (\sqrt{a})^n, a \in \mathbb{R},\space n \in \mathbb{N}
$$
we could say (also knowing that $\sqrt{a^2} = \left|a\right|$, where $a \in \mathbb{R}$):
$$
(\sqrt{-7})^2 = \sqrt{(-7)^2} = \left| -7\right| = 7
$$
effectively giving
$$
\sqrt{x^2} = (\sqrt{x})^2 = \left|x\right|, x \in \mathbb{R}
$$
Is this approach correct? (the final answer is clearly wrong - but the approach per my initial understanding follows all aforementioned rules).
 A: Your textbook (?) error starts from here:
$$\sqrt{a^n} = (\sqrt{a})^n, a \in \mathbb{R},\space n \in \mathbb{N}$$
The right rule should be like this:
$$\sqrt{a^n} = (\sqrt{a})^n, a≥0,\space n \in \mathbb{R}.$$
A: Solution-verification
Is this approach correct?
$$\sqrt{x^2} = (\sqrt{x})^2 = \left|x\right|, x \in \mathbb{R}$$
No, it is not correct.
The correct rule should be as follows:
$$\begin{align}\sqrt{x^2}& = (\sqrt{x})^2 = \left|x\right|=x, ~ \text{where}~ x≥0.&\end{align}$$
This implies, the following approach is also invalid:
$$\begin{align}(\sqrt{-7})^2 = \sqrt{(-7)^2} = \left| -7\right| = 7\end{align}$$
The correct approach might be as follows:
$$\begin{align}(\sqrt{-7})^2
&=(\sqrt {7i^2})^2\\
&=(i\sqrt 7)^2\\
&=i^2\times 7\\
&=-7.\end{align}$$
A: $\sqrt{-7} = i\sqrt{7}$ is obviously a complex number. $(i\sqrt{7})^2 = -7 \neq 7$
The rule ($\sqrt{a^n}=(\sqrt{a})^n$) which I had used in my question only works if both expressions are defined in the real number set (i.e. when $a \ge 0$ in this case). Since $\sqrt{-7} \notin R$, the rule does not apply and my approach is wrong.
