Testing commutativity of matrix multiplication July 17, 1987 Let's show by example that matrix multiplication is not commutative. and let's keep a log of our work as we go along, having in mind that we want to print the finished document, and also mail it to someone. Using CaminoReal's mathematical expression editor, let's enter the product of two general 2 x 2 matrices. When the editor first comes up, I see a placeholder, which is to be replaced by some expression. I select the placeholder, and using pop up menus, specify that I want to replace it by a 2 x 2 matrix. The matrix elements are initialized to zero. I now select each element of the matrix and replace it by the indeterminate I want. To get a product, I select the matrix and wrap it with a multipliicatiion template by typing an asterisk. I then replace the new placeholder by copying in the existing matrix, and modifying its elements appropriately X Now I've got something I want to put into the document. Let me get an internal memo document template: Using the next key, I fill in the standard fields, and begin my text. Now let's place the expression in the document: Now let's get its value and put that in the document. I make it the current selection, and hit a button that says evaluate in place: X and put in the document. Now I put in some more text "Now consider the product in the opposite order". Using CR's Undo button, I back up to the unevaluated expression, and then using CR's swap command, I exchange them. Put this in the doc. X I'll do this evaluation in a different way; Tioga, i.e. textually, copy the expression, and hit a CR button which says eval selection in place. X Now let's check equality of the matrices. I select the second product in my CR tool, hit the = key to wrap an equality template qround it, and replace the new placeholder by bringing in the first product. I do the equality check by selecting the entire expression and htting EvalInPlace. Let's note in our document that direct check yields false. Now let's determine the conditions under which equality does hold, i.e. the conditions such that multiplication IS commutative. Let me subtract the first product from the second and set equal to zero (select left, wrap -, set new placeholder to 0, swap with right). I now evaluate the new left hand side. X Let's put this result into our document. I have an idea, which I'll type directly into the document: """Let's try solving the two equations in the first row for a and b in terms of the other indeterminates""" I plan to use the SMP computer algebra system to do the solving; first I need to push the =0 into the matrix, i.e. get a matrix of equations. I have SMP set up to push equality over lists, so by just having SMP evaluate the expression, I'll get the equations. To do this, I sect the expression and left click the "Algebra" button to pass it to SMP (middle clicking the Algebra button would pass it to Reduce). SMP is running on a Sun workstation on our local network, I exchange data with it by file transfers; the TerminalIO window at the lower right of my screen keeps me informed about the progress of the transfers. X Let me get a new CR viewer to build the SMP command I want: X I extract the solution expressions I want, place them in the document, and put in my final text. The document is now finished, and I can print it. Let's suppose that I want to pass the document to the recipient by mailing it to him. The Cedar computer mail system is called Walnut; it maintains a database of message sets. To do the send, I get a message template, fill in the standard fields, copy in the document, and send. Within a few minutes, it will appear in my Active messageset. I open is as I would any message, and provided that CaminoReal is loaded, I see the math. +Ihead..K IblocklLLLL CharPropsArtwork MeddleExprPostfix[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading MeddleExprqCaminoRealExpressionRepresentationVersion1.1 (CMPD $product {$multiplier (MTRX $matrix [2 2] {$r1c1 (ATOM $variable "a")} {$r1c2 (ATOM $variable "b")} {$r2c1 (ATOM $variable "c")} {$r2c2 (ATOM $variable "d")})} {$multiplicand (MTRX $matrix [2 2] {$r1c1 (ATOM $variable "e")} {$r1c2 (ATOM $variable "f")} {$r2c1 (ATOM $variable "g")} {$r2c2 (ATOM $variable "h")})}) MeddlePtSize30[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading L[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading ggL[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading vvL[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading [33.48704 pt leading 32.74352 pt topLeading 32.74352 pt topIndent 24.74352 pt bottomLeading LArtwork MeddleExprPostfix[50.47831 pt leading 37.23916 pt topLeading 37.23916 pt topIndent 37.23916 pt bottomLeading MeddleExpr&CaminoRealExpressionRepresentationVersion1.1 (MTRX $matrix [2 2] {$r1c1 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})} {$augend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "e")})})} {$r1c2 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "h")})} {$augend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "f")})})} {$r2c1 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "g")})} {$augend (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "e")})})} {$r2c2 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "h")})} {$augend (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "f")})})}) MeddlePtSize30[50.47831 pt leading 37.23916 pt topLeading 37.23916 pt topIndent 37.23916 pt bottomLeading L[50.47831 pt leading 37.23916 pt topLeading 37.23916 pt topIndent 37.23916 pt bottomLeading L[50.47831 pt leading 37.23916 pt topLeading 37.23916 pt topIndent 37.23916 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading [33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading LArtwork MeddleExprPostfix[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading MeddleExprqCaminoRealExpressionRepresentationVersion1.1 (CMPD $product {$multiplier (MTRX $matrix [2 2] {$r1c1 (ATOM $variable "e")} {$r1c2 (ATOM $variable "f")} {$r2c1 (ATOM $variable "g")} {$r2c2 (ATOM $variable "h")})} {$multiplicand (MTRX $matrix [2 2] {$r1c1 (ATOM $variable "a")} {$r1c2 (ATOM $variable "b")} {$r2c1 (ATOM $variable "c")} {$r2c2 (ATOM $variable "d")})}) MeddlePtSize30[50.23055 pt leading 43.11528 pt topLeading 43.11528 pt topIndent 31.11528 pt bottomLeading L[31.09982 pt leading 31.54991 pt topLeading 31.54991 pt topIndent 23.54991 pt bottomLeading L[31.09982 pt leading 31.54991 pt topLeading 31.54991 pt topIndent 23.54991 pt bottomLeading W46.8152 pt leading 35.4076 pt topLeading 35.4076 pt topIndent 35.4076 pt bottomLeading LArtwork MeddleExprPostfix[50.27884 pt leading 37.13941 pt topLeading 37.13941 pt topIndent 37.13942 pt bottomLeading MeddleExpr&CaminoRealExpressionRepresentationVersion1.1 (MTRX $matrix [2 2] {$r1c1 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "f")} {$multiplicand (ATOM $variable "c")})} {$augend (CMPD $product {$multiplier (ATOM $variable "e")} {$multiplicand (ATOM $variable "a")})})} {$r1c2 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "f")} {$multiplicand (ATOM $variable "d")})} {$augend (CMPD $product {$multiplier (ATOM $variable "e")} {$multiplicand (ATOM $variable "b")})})} {$r2c1 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "h")} {$multiplicand (ATOM $variable "c")})} {$augend (CMPD $product {$multiplier (ATOM $variable "g")} {$multiplicand (ATOM $variable "a")})})} {$r2c2 (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "h")} {$multiplicand (ATOM $variable "d")})} {$augend (CMPD $product {$multiplier (ATOM $variable "g")} {$multiplicand (ATOM $variable "b")})})}) MeddlePtSize30[50.27884 pt leading 37.13941 pt topLeading 37.13941 pt topIndent 37.13942 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading ::L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L[33.51922 pt leading 28.75961 pt topLeading 28.75961 pt topIndent 28.75961 pt bottomLeading L Artwork MeddleExprPostfix[50.47831 pt leading 46.37249 pt topLeading 46.37249 pt topIndent 28.10582 pt bottomLeading MeddleExprCaminoRealExpressionRepresentationVersion1.1 (CMPD $eqFormula {$lhs (MTRX $matrix [2 2] {$r1c1 (CMPD $sum {$addend (CMPD $negation {$a (CMPD $product {$multiplier (ATOM $variable "f")} {$multiplicand (ATOM $variable "c")})})} {$augend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})})} {$r1c2 (CMPD $sum {$addend (CMPD $sum {$addend (CMPD $difference {$subtrahend (CMPD $negation {$a (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "e")})})} {$minuend (CMPD $product {$multiplier (ATOM $variable "f")} {$multiplicand (ATOM $variable "d")})})} {$augend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "f")})})} {$augend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "h")})})} {$r2c1 (CMPD $difference {$subtrahend (CMPD $sum {$addend (CMPD $difference {$subtrahend (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "e")})} {$minuend (CMPD $product {$multiplier (ATOM $variable "h")} {$multiplicand (ATOM $variable "c")})})} {$augend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "g")})})} {$minuend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "g")})})} {$r2c2 (CMPD $difference {$subtrahend (CMPD $product {$multiplier (ATOM $variable "f")} {$multiplicand (ATOM $variable "c")})} {$minuend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})})})} {$rhs (ATOM $integer "0")}) MeddlePtSize30[50.47831 pt leading 46.37249 pt topLeading 46.37249 pt topIndent 28.10582 pt bottomLeading L[33.48704 pt leading 32.74352 pt topLeading 32.74352 pt topIndent 24.74352 pt bottomLeading [33.48704 pt leading 32.74352 pt topLeading 32.74352 pt topIndent 24.74352 pt bottomLeading L Artwork MeddleExprPostfixX27.3515 pt leading 30.9485 pt topLeading 30.9485 pt topIndent 20.40301 pt bottomLeading MeddleExprCaminoRealExpressionRepresentationVersion1.1 (CMPD $binaryFunction {$f (ATOM $variable "List")} {$arg1 (CMPD $binaryFunction {$f (ATOM $variable "List")} {$arg1 (CMPD $eqFormula {$lhs (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "f")})} {$rhs (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})})} {$arg2 (CMPD $eqFormula {$lhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "e")})} {$augend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "f")})})} {$rhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "f")})} {$augend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "h")})})})})} {$arg2 (CMPD $binaryFunction {$f (ATOM $variable "List")} {$arg1 (CMPD $eqFormula {$lhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "g")})} {$augend (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "h")})})} {$rhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "e")})} {$augend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "g")})})})} {$arg2 (CMPD $eqFormula {$lhs (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})} {$rhs (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "f")})})})}) MeddlePtSizeX27.3515 pt leading 30.9485 pt topLeading 30.9485 pt topIndent 20.40301 pt bottomLeading LX27.3515 pt leading 30.9485 pt topLeading 30.9485 pt topIndent 20.40301 pt bottomLeading ;;L Artwork MeddleExprPostfix[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading MeddleExpr*CaminoRealExpressionRepresentationVersion1.1 (CMPD $unaryFunction {$f (ATOM $variable "Flat")} {$arg1 (CMPD $unaryFunction {$f (ATOM $variable "Ex")} {$arg1 (CMPD $binaryFunction {$f (ATOM $variable "Sol")} {$arg1 (CMPD $binaryFunction {$f (ATOM $variable "List")} {$arg1 (CMPD $eqFormula {$lhs (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "g")})} {$rhs (CMPD $product {$multiplier (ATOM $variable "c")} {$multiplicand (ATOM $variable "f")})})} {$arg2 (CMPD $eqFormula {$lhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "a")} {$multiplicand (ATOM $variable "f")})} {$augend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "h")})})} {$rhs (CMPD $sum {$addend (CMPD $product {$multiplier (ATOM $variable "b")} {$multiplicand (ATOM $variable "e")})} {$augend (CMPD $product {$multiplier (ATOM $variable "d")} {$multiplicand (ATOM $variable "f")})})})})} {$arg2 (CMPD $binaryFunction {$f (ATOM $variable "List")} {$arg1 (ATOM $variable "a")} {$arg2 (ATOM $variable "b")})})})}) MeddlePtSize[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading L[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading L[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading L[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading L[39.28505 pt leading 36.91527 pt topLeading 36.91527 pt topIndent 26.36978 pt bottomLeading :