0
$\begingroup$

How can I shift selected column of a matrix (column wise) by matrix multiplication?

Let's say I have a matrix like this: $$A=\begin{pmatrix}1 & 0 & 0\\\ 1 & 0 & 1 \\\ 1&1&1\end{pmatrix}$$

and I want to shift the first column as well as the third column one step (or multiple steps) vertically.

$$ B = \begin{pmatrix}0 & 0 & 0\\\ 1 & 0 & 0 \\\ 1&1&1\end{pmatrix}$$

How should my Matrix S look like to have: $$AS=B$$

With a shift matrix (https://en.wikipedia.org/wiki/Shift_matrix) the whole matrix is shifted in one "direction". That is not what I am looking for.Rather I want to control how many steps specific columns are shifted. To illustrate this problem: Maybe it is easier to look at it as First-In-First-Out System or balls that are falling downwards. Where a "1" stands for a ball and "0" for no ball. When I remove the bottom "ball" gravity makes that the upper balls fall down. E.g. removing ball B31 makes that Ball B21 comes in position of P31 and B11 in position P21. Also removing B33 makes B21 getting in position P31.

I am looking for a more general rules how to do it as they are shown in (https://en.wikipedia.org/wiki/Shift_matrix)

$\endgroup$
4
  • 2
    $\begingroup$ It's not clear what you are asking. What do you mean by "mathematically"? Do you want to multiply the matrix by another matrix to get the result below? $\endgroup$
    – Klaus
    Aug 5, 2020 at 11:09
  • $\begingroup$ Yes, it should be a mathematical way e.g. multiplication. $\endgroup$
    – MScott
    Aug 5, 2020 at 12:27
  • $\begingroup$ @MScott, I think that you should fix your question with the details you provided me. $\endgroup$ Aug 5, 2020 at 22:49
  • $\begingroup$ What more of a clarification does this question need? I honestly don't get it. This question as by now should be clear enough. $\endgroup$
    – MScott
    Aug 13, 2020 at 9:55

2 Answers 2

2
$\begingroup$

Hints : as $A$ is invertible, just find $A^{-1}$.

Then , $S=A^{-1} B $

Can you continue ?

$\endgroup$
0
$\begingroup$

We can operate by left multiplication which corresponds to operation on the rows, notably in this case we exchange first and second rows by the permutation matrix

$$S_1 = \begin{pmatrix}0 & 1 & 0\\\ 1 & 0 & 0 \\\ 0&0&1\end{pmatrix}$$

then we erase the first row by

$$S_2 = \begin{pmatrix}0 & 0 & 0\\\ 0 & 1 & 0 \\\ 0&0&1\end{pmatrix}$$

therefore

$$SA=B$$

$$S=S_2S_1=\begin{pmatrix}0 & 0 & 0\\\ 0 & 1 & 0 \\\ 0&0&1\end{pmatrix}\begin{pmatrix}0 & 1 & 0\\\ 1 & 0 & 0 \\\ 0&0&1\end{pmatrix}=\begin{pmatrix}0 & 0 & 0\\\ 1 & 0 & 0 \\\ 0&0&1\end{pmatrix}$$

Operating by right multiplication which corresponds to column operation we exchange first and third column by

$$S_1 = \begin{pmatrix}0 & 0 & 1\\\ 0 & 1 & 0 \\\ 1&0&0\end{pmatrix}$$

then we copy second column in the third one by

$$S_2 = \begin{pmatrix}1 & 0 & 0\\\ 0 & 1 & 1 \\\ 0&0&0\end{pmatrix}$$

therefore

$$AS=B$$

$$S=S_1S_2=\begin{pmatrix}0 & 0 & 1\\\ 0 & 1 & 0 \\\ 1&0&0\end{pmatrix}\begin{pmatrix}1 & 0 & 0\\\ 0 & 1 & 1 \\\ 0&0&0\end{pmatrix}=\begin{pmatrix}0 & 0 & 0\\\ 0 & 1 & 1 \\\ 1&0&0\end{pmatrix}$$

$\endgroup$
2
  • $\begingroup$ Thanks user. But what would be the "tunable paramters". Is there a general rule for how to shift a specific column by a certain amount of steps? Or is this a special solution for my example? $\endgroup$
    – MScott
    Aug 25, 2020 at 14:21
  • $\begingroup$ @MScott The method is general, to construct the elementary $S_i$ matrix we can start from an identity matrix and manipulate it in such way to obtain the desired manipulation on matrix $A$. The rule is that $S_iA$ modify the rows of $A$ in the same way they are modified from $I$ to $S_i$ and $AS_i$ modify the columns of $A$ in the same way they are modified from $I$ to $S_i$. $\endgroup$
    – user
    Aug 25, 2020 at 14:38

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.