# submatrices (Mathematica)

• Nov 10th 2011, 11:06 AM
yosso
submatrices (Mathematica)
Could anyone explain me how I may obtain in Mathematica v7 all possible submatrices of any square matrix? For example:

matrix

$\displaystyle \left(\begin{array}{ccc} a&b&c \\ d&e&f \\ g&h&i \end{array}\right)$

divided as follows:

$\displaystyle \left(\begin{array}{c|cc} a&b&c \\ \hline d&e&f \\ g&h&i \end{array}\right)$

$\displaystyle \left(\begin{array}{c} a\end{array}\right)$

$\displaystyle \left(\begin{array}{cc} b&c \end{array}\right)$

$\displaystyle \left(\begin{array}{c} d \\ g \end{array}\right)$

$\displaystyle \left(\begin{array}{cc} e&f \\ h&i \end{array}\right)$

and

$\displaystyle \left(\begin{array}{cc|c} a&b&c \\ \hline d&e&f \\ g&h&i \end{array}\right)$

$\displaystyle \left(\begin{array}{cc} a&b \end{array}\right)$

$\displaystyle \left(\begin{array}{c} c\end{array}\right)$

$\displaystyle \left(\begin{array}{cc} d&e \\ g&h \end{array}\right)$

$\displaystyle \left(\begin{array}{c} f \\ i \end{array}\right)$

and so on, by using of different partitions of the same matrix.

I assume, that I could use Span or Part but I don't know which way use it to obtain all submatrices for matrices of different sizes.