Consider the following simplification

(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] // FullSimplify

(Sqrt[Conjugate[A]] Sign[A])/Sqrt[A]

I am a bit confused by this output. I would have expected Mathematica to return just 1, since

$$A=|A|e^{i(\phi+2\pi n)}~~~,~~~A^*=|A|e^{-i(\phi+2\pi n)}~~~,~~~n\in\mathbb{Z}\,,$$

obviously leads to

$$\frac{\sqrt{A}\sqrt{A^*}}{\sqrt{AA^*}}=\frac{|A|\sqrt{e^{i(\phi+2\pi n)}}\sqrt{e^{-i(\phi+2\pi n)}}}{|A|}=e^{i\frac{\phi+2\pi n}{2} -i\frac{\phi+2\pi n}{2}}=1$$

on all branches $n\in \mathbb{Z}$.

Instead, we get the above output, where I'm not even sure what Sign of a complex number is supposed to mean. What is going on? Is there a way to make Mathematica simplify this properly?


Just to convince everyone that there is nothing special going on for Arg[A] >= Pi, see the following plot

Plot3D[ReIm[(Sqrt[x Exp[I \[Phi]]] Sqrt[x Exp[-I \[Phi]]])/Sqrt[  x Exp[I \[Phi]] x Exp[-I \[Phi]]]], {x, 0, 50}, {\[Phi], 0, 20 \[Pi]}]

enter image description here

Real part is always 1, imaginary part is always 0.


It seems that the trouble of $\sqrt{(-1)\cdot(-1)}$ vs $\sqrt{-1}\cdot \sqrt{-1}$ is addressed even in the relevant wikipedia article. There it is pointed out that $\sqrt{z^*}\neq \sqrt{z}^*$ when the principal square root function is considered. I guess Mathematica uses exactly that principal function version, which explains why it does not return what I expected.

Personally, I would have preferred if on the field of complex numbers we had non-identical $(-1)=e^{i \pi}$ and $(-1)^*=e^{-i \pi}$, which would resolve the issue and make $\sqrt{z^*}= \sqrt{z}^*$ true. But that's not standard, so I guess I can't expect it from Mathematica either.

  • 1
    $\begingroup$ From the "Details" section of the Sign documentation: "For non-zero complex numbers z, Sign[z] is defined as z/Abs[z]". $\endgroup$ – John Doty Jun 29 '18 at 17:48
  • $\begingroup$ @JohnDoty I see! $\endgroup$ – Kagaratsch Jun 29 '18 at 18:40

Since Sqrt is a function, it must be defined with a branch cut (this is not a shortcoming of Mathematica, just a result of requiring functions to be single-valued). The cut used by Mathematica means that phases $\phi$ of complex arguments are moved into the interval $-\pi < \phi\le \pi$ before applying the rule $\sqrt{\exp(i \phi)} = \exp(i \phi/2)$.

In your derivation, this rule is applied without moving the argument to the correct branch. This is a misunderstanding based on the fact that in mathematics the interpretation of the symbol $\sqrt{\ldots}$ isn't as strict as in Mathematica. You therefore have to adjust your expectation to correspond to the meaning of Sqrt, or replace the function Sqrt by something else.

I assume you don't want to throw out Sqrt from the code, so here is what you could do to get the expected result:

Simplify[(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] /. A -> Abs[A] Exp[I ϕ], 
Assumptions -> {-π < ϕ < π}]


What I did is replace A by its AbsArg representation and added the assumption about the phase ϕ being in the open interval excluding the boundaries.


It evidently depends on the value of A. Try

(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] // 
    Assumptions -> A \[Element] Complexes] & // FullSimplify

Piecewise[{{-1, Arg[A] >= Pi}}, 1]

So it's 1 if Arg[A] <= Pi

  • $\begingroup$ The PowerExpand function loses phase information, which is why you obtain this wrong result. See my edit for a plot, the function is equal to 1 in the lower half plane just as well as in the upper half plane. $\endgroup$ – Kagaratsch Jun 29 '18 at 18:45
  • 2
    $\begingroup$ Note that Arg[A] is always between -Pi and Pi, and "it's 1 if Arg[A] <= Pi" should read a strict < in place of <=. Not sure why the restriction on the range of Arg[] is not applied in simplification. $\endgroup$ – Michael E2 Jun 29 '18 at 19:44
  • $\begingroup$ @MichaelE2 I see! That makes more sense, thank you. $\endgroup$ – Kagaratsch Jun 29 '18 at 20:43
  • $\begingroup$ If Arg[A] == Pi, then A is pure Real. With the assumption that A is complex, Arg[A] = Pi is not a possibility. $\endgroup$ – Bill Watts Jun 30 '18 at 0:48
  • $\begingroup$ If A is real and negative, -1 is the right answer because we have (I*Sqrt[Abs[A]])^2/Sqrt[A^2] which is -1 $\endgroup$ – Bill Watts Jun 30 '18 at 0:58
(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] /. A -> -1
(*  -1  *)

because it's

I * I / 1
  • $\begingroup$ Mathematica seems to evaluate any expression Exp[ I Pi (1+2n) ]->-1 for any explicitly given integer n. However, I'm skeptical whether this is mathematically correct, since it disregards the phase. Exp[-I \[Pi]/2] and Exp[I \[Pi]/2] both square to -1, but are clearly different. Which means, in a proper treatment one should keep track of the branches to be able to recover them through a square root. $\endgroup$ – Kagaratsch Jun 29 '18 at 19:38
  • $\begingroup$ @Kagaratsch Power/Sqrt "give the principal value" according to the docs. $\endgroup$ – Michael E2 Jun 29 '18 at 19:47
  • $\begingroup$ I see, so by always taking the principal value Mathematica deliberately drops the phase information. Which means, Mathematica is not applicable to properly work with complex numbers... $\endgroup$ – Kagaratsch Jun 29 '18 at 20:40
  • 2
    $\begingroup$ Mathematica works fine with complex numbers. It just can't read your mind about which branch of a multivalued function you want to use in a particular case. $\endgroup$ – John Doty Jun 29 '18 at 20:51
  • $\begingroup$ @JohnDoty A complex Conjugate number is mathematically rigorously defined. And as shown in my question, when applying the correct definition of what Conjugate actually means the answer is the same for all branches $n\in\mathbb{Z}$. So I'm not sure why Mathematica would need to read anyones mind to return the only correct answer. $\endgroup$ – Kagaratsch Jun 29 '18 at 21:19

In addition to all the answers about complex numbers, Mathematica makes no assumptions that A is a number. It could just as easily be a matrix, for example:

In[13]:= (Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] /. A -> {{1, I}, {-I, -1}}

Out[13]= {{1, 1}, {1, -1}}

In[14]:= (Sqrt[Conjugate[A]] Sign[A])/Sqrt[A] /. A -> {{1, I}, {-I, -1}}

Out[14]= {{1, 1}, {1, -1}}

in which case returning a scalar would be incorrect.

  • $\begingroup$ I see, that is a very good point! Thank you for pointing this out. $\endgroup$ – Kagaratsch Jun 29 '18 at 21:21
  • $\begingroup$ However, unfortunately, even the following does not simplify properly: FullSimplify[(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]], Assumptions -> Element[A, Complexes]]. But was worth a shot. $\endgroup$ – Kagaratsch Jun 29 '18 at 21:28
  • $\begingroup$ Try it with Conjugate[Sqrt[A]] instead of Sqrt[Conjugate[A]]. $\endgroup$ – Brett Champion Jun 29 '18 at 21:43
  • $\begingroup$ Ahha, then it works! Interesting curiosity. $\endgroup$ – Kagaratsch Jun 29 '18 at 21:45

A bit long for a comment. Consider:

a = Sqrt[A] /. A -> -1
(* I *)

Correct. Sqrt[-1] is I by definition.

b = Sqrt[Conjugate[A]] /. A -> -1
(* I *)

Correct. Conjugate[-1] is -1, and Sqrt[-1] is I by definition.

c = Sqrt[A Conjugate[A]] /. A -> -1
(* 1 *)

Correct. Sqrt[1] is unambiguously 1.

(a b)/c
(* -1 *)


(Sqrt[A] Sqrt[Conjugate[A]])/Sqrt[A Conjugate[A]] /. A -> -1
(* -1 *)

Now, you consider this wrong, but it's the same as (a b)/c. Mathematica is thus consistent, which is a crucial thing to a computer algebra system. To get the answer you want, Mathematica would have to use a different branch cut for different instances of Sqrt in your expression. How is it supposed to know that this is what you intend?

  • $\begingroup$ My point is that for any complex number $z$ the inner product satisfies $z\bar z\geq 0$. Since $\sqrt{\bar z}=\bar{\sqrt{z}}$, the inner product $\sqrt{z}\sqrt{\bar z}\geq 0$ has to hold. $\sqrt{-1}=i$ only if $-1=e^{i\pi}$, but $\sqrt{-1}=-i$ if you write $-1=e^{-i\pi}$. When extending the field of numbers to be complex, -1 and OverBar[-1] should not be identical. $\endgroup$ – Kagaratsch Jun 30 '18 at 0:24
  • $\begingroup$ That's not the usual mathematical convention, so you can hardly expect Mathematica to use it. $\endgroup$ – John Doty Jun 30 '18 at 23:46
  • $\begingroup$ Yes, sadly it seems to be that way. $\endgroup$ – Kagaratsch Jul 1 '18 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.