Let's suppose that you have this $4\times4$ matrix:

\begin{bmatrix} 12&10&11&09\\ 16&14&15&13\\ 08&06&07&05\\ 04&02&03&01 \end{bmatrix}

And let's say that you can swap only $N$th row with $(N+1)$th row or $(N-1)$th row and Nth column with $(N+1)$th column and $(N-1)$th column.

Is it possible to swap columns and rows this way, to get "$05$" element from matrix to where is "$15$" and that everything remains the same?

(If you can find the answer, can you write it down this way: If you swap rows, say: "row $1,2$". That means you swap row $1$ with row $2$. If you swap columns, say:" columns $1,2$". That means that you swap column $1$ with column $2$)


1 Answer 1


No, it's not possible.

Say that in the initial position columns have sums $a,b,c,d$. When you swap two columns you again have the same sums, just in a different order. Swaping rows does not impact column sums.

If you swap positions of numbers 5 and 15, the column with number 5 in it will have sum equal to 26. There is no column with sum 26 in the initial position. And therefore the desired arrangement of numbers cannot be reached from the initial position just by swapping raws and columns.

  • $\begingroup$ Well, thank you! :D I thought someone will just say: "No", but you gave me description of the problem! :D $\endgroup$ Mar 31, 2019 at 12:13
  • $\begingroup$ @user10420480 You're welcome :) $\endgroup$
    – Oldboy
    Mar 31, 2019 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.