# Why am I getting the wrong answer when I factor an $i$ out of the integrand?

Consider the following definite integral: $$I=\int^{0}_{-1}x\sqrt{-x}dx \tag{1}$$

With the substitution $$x=-u$$, I got $$I=-\frac{2}{5}$$ (which seems correct).

But I then tried a different method by first taking out $$\sqrt{-1}=i$$ from the integrand: $$I=i\int^{0}_{-1}x\sqrt{x}dx=\frac{2i}{5}[x^{\frac{5}{2}}]^{0}_{-1}=\frac{2i}{5}{(0-(\sqrt{-1})^5})=-\frac{2i^6}{5}=+\frac{2}{5} \tag{2}$$ which is clearly wrong.

I understand that $$x\sqrt{x}$$ is not even defined within $$(-1,0)$$, but why can't we use the same 'imaginary approach' ($$\sqrt{-1}=i$$) to treat this undefined part of the function (i.e. the third equality in $$(2)$$).

I can't find a better way of phrasing my question so it may seem gibberish, but why is $$(2)$$ just invalid?

• I think it's terrible when the imaginary unit $i$ is introduced as "$\sqrt{-1}=i$", because it leads precisely to misconceptions and miscalculations like this one. I much prefer the definition that says that the imaginary unit $i$ is a number such that $i^2=-1$. But then there are in fact two such complex numbers, the other one being $-i$. And since there's no reasonable way to define a single-valued square root function in complex numbers, as @WA Don beautifully explained, $\sqrt{-1}=\pm i$, rather than just $i$. – zipirovich May 24 at 18:14
• Note that the substitution $x=-t$ makes the problem go away. – StephenG May 24 at 21:01
• What does x range over? What is denoted by √ ? What is the implicit + in the definition you are using for the integral sign? The expression doesn't mean anything until you say. If you say these are real-valued functions [sic--are you sure you don't mean relations?] of reals, why are you wondering whether imaginaries are allowed? That contradicts what you just said. – philipxy May 25 at 1:49
• @zipirovich I am with you until the last sentence, when you declare that $\sqrt{-1} = \pm i$. Yes, there are two complex numbers which solve the equation $x^2 = -1$. However, once you start using the notation $\sqrt{z}$, you have implicitly selected a branch of the square root function. Thus either $\sqrt{-1} = i$ or $\sqrt{-1} = -i$, but not both at the same time. – Xander Henderson May 25 at 16:00
• @XanderHenderson: I agree, I shouldn't have said that. Thank you for the correction! – zipirovich May 25 at 16:01

I had difficulty understanding the previous answer so am offering an expanded version.

Taking your first step, you write $$\sqrt{-x} = i\sqrt{x}$$. Now try that with $$x=-1$$. It gives a contradiction, $$1 = \sqrt{1} = i \sqrt{-1} = i^2 = -1.$$

It is not really fixed if you use the alternative sign for $$\sqrt{-1}$$ because you obtain $$1 = \sqrt{1} = -i \sqrt{-1} = (-i) \times (-i) = -1$$

Only if you take different signs for the imaginary part at each square root do you get the answer you want.

Underlying this is a general point about complex valued functions. By convention for real $$x \geqslant 0$$, $$\sqrt{x}$$ is always taken to be the positive root. When $$x < 0$$ there is no natural convention and $$\sqrt{x}$$ could be either one of $$\pm i\sqrt{-x}$$. The difficulty arises because there cannot be a consistent choice for the root of a negative number that at the same time satisfies the desirable identity $$\sqrt{xy} = \sqrt{x}\sqrt{y}$$. That is because in complex analysis the square root $$\sqrt{z}$$ has a branch point (that is, it is badly behaved) at $$z=0$$ and it cannot be extended to a well behaved function across the whole complex plane.

• The relationship $\sqrt {wz}=\sqrt{w}\sqrt{z}$ is correct in terms of set equivalence. That is to say, any value of $\sqrt{wz}$ can be expressed as the product of some value of $\sqrt{w}$ and some value of $\sqrt{z}$. And conversely, it means that the product of any value of $\sqrt{w}$ and any value of $\sqrt{z}$ can be expressed by some value of $\sqrt{wz}$. And yes, this means that we might have to choose different branches of the square root. But if one proceeds accordingly, then this is not a problem. – Mark Viola May 26 at 22:06

Fundamentally, your error amounts to the following (mis)calculation:

$$1=\sqrt1=\sqrt{-(-1)}=i\sqrt{-1}=i^2\sqrt1=-\sqrt1=-1$$

It's just that the second minus sign doesn't appear in what you're doing until after the first one was converted to an $$i$$. I.e., you converted $$\sqrt{-x}$$ to $$i\sqrt x$$ before doing the integration, and only later substituted the lower limit $$x=-1$$.

If $$x\in[-1,\,0)$$ then $$\Im\sqrt{x}=\sqrt{-x}$$, so $$\sqrt{-x}=\sqrt{x}/i=-i\sqrt{x}$$.

• Could you elaborate on how $\mathcal{J}\sqrt{x}=\sqrt{-x}$ leads to $\sqrt{-x}=\sqrt{x}/i$ please? (excuse my ignorance but I don't even know what is meant by $\mathcal{J}{\sqrt{x}}$ is it the domain?) – floccinaucinihilipilificator May 24 at 8:58
• @Simons-Chern e.g. $\Im\sqrt{-1/4}=\Im(i/2)=1/2=\sqrt{-1/4}/i$, so $\sqrt{1/4}=1/2=\sqrt{-1/4}/i$. – J.G. May 24 at 9:04
• @Simons-Chern $\Im\sqrt{x}$ (\Im) means the imaginary part of $\sqrt{x}$. – L. F. May 25 at 9:47