Transpose of a matrix
Definition
For general matrix A
the transpose of A denoted by AT is defined as
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 |
1.
=> (def A [[3 1.5 2]
[4 2 0]])
=> (= (transpose (transpose A)) A)
true
2.
=> (require '[kigubkur.op [etimes :refer [etimes]]])
=> (= (transpose (etimes 2 A)) (etimes 2 (transpose A)))
true
3.
=> (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:
4.
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
=> (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