Find $n\geq 2 $ such that the equation $x^2-x+\hat2=\hat0$ has an unique solution in $\mathbb Z_n$.
I've tried to solve it this way:
Let $a$ be its only solution. We see that $1-a$ is a solution too, so $a=\hat1-a \Rightarrow \hat2a=\hat1$. Now I did a thing which I'm not sure if that's true, writing $a=\hat2^{-1}$. ($\hat2$ is not invertible in $\mathbb Z_4$ for example)
$\hat2^{-2}-\hat2^{-1}+\hat2=\hat0 \ , \ \hat1-\hat2+\hat2^3=\hat0$ so $n=7.$
Can somebody tell me if this is correct?
Well done.
Here is a simple solution along your lines.
$ \small a^2-a+2 \equiv 0 \implies 4a^2-4a+8 \equiv 0 \implies (2a)^2-2\cdot (2a) +8 \equiv 0 \implies 1-2+8 \equiv 0 \implies 7 \equiv 0$