Prove: swapping 2 adjacent numbers will change the parity of the permutation

209 Views Asked by At

Prove: swapping 2 adjacent numbers will change the parity of the permutation


proof:


Suppose the permutation of n numbers is as following,with arbitrary adjacent two numbers are $p_i$ and $p_{i+1}$

$\text{P1}=p_1,p_2,\text{...},p_i,p_{i+1},\text{...},p_n$

the permutation after swapping $p_i$ and $p_{i+1}$.

$\text{P2}=p_1,p_2,\text{...},p_{i+1},p_i,\text{...},p_n$

in P1


t1、t2 represents the inverse number,

If[condition,1,0]means condition true then 1,condition false then 0

$$\begin{align*}\text{t1}=\sum _{k=1}^n \text{t1}_k=\sum _{k=1}^{i-1} \text{t1}_k+\text{t1}_i+\text{t1}_{i+1}+\sum _{k=i+2}^n \text{t1}_k~~~(1)\end{align*}$$

$$\begin{align*}\text{t1}_i=\sum _{k=1}^i \text{If}\left[\text{P1}_k>\text{P1}_i,1,0\right]~~~(2)\end{align*}$$

$$\begin{align*}\text{t1}_{i+1}=\sum _{k=1}^{i+1} \text{If}\left[\text{P1}_k>\text{P1}_{i+1},1,0\right]~~~(3)\end{align*}$$

in P2


$$\begin{align*}\text{t2}=\sum _{k=1}^n \text{t2}_k=\sum _{k=1}^{i-1} \text{t2}_k+\text{t2}_i+\text{t2}_{i+1}+\sum _{k=i+2}^n \text{t2}_k~~~(4)\end{align*}$$

$$\begin{align*}\text{t2}_i=\sum _{k=1}^i \text{If}\left[\text{P2}_k>\text{P2}_i,1,0\right]=\text{t1}_{i+1}+\text{If}\left[P_{i+1}>P_i,0,1\right]~~~(5)\end{align*}$$

$$\begin{align*}\text{t2}_{i+1}=\sum _{k=1}^{i+1} \text{If}\left[\text{P2}_k>\text{P2}_{i+1},1,0\right]=\\&\text{t1}_i+\text{If}\left[P_{i+1}>P_i,1,0\right]\text{(*}\text{or}\sim\text{If}\left[\text{P2}_{i+1}>\text{P2}_i,1,0\right]\text{*)}~~~(6)\end{align*}$$

t2-t1


$$\begin{align*}\text{t2}-\text{t1}=\text{t2}_i+\text{t2}_{i+1}-\left(\text{t1}_i+\text{t1}_{i+1}\right)=\text{t1}_{i+1}+\text{If}\left[P_{i+1}>P_i,0,1\right]+\text{t1}_i+\text{If}\left[P_{i+1}>P_i,1,0\right]-\text{t1}_i-\text{t1}_{i+1}=1~~~(7)\end{align*}$$

so we get the result.

Anything wrong?