Let $\sigma \in \mathcal{S}_n$ (i.e. the symmetric group of degree $n$). Let $i$ and $j$ be different elements from $\left\{1, 2, \ldots, n-1, n\right\}$. The pair $\left\{i, j \right\}$ is called an inversion of $\sigma$ if $i < j$ but $\sigma(i) > \sigma(j)$.
The sign of $\sigma$ is $+1$ if the number of inversions of $\sigma$ is even, and $-1$ if the number is odd.
Now, my course notes on abstract algebra say we can convert the above definition also into following formula : $$ sgn(\sigma) = \prod_{1 \leq i < j \leq n} \frac{i-j}{\sigma(i) - \sigma(j)}$$
I don't really see how one can verify this. Let's say I have $\sigma = (1 2 3) \in \mathcal{S}_3$ (in cycle notation). This permutation has two inversions, so $sgn(\sigma) = +1$. We have $\sigma(1) = 2, \sigma(2) = 3$ and $\sigma(3) = 1. $ Now I wanted to use the formula to check it:
$$sgn(\sigma) = \prod_{1 \leq i < j \leq 3} \frac{i-j}{\sigma(i) - \sigma(j)} = \big( \frac{1 -2}{2-3} \big) \big( \frac{2-3}{3-1}\big) = - \frac{1}{2} \neq + 1 ? $$ Did I do something wrong here? I let $i$ take on the values $1, 2$ and $j$ the values $2$ and $3$ right?
Clarification is appreciated.