{2,4,1,3} and {3,1,2,4} are two permutations of {1,2,3,4}.How to find the composition of these two permutations which is {1,2,4,3} (composition from right to left)?Thanks.
You can use Permute and Fold:
Permute
Fold
Fold[Permute, {1, 2, 3, 4}, {{3, 1, 2, 4}, {2, 4, 1, 3}}] {1, 2, 4, 3}
You could also use Part:
Part[{2,4,1,3},{3,1,2,4}] {1,2,4,3}
Shorthand:
{2,4,1,3}[[{3,1,2,4}]] {1,2,4,3}
Thanks Gorni for the prompt reply
Thanks Milton.Its easy to remember.