# Transpose

Transpose[list]

transposes the first two levels in list.

Transpose[list,{n1,n2,}]

transposes list so that the k level in list is the nk level in the result.

Transpose[list,mn]

transposes levels m and n in list, leaving all other levels unchanged.

# Details and Options • Transpose[m] gives the usual transpose of a matrix m.
• Transpose[m] can be input as m.
• can be entered as tr or \[Transpose].
• For a matrix m, Transpose[m] is equivalent to Transpose[m,{2,1}].
• For an array a of depth r3, Transpose[a] is equivalent to Transpose[a,{2,1,3,,r}], only transposing the first two levels.
• The ni in Transpose[a,{n1,n2,}] or Transpose[a,n1n2] must be positive integers no larger than ArrayDepth[a].
• If {n1,n2,} is a permutation list, then the element at position {i1,i2,} of Transpose[a,{n1,n2,}] is the element at position {in1,in2,} of the array a.
• For a permutation perm, the dimensions of Transpose[a,perm] are Permute[Dimensions[a],perm].
• A permutation list perm in Transpose[a,perm] can also be given in Cycles form, as returned by PermutationCycles[perm].
• Transpose[a,mn] or Transpose[a,TwoWayRule[m,n]] is equivalent to Transpose[a,Cycles[{{m,n}}]].
• Transpose allows the ni to be repeated, computing diagonals of the subarrays determined by the repeated levels. The result is therefore an array of smaller depth.
• For a square matrix m, Transpose[m,{1,1}] returns the main diagonal of m, as given by Diagonal[m].
• In general, if np=nq then the operation Transpose[a,{n1,n2,}] is possible for an array a of dimensions {d1,d2,} if dp=dq.
• Transpose works on SparseArray and StructuredArray objects.

# Examples

open all close all

## Basic Examples(2)

Transpose a 2×3 matrix:

 In:= Out= Use followed by tr to enter the transposition operator:

 In:= Out= ## Neat Examples(1)

Introduced in 1988
(1.0)
|
Updated in 2017
(11.2)