Linear Transformation to Block-wise Stack Matrix

Click For Summary

Discussion Overview

The discussion revolves around the transformation of a matrix of the form X = [A B] into a vertically stacked matrix Y = [A; B], where A and B are matrices of equal dimensions. Participants explore the feasibility of achieving this transformation through matrix multiplication and discuss potential methods, including the use of block diagonal matrices and transposes.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests using a block diagonal matrix to achieve the transformation, providing an example of how this could work with specific matrices.
  • Another participant questions the feasibility of the proposed method, arguing that a single transformation matrix cannot yield the desired result due to dimensional contradictions.
  • Some participants express uncertainty about the correctness of the block diagonal approach and suggest that multiple matrices may be necessary for the transformation.
  • There is a discussion about the use of transposes as a potential solution for simpler cases, but participants note the difficulty in generalizing this for larger block structures.
  • One participant proposes a more complex expression involving identity matrices and zero matrices to illustrate a possible method for achieving the transformation.
  • Another participant points out that the transpose of the combined matrix would require A and B to be symmetric, which may not align with the original intent of the transformation.
  • Several participants reiterate the challenges in finding a single matrix solution and highlight the need for careful consideration of matrix dimensions and properties.

Areas of Agreement / Disagreement

Participants generally do not reach a consensus on the feasibility of achieving the desired transformation with a single matrix. Multiple competing views and methods are presented, and the discussion remains unresolved regarding the best approach.

Contextual Notes

Participants note limitations regarding the assumptions about matrix dimensions and properties, as well as the potential need for multiple matrices to achieve the transformation. There is also mention of the complexity involved in generalizing solutions for larger block structures.

weetabixharry
Messages
111
Reaction score
0
I have a matrix of the form X = [A B], where A and B are matrices of equal dimensions (M x N). I am looking for an elegant transformation to obtain Y = [A; B]. That is, the blocks are now stacked vertically.

Normally, I'd look for a solution of the form Y = VXW, where V is (2M x M) and W is (N x N/2). However, I feel that one may not exist in this case. For example, in the simplest case where A and B are scalars, then XW is scalar and so, in general, no V will exist which can give Y as required.

In that straightforward example, of course, we just use the transpose: Y = XT. However, I cannot see how to generalise this for when A and B are matrices. (Or, actually, I'm hoping eventually to find a solution for stacking many matrices [A,B,C,...]).

Any help would be greatly appreciated!
 
Physics news on Phys.org
Use a "block diagonal" matrix with blocks of the form
[tex]\begin{bmatrix}1 & 1 \\ 1 & 1 \end{bmatrix}[/tex]

For example, if
[tex]\begin{bmatrix}a & b & u & v \\ c & d & w & x\end{bmatrix}[/tex]
then
[tex]\begin{bmatrix}1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1\end{bmatrix}\begin{bmatrix}a & b & u & v \\ c & d & w & x\end{bmatrix}= \begin{bmatrix} a & b \\ c & d \\ u & v \\ w & x \end{bmatrix}[/tex]
 
Thank you for the reply.

I'm not sure if I understand correctly, but it seems that you are taking a (2 x 4) matrix and left-multiplying it by a (4 x 4) matrix. Perhaps I'm missing something, but in general I cannot see how this is possible.

If a solution exists by straightforward matrix multiplication, I would expect us to require 2 matrices (one to left-multiply X, one to right-multiply X):

Y = VXW
(2M x N) = (2M x M)(M x 2N)(2N x N)

{Note: My original post lists the wrong dimensions. These should now be correct.}
 
HallsofIvy said:
Use a "block diagonal" matrix with blocks of the form
[tex]\begin{bmatrix}1 & 1 \\ 1 & 1 \end{bmatrix}[/tex]

For example, if
[tex]\begin{bmatrix}a & b & u & v \\ c & d & w & x\end{bmatrix}[/tex]
then
[tex]\begin{bmatrix}1 & 1 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 1 & 1\end{bmatrix}\begin{bmatrix}a & b & u & v \\ c & d & w & x\end{bmatrix}= \begin{bmatrix} a & b \\ c & d \\ u & v \\ w & x \end{bmatrix}[/tex]

I'm left scratching my head by this one. Wouldn't your 4x4 matrix give elements like [itex](a+c)[/itex]?

More seriously: isn't it impossible (as the original poster rightly suggested) to get what he wants with a single matrix? Here's the simple proof: matrix multiplication makes an [itex]m \times n[/itex] matrix from an [itex]m \times k[/itex] matrix and a [itex]k \times n[/itex] one. [itex]k[/itex] can be anything, as long as it's the same for both matrices. If we could get by with a single transformation matrix, then for this example, the original matrix tells us [itex]k=2[/itex] and [itex]n=4[/itex], while the final matrix tells us [itex]m=4[/itex], [itex]n=2[/itex]. That's a contradiction in [itex]n[/itex].

I don't know how to do what the OP wants, but he is perfectly correct that he'll need at least two matrices to do it.
 
I think he might have meant to put identity matrices instead of having all 1's.
 
chiro said:
I think he might have meant to put identity matrices instead of having all 1's.

A block-wise identity matrix in that way would just be an identity matrix.

Either way, the matter still remains that a (2M x N) matrix cannot be obtained by only a single multiplication of an (M x 2N) matrix with one other matrix.

It's quite interesting and surprising to me that such a seemingly straightforward operation is so tricky to implement! I feel like I must be missing a trick...
 
Well, I now think there's no way to do it. Consider taking a 1x2 matrix into a 2x1 matrix. Then your two matrices must be 2x1 and 1x2. In terms of dimensions:
[tex](2,1) = (2,1)(1,2)(2,1)[/tex]
(Since it has to begin and end with a 2 and 1, and have a 1 and 2 in the middle.)

So we have:
[tex] \left[\begin{array}{c} x\\ y\end{array}\right] =<br /> \left[\begin{array}{c} a\\ b\end{array}\right]<br /> \left[\begin{array}{cc} x & y\end{array}\right]<br /> \left[\begin{array}{c} c\\ d\end{array}\right][/tex]
Do the rightmost multiplication first:
[tex] \left[\begin{array}{c} x\\ y\end{array}\right] =<br /> \left[\begin{array}{c} a\\ b\end{array}\right]<br /> (cx + dy)[/tex]
There's no way that could be true for all [itex]x,y[/itex] if the other matrices are constant. So unless I missed something, I don't think you can do what you're trying to do.
 
chogg said:
Well, I now think there's no way to do it. Consider taking a 1x2 matrix into a 2x1 matrix. Then your two matrices must be 2x1 and 1x2. In terms of dimensions:
[tex](2,1) = (2,1)(1,2)(2,1)[/tex]
(Since it has to begin and end with a 2 and 1, and have a 1 and 2 in the middle.)

So we have:
[tex] \left[\begin{array}{c} x\\ y\end{array}\right] =<br /> \left[\begin{array}{c} a\\ b\end{array}\right]<br /> \left[\begin{array}{cc} x & y\end{array}\right]<br /> \left[\begin{array}{c} c\\ d\end{array}\right][/tex]
Do the rightmost multiplication first:
[tex] \left[\begin{array}{c} x\\ y\end{array}\right] =<br /> \left[\begin{array}{c} a\\ b\end{array}\right]<br /> (cx + dy)[/tex]
There's no way that could be true for all [itex]x,y[/itex] if the other matrices are constant. So unless I missed something, I don't think you can do what you're trying to do.

As I wrote in my original post, for a (1 x 2) input, the elegant solution is to simply use the matrix transpose. However, it is not clear how to generalise this for larger block structures (e.g. a solution that perhaps involves both matrix multiplications and transposes).
 
Well, the transpose of
[tex]\begin{bmatrix}A & B \end{bmatrix}[/tex]
would actually be
[tex]\begin{bmatrix}A^{T} \\ B^{T} \end{bmatrix}[/tex]
if I am not mistaken, so you would have to require A and B to be symmetric as well for the transpose to work.

I don't think this is what you were looking for, but after playing around for a little while, I found that:
[tex]\begin{bmatrix}I_{m} \\ 0_{m} \end{bmatrix} \begin{bmatrix}A & B \end{bmatrix} \begin{bmatrix}I_{n} \\ 0_{n} \end{bmatrix} + \begin{bmatrix}0_{m} \\ I_{m} \end{bmatrix} \begin{bmatrix}A & B \end{bmatrix} \begin{bmatrix}0_{n} \\ I_{n} \end{bmatrix} = \begin{bmatrix} A \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ B \end{bmatrix} = \begin{bmatrix} A \\ B \end{bmatrix}[/tex]

I'm not sure if the above can be simplified to something of the form AXB, but it can easily be generalized for matrices of the form [A | B | C | etc. ].
 
  • #10
weetabixharry said:
As I wrote in my original post, for a (1 x 2) input, the elegant solution is to simply use the matrix transpose. However, it is not clear how to generalise this for larger block structures (e.g. a solution that perhaps involves both matrix multiplications and transposes).

Okay; same argument as above, but now [itex]x, y, a, b, c, d[/itex] are block matrices with the required dimensions. It's still just as impossible (except that in my previous post, I clumsily transposed the order of the products [itex]xc[/itex] and [itex]yd[/itex]).

Doing it right, you see that we need to simultaneously satisfy two equations:
  • [itex]x = a(xc + yd)[/itex]
  • [itex]y = b(xc + yd)[/itex]
We're only assuming that multiplication is associative here (not necessarily commutative), which is true for matrix multiplication, so it doesn't matter if these guys are scalars or block matrices. The first requires [itex]c \ne 0[/itex] and [itex]d=0[/itex], while the second requires [itex]d \ne 0[/itex] and [itex]c=0[/itex]. Can't be done in this case; therefore, can't be done in general.

Stylish's solution works, of course, but I'm not sure if it's quite like what you had in mind. Actually, his solution reminds me of a similar thread we had recently. See here:
https://www.physicsforums.com/showthread.php?t=511243
for how to generate matrices that "pick out" an individual component of a matrix (along with a boneheaded mistake by yours truly).

Cheers,
Chip

PS On rereading your original post, I noticed you basically gave exactly the argument which I gave later (except where I pointed out it would apply to block matrices as well). Somehow I missed that on the first go'round -- sorry! :)
 
  • #11
Stylish said:
Well, the transpose of
[tex]\begin{bmatrix}A & B \end{bmatrix}[/tex]
would actually be
[tex]\begin{bmatrix}A^{T} \\ B^{T} \end{bmatrix}[/tex]
if I am not mistaken, so you would have to require A and B to be symmetric as well for the transpose to work.

I don't think this is what you were looking for, but after playing around for a little while, I found that:
[tex]\begin{bmatrix}I_{m} \\ 0_{m} \end{bmatrix} \begin{bmatrix}A & B \end{bmatrix} \begin{bmatrix}I_{n} \\ 0_{n} \end{bmatrix} + \begin{bmatrix}0_{m} \\ I_{m} \end{bmatrix} \begin{bmatrix}A & B \end{bmatrix} \begin{bmatrix}0_{n} \\ I_{n} \end{bmatrix} = \begin{bmatrix} A \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ B \end{bmatrix} = \begin{bmatrix} A \\ B \end{bmatrix}[/tex]

I'm not sure if the above can be simplified to something of the form AXB, but it can easily be generalized for matrices of the form [A | B | C | etc. ].

That's a very good point regarding the requirement of symmetricity if I want to use transposes. That rules that idea out!

Thanks for figuring out something that works. My hunch is that this is about as 'nice' a solution as we're going to get (of course, implementing this in a programming language is straightforward, but it would nice to be able to express it elegantly in mathematical terms too).

Thanks to all for helping out. Still, 10 points to anyone who can provide (or disprove the existence of) a general solution of the form Y = AXB.
 
  • #12
I am happy to collect the 10 points for my above post, which disproves the existence of such a transformation in a particular case.

If there's a particular case that doesn't work, then there can't be a general formula.

(Let me know if I've missed anything!)
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 52 ·
2
Replies
52
Views
4K