Results 1 to 4 of 4

Math Help - How to produce an "elongated diagonal matrix"?

  1. #1
    Newbie
    Joined
    Oct 2010
    Posts
    2

    How to produce an "elongated diagonal matrix"?

    I know this question sounds a bit weird but it basically comes down to this. I want to create a matrix of this type:

    \begin{pmatrix}<br />
1 & 0 & 0\\ <br />
1 & 0 & 0\\ <br />
1 & 0 & 0\\ <br />
0 & 1 & 0\\ <br />
0 & 1 & 0\\ <br />
0 & 1 & 0\\ <br />
0 & 0 & 1\\ <br />
0 & 0 & 1\\ <br />
0 & 0 & 1<br />
\end{pmatrix}

    How do I produce such a matrix, using only matrix multiplication? I've tried a lot of things myself but my understanding of matrix algebra is too limited to "see" how it can be done. Ideally, I would like a general formula where I can specify the amount of columns and the amount of repetitions (1's) in each column. For instance, 2 repeats and 4 columns:

    \begin{pmatrix}<br />
1 & 0 & 0 & 0\\ <br />
1 & 0 & 0 & 0\\ <br />
0 & 1 & 0 & 0\\ <br />
0 & 1 & 0 & 0\\ <br />
0 & 0 & 1 & 0\\ <br />
0 & 0 & 1 & 0\\ <br />
0 & 0 & 0 & 1\\ <br />
0 & 0 & 0 & 1<br />
\end{pmatrix}

    Anyone has suggestions?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,559
    Thanks
    785
    What are the factors that you want to use? An obvious solution is to multiply the "elongated diagonal matrix" by the identity matrix...
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,115
    Thanks
    68
    Well if you know Basic, easy enough:

    u = repeats, v = columns, w = rows

    100 GET u, v
    110 w = u * v
    120 DIM a(w,v) 'set up array/matrix
    130 FOR c = 1 TO v
    140 FOR r = c * u - u + 1 TO c * u
    150 a(r,c) = 1
    160 NEXT r
    170 NEXT c
    180 FOR r = 1 TO w
    190 FOR c = 1 TO v
    200 PRINT a(r,c)
    210 NEXT c
    220 NEXT r
    If repeats = 5 and colums = 3, this will print:
    1 0 0
    1 0 0
    1 0 0
    1 0 0
    1 0 0
    0 1 0
    0 1 0
    0 1 0
    0 1 0
    0 1 0
    0 0 1
    0 0 1
    0 0 1
    0 0 1
    0 0 1
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Oct 2010
    Posts
    2
    Thanks people!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: June 4th 2011, 01:11 PM
  2. Replies: 2
    Last Post: April 24th 2011, 08:01 AM
  3. Replies: 1
    Last Post: October 25th 2010, 05:45 AM
  4. Replies: 1
    Last Post: June 4th 2010, 11:26 PM
  5. "Maximally diagonal" representation for a symmetric matrix
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: December 21st 2008, 04:37 AM

Search Tags


/mathhelpforum @mathhelpforum