How could I find $x$ in this equation $x^2-x+6 \equiv 0 \pmod {9}$

Let me address what you did, rather than how to do it correctly, as others have answered with sundry ways of finding the answer correctly.

The very wrong thing you did was go from $$x(x-1)\equiv 3\pmod{9}$$ to $$x\equiv 3 \pmod{9}\quad\text{or}\quad x-1\equiv 3\pmod{9}.$$

That's an error that I often see in basic algebra, and it is compounded here.

In usual algebra, working in the integers, rationals, reals, or complex numbers, we have a very important property:

$$\text{if }ab=0,\text{ then }a=0\text{ or }b=0.$$

So if you were working in the real numbers, from something like $x(x-1)=0$ you would be able to conclude that either $x=0$ or $x-1=0$.

However, this is not true when the product does not equal $0$. For example, from $xy=6$ we cannot conclude that $x=6$ or $y=6$! Yet students who have seen the "trick" for solving quadratics by factoring try to extend this argument to that situation. For example, they know that they can solve $x^2-5x+6=0$ by saying:

$$\begin{align*} x^2-5x+6&=0\\ (x-3)(x-2) &= 0 \end{align*}$$ therefore either $x-3=0$ or $x-2=0$, so $x=3$ or $x=2$.

This is correct. It's correct because the only way a product in $\mathbb{R}$ can equal $0$ is if at least one factor is equal to $0$.

But then students think they can do something like the following:

$$\begin{align*} x^2-5x-6 &=0\\ x^2-5x &= 6\\ x(x-5)&=6 \end{align*}$$ and therefore $x=6$ or $x-5=6$; so $x=6$ or $x=11$.

That's wrong. You can't do that because whereas the only way to get $0$ when you multiply two reals is if one of them is $0$; getting a $6$ as the result of a product does not mean that one of the factors has to be $6$.

Now, your argument would have been wrong in the reals; the further problem here is that it would have been wrong modulo $9$ even if you had obtained the congruence $x(x-1)\equiv 0\pmod{9}$. The reason is that when you are working modulo $9$, it is possible for a product to be $0$, yet neither factor to be $0$: indeed, $(3)(3)\equiv 0\pmod{9}$, for example. So when you are working modulo $9$, you can't even use this type of argument when the product equals $0$, let alone when it doesn't equal $0$.

So you are taking an incorrect argument from another setting, already a problem, and compounding that problem by trying to use it in a setting where even the correct argument would not have worked.


Complete the square, noting $4^{-1}\equiv7$ and $2^{-1}\equiv5\pmod9$:

$x^2-x+4^{-1}\equiv x^2-x+7\equiv1\pmod9$ $\iff$

$(x-2^{-1})^2\equiv1\pmod9$ $\iff$

$x\equiv2^{-1}\pm1\equiv4 $ or $6\pmod9$,

because $9|y^2-1=(y+1)(y-1)$ means $9|y+1$ or $9|y-1$,

since $3|y+1$ and $3|y-1$ means $3|(y+1)-(y-1)=2,$

which is clearly not so.