If $abc\equiv x\pmod{p}$ and $x\not\equiv 0\pmod{p}$ what are the number of solutions for given $x$ and $p$ [duplicate]

Possible Duplicate:
Solutions of $\prod_{i=1}^n x_i = c$ mod p

I guess it should be $3(p-2)+1$ modulo $n$ as there are $3$ possibilities for abc to be congruent to $2,\cdots ,p-1$ each and one solution for abc to be congruent to $1$.

-

marked as duplicate by Arturo Magidin, Chris Eagle, sdcvvc, William, wentaway Sep 7 '12 at 12:44

What is $n$? Is $p$ prime? – Mark Bennet Jul 17 '11 at 22:16
@Mark @Dylan Sorry for the typo. $n$ is $p$ and p is prime – kuch nahi Jul 17 '11 at 22:17
Good stuff. Are you counting rearrangements, or not? If you are, then I think this is $(p - 1)^2$. – Dylan Moreland Jul 17 '11 at 22:24
$p-1$ ways of picking $a$ (anything but zero modulo $p$); $p-1$ ways of picking $b$. This forces $c$. Total: $(p-1)^2$. If you want distinct sets (e.g., if $a=b=1$, $c=x$ is "the same" as $a=c=1$, $b=x$), then it gets more complicated. But your explanation above makes no sense to me at all. Why "3 possibilities for abc to be congruent to 2,...,p-1", and "one" for "1"? – Arturo Magidin Jul 17 '11 at 22:30
@Aruto this question has a history of duplication, and is in fact based on your answer to the question you linked. See the question: math.stackexchange.com/questions/52036/… for an explanation of why I did that – kuch nahi Jul 17 '11 at 22:32

There are $p-1$ choices for $a$ and $p-1$ choices for $b$ since $a,b$ can be congruent to any nonzero numbers mod $p$. Once $a,b$ are chosen, we must have $c = x(ab)^{-1}$ mod $p$, so there is only one choice for $c$. Overall, there are $(p-1)(p-1)\cdot1 = (p-1)^2$ triples $(a,b,c)$ satisfying the given equation.
Your reasoning in your answer to Re: "can you give me a complete answer not just hint? " is not correct. For example, you claim that if $\prod x_i = 1$ mod $p$, then each $x_i$ must be congruent to $1$ mod $p$. But this is not true, e.g. $x_1x_2 = 1$ mod $3$ has two solutions, namely $(1,1)$ and $(2,2)$. So we could have that neither $x_1$ nor $x_2$ is $1$ mod $3$, yet their product is $1$ mod $3$. The other claims that $\prod x_i = 2$ implies that one of the $x$'s is congruent to $2$ mod $p$ and all others are congruent to $1$ mod $p$, and that $\prod x_i = p-1$ implies that one of the $x$'s is congruent to $p-1$ mod $p$ and all others are congruent to $1$ mod $p$ are also wrong. It looks like you treat $x_1,x_2,..,x_n$ as if they were positive integers, but they are not.
Anyway, as many people pointed out, the correct answer to your question is $(p-1)^2$ (unless you meant to ask something different).