This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / The Mathematica Book / Advanced Mathematics / Linear Algebra  /

3.7.2 Getting Pieces of Matrices

Ways to get pieces of matrices.

Matrices in Mathematica are represented as lists of lists. You can use all the standard Mathematica list-manipulation operations on matrices.

  • Here is a sample

  • In[1]:= t = Array[a, {3, 3}]


  • This picks out the second row of the matrix.
  • In[2]:= t[[2]]


  • Here is the second column of the matrix.
  • In[3]:= Map[#[[2]]&, t]


  • This picks out a submatrix.
  • In[4]:= t[[ {1, 2}, {2, 3} ]]


  • Here is another way to specify the submatrix, convenient when you deal with bigger matrices.
  • In[5]:= t[[ Range[1,2], Range[2,3] ]]