# Force a negative square root to be interpreted as an I

I have expressions like $$\sqrt{-\sqrt{1+x^2}}$$ how can I force mathematica to systematically rewrite this as

$$i(1+x^2)^{1/4} \quad ?$$

This transformation is not valid for arbitrary $x \in \mathbb{C}$. You can for example test that it is not valid for x -> 1+I.

PowerExpand is one way to force the transformation. From the documentation:

PowerExpand converts (a b)^c to a^c b^c, whatever the form of c is.

with the caveat that

The transformations made by PowerExpand are correct in general only if c is an integer or a and b are positive real numbers.

The following will give a generally valid transformation:

PowerExpand[Sqrt[-Sqrt[1 + x^2]], Assumptions -> True]

(*  I E^(I π Floor[-(Arg[1 + x^2]/(4 π))]) (1 + x^2)^(1/4)  *)


To assume that x is real, you can use any of

a = Sqrt[-Sqrt[1 + x^2]]

Refine[a, x ∈ Reals]
(* I (1 + x^2)^(1/4) *)

Simplify[a, x ∈ Reals]
(* I (1 + x^2)^(1/4) *)

ComplexExpand[a]
(* I (1 + x^2)^(1/4) *)


You might find these options safer as unlike PowerExpand they use simpler and explicit assumptions.

• Or use PowerExpand[Sqrt[-Sqrt[1 + x^2]], Assumptions -> Element[x, Reals]] which will do the transformation only if valid (which it is). This way you are not relying on Refine et al, which may have goals different from PowerExpand (and thus not do the desired transformation). – Daniel Lichtblau Jan 20 '15 at 17:34

A simple solution to a simple problem

PowerExpand[Sqrt[-Sqrt[1 + x^2]]]


yields $$i \sqrt{x^2+1} .$$