How does Legendre symbol formula $(-1)^{{p-1\over 2}{q-1\over 2}}$, actually show the correct value?

I've read about this formula on wikipedia, but attempting to use it just gets me:

$$q\equiv 3 \bmod 4\implies p\equiv 1 \mod 4$$ and$$q\equiv 1 \bmod 4\implies p\equiv 1,3 \mod 4.$$ However, $$1,4,9,3,12,10\equiv x^2\bmod 13 19$$ disproves this. I also don't see how derive $$\pm2$$ implying $$1$$ or $$7 \mod 8.$$

What am I missing,how does Legendre symbol formula $$(-1)^{{p-1\over 2}{q-1\over 2}}$$, actually show the correct value ?

I do partially understand Euler's criterion.

• The expression in the title equals $\left(\dfrac p q\right)\left(\dfrac q p \right)$. For $3$ and $1319$, $3$ is a quadratic residue modulo $1319$, but $1319\equiv2$ is not a quadratic residue modulo $3$, and the product is $-1$ – J. W. Tanner May 21 at 23:51
• Wikipedia often explains things horribly; and often times incorrectly. I don't know if you're looking for a proof of the Quadratic Reciprocity theorem (there are probably a hundred of more proofs today beginning with Gauss' first one.) But I would like to pass along that perhaps a good elementary number theory book like David Burton's, who incidentally, has a very nice History of Mathematics book in print, explains things, I think, quite well if one is willing to put the time in and go step by step. Just a suggestion. – samuelbowditch Jul 14 at 2:27

According to the law of quadratic reciprocity, $$\left(\dfrac pq\right)\left(\dfrac qp\right)=(-1)^{\dfrac{p-1}2\dfrac{q-1}2},$$ where $$\left(\dfrac pq\right)=1$$ if $$n^2\equiv p \pmod q$$ for some $$n$$ and $$-1$$ otherwise.
For example, $$1319\equiv3\pmod4$$. $$3$$ is a quadratic residue modulo $$1319$$,
but $$1319\equiv2\pmod3$$ is not a quadratic residue modulo $$3$$.
In this case the quadratic reciprocity law equality is $$-1=-1$$.