<s>[INST] Factorising $x^2-x+1$ I attempted to factorise $x^2-x+1$, which seemed fairly straightforward:
$$ 
\begin{align}
x^2-x+1 &= (x+1)^2-3x \\
        &= (x+1-\sqrt{3x})(x+1+\sqrt{3x}) \\
        &= (x-\sqrt{3x}+1)(x+\sqrt{3x}+1)
\end{align}$$
Technically neither $(x-\sqrt{3x}+1)$ nor $(x+\sqrt{3x}+1)$ are linear functions, which is why I didn't get the "correct" answer:
$$(x-\frac{1}{2}-i\frac{\sqrt{3}}{2})(x-\frac{1}{2}+i\frac{\sqrt{3}}{2})$$
But I am curious as to why Desmos only considers the positive cases of $x$? If $(x-\sqrt{3x}+1)(x+\sqrt{3x}+1)$ does expand perfectly into $x^2-x+1$, why isn't it graphed the same way?
 [/INST] The function $(x+1-\sqrt{3x})(x+1+\sqrt{3x})$ is only defined for $x \ge 0$, therefore it is not the same function as $x^2-x-1$, which is defined on $\forall x \in \mathbb{R}$. Why? Think about how the square root is defined. 
For $x < 0$, you have $|x|=-x$, hence this factorization becomes
$$ x^2 - x + 1 = (x+1)^2 + 3|x| = \left(x+1-i\sqrt{3|x|}\right)\left(x+1+i\sqrt{3|x|}\right) $$
and you no longer have real values.

For the "correct" answer, you need to complete the square
$$ x^2 - x + 1 = \left(x-\frac12\right)^2 + \frac34 = \left(x-\frac12 -
 i\frac{\sqrt3}{2}\right)\left(x+\frac12 + i\frac{\sqrt3}{2}\right) $$
</s>