Say we have that
$z^2 - x^2 = 0 \ ( \ mod \ p)$
$p \ | \ (z-x)(z+x)$
However I was not 100% sure how that implies about the divisibility of p towards $(z-x)$ and/or $(z+x)$ and whether it depends if p is prime or not. The notes I was reading says that "because p is prime, then it divides $(z-x)$ or $(z+x)$". However, say that we have two numbers $n_1$ and $n_2$ and:
$$n_1n_2 = 0 \ ( \ mod \ p)$$
$$p \ | \ n_1n_2$$
I thought that always implied, regardless of whether p is prime or not, that p either divided $n_1$ or $n_2$. Or am I wrong? Why does p have to be prime? I was suspecting that maybe it had something to do with having multiplicative inverses and $gcd(x,p) = 1$ only being true if p was prime, what I was not sure honestly.
Also, if n is composite, then what do we know if $n \ | \ n_1n_2$? Also, if n is composite, and we know $n \ | \ n_1n_2$, then, does it necessarily mean it must divide either $n_1$ or $n_2$?
I guess I am trying to understand the fundamental reason why p has to be prime for it to divide at least one of them (i.e. what makes p prime special).
Just for reference, this question came from solving the simple quadratic equation I wrote at the top and quadratic residues.