Transpose of a matrix

Definition

For general matrix A

matrix A

the transpose of A denoted by AT is defined as

A^T; transpose of matrix A

transpose method

Import transpose in the working namespace by doing

=> (require '[kigubkur.mod [transpose :refer [transpose]]])

Examples using transpose

Example 1

=> (def A [[-1 5 6]
           [1.5 5 6]
           [2 3 -1]])
=> (transpose A)
[[-1 1.5 2]
 [5 5 3]
 [6 6 -1]]

Example 2

=> (def A [[5]
           [1/2]
           [-1]])
=> (transpose A)
[[5 1/2 -1]]
=> (transpose (transpose A))
[[5]
 [1/2]
 [-1]]

Basic properties of matrix multiplication

Given any scalar k and

General form Example
matrix A_mn matrix A_23
matrix B_mn matrix B_23

1. (A')' = A

=> (def A [[3 1.5 2]
           [4 2 0]])
=> (= (transpose (transpose A)) A)
true

2. (kA)' = kA'

=> (require '[kigubkur.op [etimes :refer [etimes]]])
=> (= (transpose (etimes 2 A)) (etimes 2 (transpose A)))
true

3. (A + B)' = A' + B'

=> (require '[kigubkur.op [plus :refer [plus]]])
=> (def B [[2 -1 2]
           [1 2 4]])
=> (= (transpose (plus A B)) (plus (transpose A) (transpose B)))
true

Corollary: (A - B)' = A' - B'

4. (AB)' = B'A'

Notice that the given A and B used for illustrating the above three properties do not satisfy the requirements for matrix multiplication. Let us therefore consider two different matrices C and D given by

matrix C_31 matrix D_13
=> (require '[kigubkur.op [mtimes :refer [mtimes]]])
=> (def C [[-2]
           [4]
           [5]])
=> (def D [[1 3 -6]])
=> (= (transpose (mtimes C D)) (mtimes (transpose D) (transpose C)))
true