Counting the number of inversions for the function $f(x+yp)=qx+y$The generating function for permutations indexed by number of inversionsEfficient calculation of minimal expected number of inversionsFinding The Number Of Inversions In A PermutationCounting the number of permutations of $(1,ldots,i,ldots,j,ldots,m)$, where $i < j$ and number of inversions is $k$.Characterizing The Number of Inversions in A PermutationCorrespondence between the sum of inversions and the number of transpositionsAverage number of inversions in an involutionnumber of permutations with k inversions modulo 3Find number of permutations with 2 inversionsNumber of $n$-permutations with $r$ inversions modulo $k$
Could the E-bike drivetrain wear down till needing replacement after 400 km?
Do Legal Documents Require Signing In Standard Pen Colors?
How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?
Find last 3 digits of this monster number
On a tidally locked planet, would time be quantized?
Can I sign legal documents with a smiley face?
What linear sensor for a keyboard?
Why is Arduino resetting while driving motors?
How do I extrude a face to a single vertex
Engineer refusing to file/disclose patents
Do the concepts of IP address and network interface not belong to the same layer?
Is possible to search in vim history?
Why has "pence" been used in this sentence, not "pences"?
Can I rely on this github repository files?
A social experiment. What is the worst that can happen?
Customize circled numbers
How can "mimic phobia" be cured or prevented?
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
What is this type of notehead called?
Can somebody explain Brexit in a few child-proof sentences?
Java - What do constructor type arguments mean when placed *before* the type?
Query about absorption line spectra
Melting point of aspirin, contradicting sources
Is there a conventional notation or name for the slip angle?
Counting the number of inversions for the function $f(x+yp)=qx+y$
The generating function for permutations indexed by number of inversionsEfficient calculation of minimal expected number of inversionsFinding The Number Of Inversions In A PermutationCounting the number of permutations of $(1,ldots,i,ldots,j,ldots,m)$, where $i < j$ and number of inversions is $k$.Characterizing The Number of Inversions in A PermutationCorrespondence between the sum of inversions and the number of transpositionsAverage number of inversions in an involutionnumber of permutations with k inversions modulo 3Find number of permutations with 2 inversionsNumber of $n$-permutations with $r$ inversions modulo $k$
$begingroup$
Let $p,q$, $(pneq q)$ be odd primes. Define the function $f:0,1,ldots,pq-1to 0,1,ldots,pq-1$ by $f(x+yp)=qx+y$, where $xin 0,1,ldots,p-1$ and $yin0,1,ldots,q-1$. How does one calculate the number of inversions for $f$?
A complete solution would be quite helpful.
abstract-algebra combinatorics
$endgroup$
add a comment |
$begingroup$
Let $p,q$, $(pneq q)$ be odd primes. Define the function $f:0,1,ldots,pq-1to 0,1,ldots,pq-1$ by $f(x+yp)=qx+y$, where $xin 0,1,ldots,p-1$ and $yin0,1,ldots,q-1$. How does one calculate the number of inversions for $f$?
A complete solution would be quite helpful.
abstract-algebra combinatorics
$endgroup$
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
1
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago
add a comment |
$begingroup$
Let $p,q$, $(pneq q)$ be odd primes. Define the function $f:0,1,ldots,pq-1to 0,1,ldots,pq-1$ by $f(x+yp)=qx+y$, where $xin 0,1,ldots,p-1$ and $yin0,1,ldots,q-1$. How does one calculate the number of inversions for $f$?
A complete solution would be quite helpful.
abstract-algebra combinatorics
$endgroup$
Let $p,q$, $(pneq q)$ be odd primes. Define the function $f:0,1,ldots,pq-1to 0,1,ldots,pq-1$ by $f(x+yp)=qx+y$, where $xin 0,1,ldots,p-1$ and $yin0,1,ldots,q-1$. How does one calculate the number of inversions for $f$?
A complete solution would be quite helpful.
abstract-algebra combinatorics
abstract-algebra combinatorics
edited 2 days ago
crskhr
asked Mar 16 at 11:27
crskhrcrskhr
3,890926
3,890926
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
1
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago
add a comment |
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
1
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
1
1
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
We will consider the case $p=3, q=5$ which is easy to draw. Hopefully you agree the ideas generalize. Consider these matrices:
$$
A = beginbmatrix
0 & 1 & 2 & 3 & 4 \
5 & 6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & 6 & 9 & 12 \
1 & 4 & 7 & 10 & 13 \
2 & 5 & 8 & 11 & 14
endbmatrix
$$
Let the rows be numbered $x = 0, 1, 2$ from top to bottom and the columns be numbered $y = 0, 1, 2, 3, 4$ from left to right. Then $A_xy = qx+y$ and $B_xy = x+py$.
So here's a recipe for evaluating $f(i)$ where $i in mathbbZ_pq$:
First, find location $(x,y)$ where $B_xy= i$
Then, look up the same location in matrix $A$ and we have $f(i) = A_xy$.
If I may abuse notation a bit, the chain of mapping that just happened was something like this:
$$i = x+py = B_xy rightarrow (x,y) rightarrow A_xy = qx+y = f(i) = f(x+py)$$
which has an overall effect of $x + py rightarrow qx+y$ as desired.
OK, so how does this help? Consider $(i,j) in mathbbZ_pq^2$. It is an inversion if $i < j$ and $f(i) > f(j)$. Let their locations be $(x_i, y_i), (x_j, y_j)$, i.e. $i = x_i + p y_i = B_x_i y_i$ and $f(i) = q x_i + y_i = A_x_i y_i$, and similarly for $j$.
From matrix $B$, it is obvious that $i = B_x_i y_i < j = B_x_j y_j$ iff $y_j > y_i$ ($j$'s column is to the right of $i$'s column), or, $y_j = y_i$ and $x_j > x_i$ ($j$ is in the same column and below $i$).
From matrix $A$, similarly, $f(i) = A_x_i y_i > f(j) = A_x_j y_j$ iff $x_j < x_i$ ($j$'s row is above $i$'s row), or, $x_j = x_i$ and $y_j < y_i$ ($j$ is in same row and to the left of $i$).
Since we need both conditions above to be true, this means $(i,j)$ is an inversion iff $y_j > y_i$ and $x_j < x_i$, i.e. $(x_j, y_j)$ must be strictly to the right and above $(x_i, y_i)$.
E.g. in the following colored matrices, the blue cell represents $i=4, f(i) = f(1 + 1 cdot 3) = 5 cdot 1 + 1 = 6$. The red area in the $B$ matrix represents $j> i$ and the red area in the $A$ matrix represents $f(j) < f(i)$. Clearly the only overlap (for this choice of $i$) are the $3$ cells corresponding to $x=0, y=2,3,4$. These are the values of $j$ which form inversions with this choice of $i$.
$$
A = beginbmatrix
colorred0 & colorred1 & colorred2 & colorred3 & colorred4 \
colorred5 & colorblue6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & colorred6 & colorred9 & colorred12 \
1 & colorblue4 & colorred7 & colorred10 & colorred13 \
2 & colorred5 & colorred8 & colorred11 & colorred14
endbmatrix
$$
E.g. $j=6 > i=4$ and $f(j) = f(0 + 2cdot 3) = 5cdot 0 + 2 = 2 < f(i) = 6$.
So each $(i,j)$ pair that is an inversion is a pair of cells which form the top-right and bottom-left corners of a rectangle, where the rectangle has $c>1$ columns and $r>1$ rows. To count such rectangles, simply pick any $2$ distinct columns, and any $2$ distinct rows. So the final answer, i.e. the total number of inversion pairs, is $p choose 2q choose 2$.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3150298%2fcounting-the-number-of-inversions-for-the-function-fxyp-qxy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
We will consider the case $p=3, q=5$ which is easy to draw. Hopefully you agree the ideas generalize. Consider these matrices:
$$
A = beginbmatrix
0 & 1 & 2 & 3 & 4 \
5 & 6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & 6 & 9 & 12 \
1 & 4 & 7 & 10 & 13 \
2 & 5 & 8 & 11 & 14
endbmatrix
$$
Let the rows be numbered $x = 0, 1, 2$ from top to bottom and the columns be numbered $y = 0, 1, 2, 3, 4$ from left to right. Then $A_xy = qx+y$ and $B_xy = x+py$.
So here's a recipe for evaluating $f(i)$ where $i in mathbbZ_pq$:
First, find location $(x,y)$ where $B_xy= i$
Then, look up the same location in matrix $A$ and we have $f(i) = A_xy$.
If I may abuse notation a bit, the chain of mapping that just happened was something like this:
$$i = x+py = B_xy rightarrow (x,y) rightarrow A_xy = qx+y = f(i) = f(x+py)$$
which has an overall effect of $x + py rightarrow qx+y$ as desired.
OK, so how does this help? Consider $(i,j) in mathbbZ_pq^2$. It is an inversion if $i < j$ and $f(i) > f(j)$. Let their locations be $(x_i, y_i), (x_j, y_j)$, i.e. $i = x_i + p y_i = B_x_i y_i$ and $f(i) = q x_i + y_i = A_x_i y_i$, and similarly for $j$.
From matrix $B$, it is obvious that $i = B_x_i y_i < j = B_x_j y_j$ iff $y_j > y_i$ ($j$'s column is to the right of $i$'s column), or, $y_j = y_i$ and $x_j > x_i$ ($j$ is in the same column and below $i$).
From matrix $A$, similarly, $f(i) = A_x_i y_i > f(j) = A_x_j y_j$ iff $x_j < x_i$ ($j$'s row is above $i$'s row), or, $x_j = x_i$ and $y_j < y_i$ ($j$ is in same row and to the left of $i$).
Since we need both conditions above to be true, this means $(i,j)$ is an inversion iff $y_j > y_i$ and $x_j < x_i$, i.e. $(x_j, y_j)$ must be strictly to the right and above $(x_i, y_i)$.
E.g. in the following colored matrices, the blue cell represents $i=4, f(i) = f(1 + 1 cdot 3) = 5 cdot 1 + 1 = 6$. The red area in the $B$ matrix represents $j> i$ and the red area in the $A$ matrix represents $f(j) < f(i)$. Clearly the only overlap (for this choice of $i$) are the $3$ cells corresponding to $x=0, y=2,3,4$. These are the values of $j$ which form inversions with this choice of $i$.
$$
A = beginbmatrix
colorred0 & colorred1 & colorred2 & colorred3 & colorred4 \
colorred5 & colorblue6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & colorred6 & colorred9 & colorred12 \
1 & colorblue4 & colorred7 & colorred10 & colorred13 \
2 & colorred5 & colorred8 & colorred11 & colorred14
endbmatrix
$$
E.g. $j=6 > i=4$ and $f(j) = f(0 + 2cdot 3) = 5cdot 0 + 2 = 2 < f(i) = 6$.
So each $(i,j)$ pair that is an inversion is a pair of cells which form the top-right and bottom-left corners of a rectangle, where the rectangle has $c>1$ columns and $r>1$ rows. To count such rectangles, simply pick any $2$ distinct columns, and any $2$ distinct rows. So the final answer, i.e. the total number of inversion pairs, is $p choose 2q choose 2$.
$endgroup$
add a comment |
$begingroup$
We will consider the case $p=3, q=5$ which is easy to draw. Hopefully you agree the ideas generalize. Consider these matrices:
$$
A = beginbmatrix
0 & 1 & 2 & 3 & 4 \
5 & 6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & 6 & 9 & 12 \
1 & 4 & 7 & 10 & 13 \
2 & 5 & 8 & 11 & 14
endbmatrix
$$
Let the rows be numbered $x = 0, 1, 2$ from top to bottom and the columns be numbered $y = 0, 1, 2, 3, 4$ from left to right. Then $A_xy = qx+y$ and $B_xy = x+py$.
So here's a recipe for evaluating $f(i)$ where $i in mathbbZ_pq$:
First, find location $(x,y)$ where $B_xy= i$
Then, look up the same location in matrix $A$ and we have $f(i) = A_xy$.
If I may abuse notation a bit, the chain of mapping that just happened was something like this:
$$i = x+py = B_xy rightarrow (x,y) rightarrow A_xy = qx+y = f(i) = f(x+py)$$
which has an overall effect of $x + py rightarrow qx+y$ as desired.
OK, so how does this help? Consider $(i,j) in mathbbZ_pq^2$. It is an inversion if $i < j$ and $f(i) > f(j)$. Let their locations be $(x_i, y_i), (x_j, y_j)$, i.e. $i = x_i + p y_i = B_x_i y_i$ and $f(i) = q x_i + y_i = A_x_i y_i$, and similarly for $j$.
From matrix $B$, it is obvious that $i = B_x_i y_i < j = B_x_j y_j$ iff $y_j > y_i$ ($j$'s column is to the right of $i$'s column), or, $y_j = y_i$ and $x_j > x_i$ ($j$ is in the same column and below $i$).
From matrix $A$, similarly, $f(i) = A_x_i y_i > f(j) = A_x_j y_j$ iff $x_j < x_i$ ($j$'s row is above $i$'s row), or, $x_j = x_i$ and $y_j < y_i$ ($j$ is in same row and to the left of $i$).
Since we need both conditions above to be true, this means $(i,j)$ is an inversion iff $y_j > y_i$ and $x_j < x_i$, i.e. $(x_j, y_j)$ must be strictly to the right and above $(x_i, y_i)$.
E.g. in the following colored matrices, the blue cell represents $i=4, f(i) = f(1 + 1 cdot 3) = 5 cdot 1 + 1 = 6$. The red area in the $B$ matrix represents $j> i$ and the red area in the $A$ matrix represents $f(j) < f(i)$. Clearly the only overlap (for this choice of $i$) are the $3$ cells corresponding to $x=0, y=2,3,4$. These are the values of $j$ which form inversions with this choice of $i$.
$$
A = beginbmatrix
colorred0 & colorred1 & colorred2 & colorred3 & colorred4 \
colorred5 & colorblue6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & colorred6 & colorred9 & colorred12 \
1 & colorblue4 & colorred7 & colorred10 & colorred13 \
2 & colorred5 & colorred8 & colorred11 & colorred14
endbmatrix
$$
E.g. $j=6 > i=4$ and $f(j) = f(0 + 2cdot 3) = 5cdot 0 + 2 = 2 < f(i) = 6$.
So each $(i,j)$ pair that is an inversion is a pair of cells which form the top-right and bottom-left corners of a rectangle, where the rectangle has $c>1$ columns and $r>1$ rows. To count such rectangles, simply pick any $2$ distinct columns, and any $2$ distinct rows. So the final answer, i.e. the total number of inversion pairs, is $p choose 2q choose 2$.
$endgroup$
add a comment |
$begingroup$
We will consider the case $p=3, q=5$ which is easy to draw. Hopefully you agree the ideas generalize. Consider these matrices:
$$
A = beginbmatrix
0 & 1 & 2 & 3 & 4 \
5 & 6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & 6 & 9 & 12 \
1 & 4 & 7 & 10 & 13 \
2 & 5 & 8 & 11 & 14
endbmatrix
$$
Let the rows be numbered $x = 0, 1, 2$ from top to bottom and the columns be numbered $y = 0, 1, 2, 3, 4$ from left to right. Then $A_xy = qx+y$ and $B_xy = x+py$.
So here's a recipe for evaluating $f(i)$ where $i in mathbbZ_pq$:
First, find location $(x,y)$ where $B_xy= i$
Then, look up the same location in matrix $A$ and we have $f(i) = A_xy$.
If I may abuse notation a bit, the chain of mapping that just happened was something like this:
$$i = x+py = B_xy rightarrow (x,y) rightarrow A_xy = qx+y = f(i) = f(x+py)$$
which has an overall effect of $x + py rightarrow qx+y$ as desired.
OK, so how does this help? Consider $(i,j) in mathbbZ_pq^2$. It is an inversion if $i < j$ and $f(i) > f(j)$. Let their locations be $(x_i, y_i), (x_j, y_j)$, i.e. $i = x_i + p y_i = B_x_i y_i$ and $f(i) = q x_i + y_i = A_x_i y_i$, and similarly for $j$.
From matrix $B$, it is obvious that $i = B_x_i y_i < j = B_x_j y_j$ iff $y_j > y_i$ ($j$'s column is to the right of $i$'s column), or, $y_j = y_i$ and $x_j > x_i$ ($j$ is in the same column and below $i$).
From matrix $A$, similarly, $f(i) = A_x_i y_i > f(j) = A_x_j y_j$ iff $x_j < x_i$ ($j$'s row is above $i$'s row), or, $x_j = x_i$ and $y_j < y_i$ ($j$ is in same row and to the left of $i$).
Since we need both conditions above to be true, this means $(i,j)$ is an inversion iff $y_j > y_i$ and $x_j < x_i$, i.e. $(x_j, y_j)$ must be strictly to the right and above $(x_i, y_i)$.
E.g. in the following colored matrices, the blue cell represents $i=4, f(i) = f(1 + 1 cdot 3) = 5 cdot 1 + 1 = 6$. The red area in the $B$ matrix represents $j> i$ and the red area in the $A$ matrix represents $f(j) < f(i)$. Clearly the only overlap (for this choice of $i$) are the $3$ cells corresponding to $x=0, y=2,3,4$. These are the values of $j$ which form inversions with this choice of $i$.
$$
A = beginbmatrix
colorred0 & colorred1 & colorred2 & colorred3 & colorred4 \
colorred5 & colorblue6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & colorred6 & colorred9 & colorred12 \
1 & colorblue4 & colorred7 & colorred10 & colorred13 \
2 & colorred5 & colorred8 & colorred11 & colorred14
endbmatrix
$$
E.g. $j=6 > i=4$ and $f(j) = f(0 + 2cdot 3) = 5cdot 0 + 2 = 2 < f(i) = 6$.
So each $(i,j)$ pair that is an inversion is a pair of cells which form the top-right and bottom-left corners of a rectangle, where the rectangle has $c>1$ columns and $r>1$ rows. To count such rectangles, simply pick any $2$ distinct columns, and any $2$ distinct rows. So the final answer, i.e. the total number of inversion pairs, is $p choose 2q choose 2$.
$endgroup$
We will consider the case $p=3, q=5$ which is easy to draw. Hopefully you agree the ideas generalize. Consider these matrices:
$$
A = beginbmatrix
0 & 1 & 2 & 3 & 4 \
5 & 6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & 6 & 9 & 12 \
1 & 4 & 7 & 10 & 13 \
2 & 5 & 8 & 11 & 14
endbmatrix
$$
Let the rows be numbered $x = 0, 1, 2$ from top to bottom and the columns be numbered $y = 0, 1, 2, 3, 4$ from left to right. Then $A_xy = qx+y$ and $B_xy = x+py$.
So here's a recipe for evaluating $f(i)$ where $i in mathbbZ_pq$:
First, find location $(x,y)$ where $B_xy= i$
Then, look up the same location in matrix $A$ and we have $f(i) = A_xy$.
If I may abuse notation a bit, the chain of mapping that just happened was something like this:
$$i = x+py = B_xy rightarrow (x,y) rightarrow A_xy = qx+y = f(i) = f(x+py)$$
which has an overall effect of $x + py rightarrow qx+y$ as desired.
OK, so how does this help? Consider $(i,j) in mathbbZ_pq^2$. It is an inversion if $i < j$ and $f(i) > f(j)$. Let their locations be $(x_i, y_i), (x_j, y_j)$, i.e. $i = x_i + p y_i = B_x_i y_i$ and $f(i) = q x_i + y_i = A_x_i y_i$, and similarly for $j$.
From matrix $B$, it is obvious that $i = B_x_i y_i < j = B_x_j y_j$ iff $y_j > y_i$ ($j$'s column is to the right of $i$'s column), or, $y_j = y_i$ and $x_j > x_i$ ($j$ is in the same column and below $i$).
From matrix $A$, similarly, $f(i) = A_x_i y_i > f(j) = A_x_j y_j$ iff $x_j < x_i$ ($j$'s row is above $i$'s row), or, $x_j = x_i$ and $y_j < y_i$ ($j$ is in same row and to the left of $i$).
Since we need both conditions above to be true, this means $(i,j)$ is an inversion iff $y_j > y_i$ and $x_j < x_i$, i.e. $(x_j, y_j)$ must be strictly to the right and above $(x_i, y_i)$.
E.g. in the following colored matrices, the blue cell represents $i=4, f(i) = f(1 + 1 cdot 3) = 5 cdot 1 + 1 = 6$. The red area in the $B$ matrix represents $j> i$ and the red area in the $A$ matrix represents $f(j) < f(i)$. Clearly the only overlap (for this choice of $i$) are the $3$ cells corresponding to $x=0, y=2,3,4$. These are the values of $j$ which form inversions with this choice of $i$.
$$
A = beginbmatrix
colorred0 & colorred1 & colorred2 & colorred3 & colorred4 \
colorred5 & colorblue6 & 7 & 8 & 9 \
10 & 11 & 12 & 13 & 14
endbmatrix,
B = beginbmatrix
0 & 3 & colorred6 & colorred9 & colorred12 \
1 & colorblue4 & colorred7 & colorred10 & colorred13 \
2 & colorred5 & colorred8 & colorred11 & colorred14
endbmatrix
$$
E.g. $j=6 > i=4$ and $f(j) = f(0 + 2cdot 3) = 5cdot 0 + 2 = 2 < f(i) = 6$.
So each $(i,j)$ pair that is an inversion is a pair of cells which form the top-right and bottom-left corners of a rectangle, where the rectangle has $c>1$ columns and $r>1$ rows. To count such rectangles, simply pick any $2$ distinct columns, and any $2$ distinct rows. So the final answer, i.e. the total number of inversion pairs, is $p choose 2q choose 2$.
edited yesterday
answered 2 days ago
antkamantkam
2,322212
2,322212
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3150298%2fcounting-the-number-of-inversions-for-the-function-fxyp-qxy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
"Inversions" are defined for a permutation of an ordered set; you need to define a total order on $mathbbZ_pq$. I assume you really want the function $f : left0,1,ldots,pq-1right to left0,1,ldots,pq-1right$ (not $f : mathbbZ_pq to mathbbZ_pq$) that sends each $x + yp$ to $qx + y$ for $x in left0,1,ldots,p-1right$ and $y in left0,1,ldots,q-1right$.
$endgroup$
– darij grinberg
2 days ago
1
$begingroup$
Note that it does not matter whether or not $p$ and $q$ are prime or distinct. A very similar (most likely equivalent, but I am too tired) problem has been posed as Exercise 3 in UMN Fall 2017 Math 4990 homework set #8 (the link goes to a PDF that sketches a solution and contains a link to another writeup with a solution).
$endgroup$
– darij grinberg
2 days ago
$begingroup$
@darijgrinberg Yes. Appreciate the comments. Thank you :)
$endgroup$
– crskhr
2 days ago