Skip to main content
4 of 4
edited tags

Using Transpose with a list as the second argument

I'm having difficulty understanding the Transpose function. I know what the transpose of a matrix is, not a problem, and I see that applying the Transpose function to a 3×3 matrix does what is expected.

What I am having difficulty with is the definition, which says:

Transpose[list], "transpose the top two levels of list"

Consider:

A = {{a, b}, {c, d}}
Transpose[A]

What does it mean when the definition says "transpose the top two levels of the list?"

I've read about levels in lists, experimented with TreeForm, but something like this is giving me a lot of trouble.

A = {{{a, b}, {c, d}}, {{e, f}, {g, h}}, {{i, j}, {k, l}}}
Transpose[A, {3, 1, 2}]

Can someone help me (gently) understand the definition:

Transpose[list,{n1,n2,...}], "put the $k^{th}$ level in list at level $n_k$" ?

David
  • 15k
  • 4
  • 47
  • 121