-1

This is my first post on stack overflow. I am to submit my maths assignment till 30 April and this the question i have been searching for but i couldn't find any answer anywhere.

I know i can lisst out all possible permutaions which is = 4! = 24 But the question is which of them are even and which of them are odd? (1,2,3,4), (1,2,4,3), (1,3,2,4) and so on.... Every permutaion will have 3 no. of transposition that means all of them are odd then what's the point of the question? Am I right?

Ankit Kumar
  • 97
  • 2
  • 9
  • 2
    I believe _odd_ and _even_ are to be understood as described [here](https://en.wikipedia.org/wiki/Parity_of_a_permutation). – Codor Apr 26 '18 at 12:41
  • 3
    I'm voting to close this question as off-topic because it is not about programming. – High Performance Mark Apr 26 '18 at 13:13
  • I believe this question is off-topic, but you may be interested in a related question: https://stackoverflow.com/questions/47911294/excel-determine-parity-of-permutation – Alexis Olson Apr 26 '18 at 21:16
  • 1
    I'm voting to close this question as off-topic because it is about [math.se] instead of programming or software development. – Pang Apr 27 '18 at 00:45
  • No i really need the answer please donr close it – Ankit Kumar May 01 '18 at 11:02

1 Answers1

3

You are not right. The number of transpositions will not always be 3 but will vary.

Your first example (1,2,3,4) needs no transpositions (it is the original order) so it is an even permutation. Your second example (1,2,4,3) can be done with one transposition (swap the 3 and the 4) so it is odd. Your third example (1,3,2,4) can also be done with one transposition (swap the 2 and the 3) so it is odd. And so on.

An example you did not give is (1,3,4,2), which can be done with two transpositions (swap the 2 and the 3, then swap the 2 and the 4) so this is an even transposition. Another final example is (2,3,4,1) which can be done with three transpositions (swap the 1 and 2, then swap 1 and 3, then swap 1 and 4) so this is odd.

No permutation of four elements will require more than three transpositions, but many can be done in fewer. Note that when I say "can be done with one transposition" the permutation can be done with a different number of transpositions, such as with three or five. However, a mathematical theorem states that if a permutation can be done with n transpositions and also with k transpositions, then n and k have the same parity--they are both even or both odd. So an "even permutation" can be done with an even number of transpositions, but we neither know nor care what the exact number is. An "odd permutation" can be done with an odd number of transpositions--one or three or five or ....

Ask if you need help in writing code that determines the parity of a permutation.

Rory Daulton
  • 21,934
  • 6
  • 42
  • 50
  • Oh thanks for the reply. I didnt get how we can find odd or even? And how does (1,2,4,3) not have three transposition? Like (1,2)(1,4)(1,3) ? – Ankit Kumar May 01 '18 at 11:01
  • @AnkitKumar: See the edits to my answer. We can "find odd or even" in multiple ways, both mathematically and in code. This site is for coding--if you want to see some code you can research other answers on this site or show some of your own effort (including research and some code) and ask for more help here. And `(1,2,4,3)` can be done with one transposition as in my answer, or with three as in your comment, or with five or seven or .... The point is that any sequence of transpositions resulting in that permutation will have an odd number of transpositions, so that is an odd permutation. – Rory Daulton May 01 '18 at 12:08
  • Like if i need to find all the permutaions of a set {1,2,3,4} then there will be 24 permutations with four elements each for example - (1,2,3,4), (1,2,4,3), (1,3,2,4), (1,3,4,2) etc till 24 more. Also if i want to tell how many of those are even and odd then i just need to find the no. Of swaps? Like 1st one need no swaps so it is even, 2nd one has 3&4 swapped so it is odd, 3rd has 2&3 swapped so it is odd too, 4th one has first 3 and 4 swapped then 2&3 swapped and it is even. But is this the way to see it? I mean what about this- (1,3,4,2)=(1,3)(1,4)(1,2) not it says it is odd ? Im confused! – Ankit Kumar May 05 '18 at 16:04
  • @AnkitKumar: Exactly half of the permutations will be even and the other half will be odd--another mathematical theorem. Your calculations with `(1,3,4,2)` are wrong. If we swap the *values* given in your example, `(1,3)` takes the initial `(1,2,3,4)` to `(3,2,1,4)`, then `(1,4)` takes that to `(3,2,4,1)`, then `(1,2)` takes that to `(3,1,4,2)`. If we swap the *positions* in your example (which is the usual meaning) then `(1,3)` takes the initial `(1,2,3,4)` to `(3,2,1,4)`, then `(1,4)` takes that to `(4,2,1,3)`, then `(1,2)` takes that to `(2,4,1,3)`. Neither of those is `(1,3,4,2)`. – Rory Daulton May 05 '18 at 16:14
  • Thanks for the reply! One last favour since i have asked this question on wrong website and also it was wrongly questioned. I have created another same question on https://math.stackexchange.com/questions/2767985/what-will-be-the-possible-permutations-of-set-s-1-2-3-4-and-how-many-are-of-t can you answer it there i am going to delete this thread? – Ankit Kumar May 05 '18 at 16:34
  • My answer has some upvotes--some people think it is helpful--so I recommend not deleting this question. I'll make a comment at your other question. – Rory Daulton May 05 '18 at 16:38