Results 1 to 9 of 9

Math Help - Help Creating A Matrix in Latex

  1. #1
    Junior Member
    Joined
    Mar 2009
    Posts
    46

    Help Creating A Matrix in Latex

    Hi, I need to make an nxn square matrix using Latex with 1's starting in the bottom left (n,1) all the way up to the top right (1,n) on that sort of opposite diagonal. I can't figure out to do it. Also, maybe I'm wrong, but I didn't think there was a way to do diagonal dots that go the opposite way of ddots. Ideally, I would like to place ones in row n, column 1 and then row 1, column n, with a kind of reverse diagonal dots in between, and no other elements anywhere else. I cannot figure out how to do this for the life of me. Can anyone help? Thank you.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Flow Master
    mr fantastic's Avatar
    Joined
    Dec 2007
    From
    Zeitgeist
    Posts
    16,948
    Thanks
    5
    Quote Originally Posted by azdang View Post
    Hi, I need to make an nxn square matrix using Latex with 1's starting in the bottom left (n,1) all the way up to the top right (1,n) on that sort of opposite diagonal. I can't figure out to do it. Also, maybe I'm wrong, but I didn't think there was a way to do diagonal dots that go the opposite way of ddots. Ideally, I would like to place ones in row n, column 1 and then row 1, column n, with a kind of reverse diagonal dots in between, and no other elements anywhere else. I cannot figure out how to do this for the life of me. Can anyone help? Thank you.
    Read this: Matrices
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Mar 2009
    Posts
    46
    I've tried looking at very similar websites with no such luck. I don't understand how to get blank spots where I want them and only put elements in the bottom left and top right of the matrix. And, I'm assuming the center of the matrix will have to be blank because there are no diagonal dots that go the reverse way so I would just have to draw them in after printing. I'm just completely confused on what to do. I've tried a bunch of ways, and I can't get anything to work.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    is up to his old tricks again! Jhevon's Avatar
    Joined
    Feb 2007
    From
    New York, USA
    Posts
    11,663
    Thanks
    3
    Quote Originally Posted by azdang View Post
    I've tried looking at very similar websites with no such luck. I don't understand how to get blank spots where I want them and only put elements in the bottom left and top right of the matrix. And, I'm assuming the center of the matrix will have to be blank because there are no diagonal dots that go the reverse way so I would just have to draw them in after printing. I'm just completely confused on what to do. I've tried a bunch of ways, and I can't get anything to work.
    do you mean like this?

    \begin{pmatrix}  & & a \\ & & \\ b & & \end{pmatrix}
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Math Engineering Student
    Krizalid's Avatar
    Joined
    Mar 2007
    From
    Santiago, Chile
    Posts
    3,654
    Thanks
    12
    I_{n}=\left[ \begin{matrix}<br />
   1 & 0 & \cdots  & 0  \\<br />
   0 & 1 & \cdots  & 0  \\<br />
   \vdots  & \vdots  & \ddots  & \vdots   \\<br />
   0 & 0 & \cdots  & 1<br />
\end{matrix} \right]

    ?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by azdang View Post
    Hi, I need to make an nxn square matrix using Latex with 1's starting in the bottom left (n,1) all the way up to the top right (1,n) on that sort of opposite diagonal. I can't figure out to do it. Also, maybe I'm wrong, but I didn't think there was a way to do diagonal dots that go the opposite way of ddots. Ideally, I would like to place ones in row n, column 1 and then row 1, column n, with a kind of reverse diagonal dots in between, and no other elements anywhere else. I cannot figure out how to do this for the life of me. Can anyone help? Thank you.
    The control sequence \ddots is not a TeX primitive. It is constructed by a formula that is given on p.359 of Knuth's The TeXbook. You can modify this formula to define a "reverse \ddots", call it \revdots. The formula is

    \def\revdots{\mathinner{\mkern1mu\raise1pt\vbox{\k ern7pt\hbox{.}}\mkern2mu\raise4pt\hbox{.}\mkern2mu \raise7pt\hbox{.}\mkern1mu}}

    Using that macro, the input \begin{bmatrix}0&0&\ldots&1\\ \vdots&\vdots&\revdots&\vdots\\ 0&1&\ldots&0\\ 1&0&\ldots&0\end{bmatrix} will then generate the output \begin{bmatrix}0&0&\ldots&1\\ \vdots&\vdots&\mathinner{\mkern1mu\raise1pt\vbox{\  kern7pt\hbox{.}}\mkern2mu\raise4pt\hbox{.}\mkern2m  u\raise7pt\hbox{.}\mkern1mu}&\vdots\\ 0&1&\ldots&0\\ 1&0&\ldots&0\end{bmatrix}.

    (The implementation of TeX in this forum does not allow user-defined macros. So I had to incorporate the full definition of "\revdots" at the point where I wanted to use it. But in a normal TeX document you can put the definition at the beginning of the file, and then invoke it by writing \revdots each time you need it.)
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Mar 2009
    Posts
    46
    Quote Originally Posted by Jhevon View Post
    do you mean like this?

    \begin{pmatrix} & & a \\ & & \\ b & & \end{pmatrix}
    Yesss!!! Thank you so so much. I've been going crazy over this. Matrices in Latex are definitely not my strong suit. Thank you again!!
    Follow Math Help Forum on Facebook and Google+

  8. #8
    is up to his old tricks again! Jhevon's Avatar
    Joined
    Feb 2007
    From
    New York, USA
    Posts
    11,663
    Thanks
    3
    Quote Originally Posted by azdang View Post
    Yesss!!! Thank you so so much. I've been going crazy over this. Matrices in Latex are definitely not my strong suit. Thank you again!!
    i'm curious as to why you would want want such a form, the other forms given in this thread seem more conventional. but if that's what you want, i'm glad you're happy
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Junior Member
    Joined
    Mar 2009
    Posts
    46
    I was working on a problem using Arnoldi's method to generate orthonormal bases for Krylov Spaces. I needed to show the matrix with these bases as its orthonormal columns, and the columns were e_n,e_{n-1},...,e_1, so I needed a sort of opposite Identity matrix. Whenever we use matrices in class with 0's elsewhere, my teacher just leaves those parts blank, so I didn't know how to do that.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. creating a matrix for the game bridges
    Posted in the Advanced Algebra Forum
    Replies: 0
    Last Post: June 6th 2011, 10:24 PM
  2. Creating a Spatial Weights Matrix
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: October 7th 2010, 02:16 PM
  3. Creating 2 columns in latex document
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: June 27th 2010, 10:01 AM
  4. creating a nxn matrix for LU factorization
    Posted in the Advanced Algebra Forum
    Replies: 4
    Last Post: March 23rd 2010, 02:37 AM
  5. creating a matrix
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: October 30th 2009, 05:16 AM

Search Tags


/mathhelpforum @mathhelpforum