If , then we know .
What if . is an imaginary number. How did it become -4.
My maths teacher also did like this for one question.
It's something like (An expression)X(Another expression)=0.
He made the solution only if first expression=0. He did not make the solution if another equation is 0.
A variable can only take one value at a time. If , the whole product becomes zero. That means it is a solution. The second equation cannot be solved over the reals, so the equation only has one real solution.
The solution is satisfied if either factor is 0, so in this case either
$x=-4$ OR $x=\dfrac 1 2 \left(5 \pm \imath \sqrt 7\right)$
your professor probably ignored the other factor when he/she did what they did because they were only interested in real solutions. I don't know, I wasn't there.