# Solve an elementary quadratic equation?

GROUPS:
 Valeriu Ungureanu 1 Vote Dear All,May someone explain what is wrong with the functions Solve[] and Reduce[] applications when they solve a very simple quadratic equation: $x^2+x+1=0$This equation has two complex solutions: $\frac{-1 +\sqrt{3} i}{2}$ and $\frac{-1 -\sqrt{3} i}{2}.$Both the functions Solve[] and Reduce[] give other solutions: In[1]:= Solve[x^2 + x + 1 == 0] Out[1]= {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}} In[2]:= Reduce[x^2 + x + 1 == 0] Out[2]= x == -(-1)^(1/3) || x == (-1)^(2/3) The function NSolve[] gives correct solutions: In[3]:= NSolve[x^2 + x + 1 == 0] Out[3]= {{x -> -0.5 - 0.866025 I}, {x -> -0.5 + 0.866025 I}} 
5 months ago
10 Replies
 Frank Kampas 1 Vote The solutions from Solve and Reduce are correct. In[1]:= Solve[x^2 + x + 1 == 0] Out[1]= {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}} In[2]:= N[%] Out[2]= {{x -> -0.5 - 0.866025 I}, {x -> -0.5 + 0.866025 I}} 
5 months ago
 Thank you, Frank! It's somewhat unusual solution presentation!
5 months ago
 Frank Kampas 4 Votes In[1]:= Solve[x^2 + x + 1 == 0] Out[1]= {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}} In[2]:= N[%] Out[2]= {{x -> -0.5 - 0.866025 I}, {x -> -0.5 + 0.866025 I}} In[3]:= ComplexExpand[%%] Out[3]= {{x -> -(1/2) - (I Sqrt[3])/2}, {x -> -(1/2) + (I Sqrt[3])/2}} 
5 months ago
 O Mirza 1 Vote Both Solve[] and Reduce[] give the exact solutions in using rational numbers. NSolve[] gives a numerical approximation to the solution.To see this use the functions N and ComplexExpand. In[1]:= Map[N, {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}}, {2}] In[2]:=Map[ComplexExpand, {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}}, {2}] Out[1]= {{x -> -0.5 - 0.866025 I}, {x -> -0.5 + 0.866025 I}} Out[2]= {{x -> {{x -> -(1/2) - (I Sqrt[3])/2}, {x -> -(1/2) + (I Sqrt[3])/2}} 
5 months ago
 Sam Carrettie 2 Votes You don't really have to map ComplexExpand, this will gave you the same result: ComplexExpand[x/.Solve[x^2 + x + 1 == 0]]  $$\left\{-\frac{1}{2}-\frac{i \sqrt{3}}{2},-\frac{1}{2}+\frac{i \sqrt{3}}{2}\right\}$$ ComplexExpand[Reduce[x^2 + x + 1 == 0]]  $$x=-\frac{1}{2}-\frac{i \sqrt{3}}{2}\lor x=-\frac{1}{2}+\frac{i \sqrt{3}}{2}$$
5 months ago
 Valeriu Ungureanu 1 Vote Wolfram Alpha finds the same solutions:But, I used Step-by-step solution and found solution with the well known formula in the traditional form:After that I used other variant of Step-by-step solution procedure and found the solution in the traditional form, too: So, it's not clear why the result is presented in "non-traditional" form? In[2]:= {{x -> -(-1)^(1/3)}, {x -> (-1)^(2/3)}} // FullForm Out[2]//FullForm= \!$$TagBox[StyleBox[RowBox[{"List", "[", RowBox[{RowBox[{"List", "[", RowBox[{"Rule", "[", RowBox[{"x", ",", RowBox[{"Times", "[", RowBox[{RowBox[{"-", "1"}], ",", RowBox[{"Power", "[", RowBox[{RowBox[{"-", "1"}], ",", RowBox[{"Rational", "[", RowBox[{"1", ",", "3"}], "]"}]}], "]"}]}], "]"}]}], "]"}], "]"}], ",", RowBox[{"List", "[", RowBox[{"Rule", "[", RowBox[{"x", ",", RowBox[{"Power", "[", RowBox[{RowBox[{"-", "1"}], ",", RowBox[{"Rational", "[", RowBox[{"2", ",", "3"}], "]"}]}], "]"}]}], "]"}], "]"}]}], "]"}],ShowSpecialCharacters->False,ShowStringCharacters->True,\NumberMarks->True], FullForm]$$ What is the reason to present solutions in an unusual "rational" form?
5 months ago
 Todd Rowland 3 Votes While I don't know why it is designed like this, here are a few possible reasons:1) The solving algorithms have to be as general as possible (not just quadratic).2) It would be possible to add an extra layer of code checking for cases where there is a more elementary presentation that is also small, but this would slow things down. That could be problematical for someone doing a large calculation. Often the right design decision is to have the calculation do the fastest thing and then let the user decide if he wants a different presentation.3) It is a matter of perspective of what is unusual. I say this because the roots of unity (which includes the roots of -1) is a classical topic in mathematics.
 First two reasons are clear, correct and acceptable! But the last one is somewhat confusing, because cubic root of $-1$ in traditional interpretation is $-1$. So, in such interpretations solutions of this equation are: $1$ and $1$. In my opinion, this is a serious confusion for a lot of people...
 Thank you, Daniel! I found an exhaustive explanation on the $Wolfram MathWorld$ page: The schoolbook definition of the cube root of a negative number is (-x)^(1/3)=-(x^(1/3)). However, extension of the cube root into the complex plane gives a branch cut along the negative real axis for the principal value of the cube root as illustrated above. By convention, "the" (principal) cube root is therefore a complex number with positive imaginary part. As a result, the Wolfram Language and other symbolic algebra languages and programs that return results valid over the entire complex plane therefore return complex results for (-x)^(1/3). For example, in the Wolfram Language, ComplexExpand[(-1)^(1/3)] gives the result 1/2+isqrt(3)/2. When considering a positive real number x, the Wolfram Language function CubeRoot[x], which is equivalent to Surd[x, 3], may be used to return the real cube root.