Roger Wells May 6 2022. . . . an active computer algebra discussion.
Matrix Algebra on the Wolfram Mathematica engine. An absolute accomplishment of the very highest order for the student of college linear algebra. It is a daunting challenge beyond High School mathematics to attempt first year college linear algebra and this too usually after three semesters of calculus, trigonometry and “regular” algebra. There is nothing more abstract, dull, un-exiting and difficult to visualize than these handful of simple matrices introduced in High School, taught in college and that stay the same all the way until the last university math class. With linear algebra the student only gets one “explanation” (chapter one in the book), the simplest one, and one still that the student, and professor, may never be able to actually visualize. Planes, lines, 3D space, and the idea of a “matrix” “of” space being manipulated “around” this picture “in space” is humanly impossible. From there , this science quickly leaves the 3D space we all live in and thought we could “visualize”, until we took this class, and becomes and exhaustive spreadsheet of endless little squares and arithmetic problems that we thought we were finished with in elementary school. The good news is the computer. In this class the student must learn to “cheat” pretty much immediately and is encouraged to do so. Let the machines do the work for us . . . because we are the mathematicians, not the machines . . . BOW YOUR HEADS!
We begin in English class and acknowledge the careful use of capitalization, commas, subject predicate agreement, periods and how to speak a sentence that describes the matrix to the machine. Like most CAS this environment is protected, coloured i.e. . . blue, black for most syntax, and blue usually changes to black after Shift Enter (so not to be alarmed), active and especially here, lots of variable drift. The errors and warnings are the default messages that will change as the notebook is used, saved and re-opened.
Use control comma and control enter to add row and comma spaces. Use right mouse click to extend closing parentheses and semicolon enter to suppress output. This of course means hold down control and press comma. a 2x2 matrix will display. Control enter will expand a square matrix and up, down, right,left arrow keys enable navigation of element “i and j” on a “m x n” matrix, here defined as(equals) A and B.
A=
1
0
2
1
;
B=
1
0
0
0
0
0
;
A+B
Here is a pretty good place to pause and note that the remainder of this notebook is “connected” to these first definitions by default and might be applicable in a problematic way depending if, or not if, Notebook Evaluation is done right after any changes. Any homework problem from a textbook can be entered into these matrices (even if they are of a higher rank and order) and the Evaluation menu offers “Evaluate Notebook”. Check immediately for changes and warnings throughout the document.
Thread
:Objects of unequal length in {1,0}+{1,0,0} cannot be combined.
Thread
:Objects of unequal length in {2,1}+{0,0,0} cannot be combined.
{{1,0}+{1,0,0},{2,1}+{0,0,0}}
An earlier mention was the semicolon ; to suppress output. This is important in that we are constructing a very short and well articulated sentence, in a very short paragraph that is to be graded at Harvard English Dept. But there is also a unique Mathematica algorithm that “accepts” output codes that can be used “twice again” as math input. The drop down suggestion bar also offers just about any type of “display as” or “Assumed suppressed output” that you might want to look at. Ultimately the first few lines of code in this worksheet (above) are by far the most powerful. And we just want it to look pretty.
MatrixForm[A.B]

1
0
0
2
0
0

MatrixForm[A+2B]
Matrix Form, Full Form, and scary red messages. First of all there is no issue with having the Wolfram Kernel sending this message to the screen. To the student, these messages are good to read, trace back, and “see” what the computer argument is. This software (Wolfram) even provides extensive info on the syntax error that can really accelerate the learning curve. The A and B matrices above can be changed by point and click, entering whatever numbers, then Evaluate the Notebook, and observe and investigate the changes ( and error messages) throughout. Another mention is that coding these lines is not like in English (language) class. We speak in fractured, changing sentences that start within the construct and jump around a bit. Like moving a verb into the subject and a noun to the predicate. In plotting on Wolfram this is called Show[Show[Show[Plot. We need to move the active parts of the message from the construct and sometimes use it repeatedly in a Headline. And in Calculus Notebooks the Wolfram user becomes challenged just to keep Manipulate[ from appearing more than one time [ [ [ . . . in front of all those Shows[ [ [. Get used to the idea of copying output, pasting it into a code line, but then seeing that you must have the correctly matching Form. And feel free to go around and around in that circle all day long on this worksheet just by putting the Form you want the matrix interpreted and read as in front of the line above (so to speak). A List of Lists, or an Array. But please be also careful to keep the thing intact (not changing too much) for the next user to explore. I am one.
Thread
:Objects of unequal length in {1,0}+{2,0,0} cannot be combined.
Thread
:Objects of unequal length in {2,1}+{0,0,0} cannot be combined.
{1,0}+{2,0,0}
{2,1}+{0,0,0}
Mentioned above was the ridiculous fact that one must hold down the control key and push comma. Equally insane to users of multiple other programs is that the use of the asterick * for multiplication must be a period in Mathematica. This is not A * B (asterisk) but Dot . (period) A.B. Be careful the order as A x B does not equal B x A in matrix algebra. All of this can be fixed by using the Mathematica Pallets drop down menu, building the matrix (even the numbers) using the mouse and your finger like drawing a picture. Try it! This is easier on Mathcad. But although structuring a line of code that reads from left to right and returns only the numerical answer seems in vain, it is not. We are without a classroom full of erase boards filed with squares of arithmetic problems,which seems like watching paint dry, or was worse the other way around? You must be able to think and speak this stuff in code.
MatrixForm[A.B]

1
0
0
2
0
0

MatrixForm[Transpose[A]]

1
2
0
1

Use escape transpose and close bracket or use Transpose command . . .
MatrixForm[A]

1
2
0
1

MatrixForm[(A.B)]
1
2
0
0
0
0
MatrixForm[B.A]
1
2
0
0
0
0
For no apparent reason we quickly explore the many options available options in Wolfram Mathematica. And in doing so, purposing ourselves to exactly match textbook problems, as they appear on paper, quickly to life on the screen. So we can “SEE” the answer first. Your welcome. There is a Random Integer command that allows the exploration of high order mathematics in matrices large and complex enough to exhaust the computational power of your laptop. The trick here is to look at the sentences (lines of code) in a conservative and critical way and see that you can say it softly and people listen just the same.
MatrixForm[IdentityMatrix[8]]
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
MatrixForm[DiagonalMatrix[{1,2,3,4,5,6,7,8}]]
1
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
4
0
0
0
0
0
0
0
0
5
0
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
0
7
0
0
0
0
0
0
0
0
8
MatrixForm[ConstantArray[0,{8,8}]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
A=FullForm[{{1,2},{3,4}}]
List[List[1,2],List[3,4]]
MatrixForm[A]
List[List[1,2],List[3,4]]
A={{1,2},{3,4}}
{{1,2},{3,4}}
Trans=Transpose[A]
{{1,3},{2,4}}
Det[A]
-2
Inv=Inverse[A]
{-2,1},
3
2
,-
1
2

Inverse[Inv=Inverse[A]]
{{1,2},{3,4}}
A.Inv
{{1,0},{0,1}}
MatrixForm[{{1,0},{0,1}}]

1
0
0
1

Eigenvalues[A]

1
2
(5+
33
),
1
2
(5-
33
)
Eigenvectors[A]​​

1
6
(-3+
33
),1,
1
6
(-3-
33
),1
Pretty advanced stuff. Notate the one’s. This “Eigen” value can be played in motion by the most accomplished mathematicians on this software. In a 3 x 3 this would be a unit sphere. Here it is the Unit circle and those daunting coordinates are the lengths, or the mighty “hypotenuse” that define the trinity. With this calculation we are pounding three lines / planes into their original power and magnitude, and properly vectored. It is truly a visual picture worth seeing. Google it!
MatrixForm
1
6
-3+
33
,1,
1
6
-3-
33
,1
1
6
(-3+
33
)
1
1
6
(-3-
33
)
1
Now we explore computer language by assigning small case variables to the i and j elements instead of numbers. This will enable us to exactly match homework college linear algebra textbook problems right into the CAS and get a wealth of ready prepared answers far beyond what the next homework problem was about to ask. Generally matrices are assigned upper case begging with A (remember a matrix is not a variable, it is an operation . . . even just sitting there holding still, a matrix is like a moving math equation. There is some but little convention in how to name things the elegant language of the machine. Upper case X and Y will do the encore today, and some like lower case near the end of the Alphabet or in the middle to describe variables (x,y,z) especially in algebra these letters reign. Please get out of the habit of using the letter t (lower case) in computer math and thank me latter. Looks too much like a plus sign. (p,q,r) are good letters seen allot in textbooks. And the use of X (that is “ex”) to define multiplication versus two objects sitting next to each other or above and below each other on these computer screens. This is called Hierarchy. It is a careful walked path that begins variable drift. These a,b,c,d, values will not calculate based on the real numbe values at the top of the screen. They are “local” (I hope) and not “Global”.This here I saw another mathematician do . . . including me.
a=4;​​b=3;
c=3;
d=2;
A=
a
b
c
d
;
Inv=Inverse[{{a,b},{c,d}}]
{{-2,3},{3,-4}}
Here we carefully choose a few names that will change colour as they are being typed (sometimes). But we all recognize this little pattern that finishes the picture. The only one we have in linear algebra really. “Ident” will be blue while you are typing, because Wolfram thinks you are going to use in the Identity [Matrix command. The same is true for Inv (which we choose to assign the Inverse.
To be clear, this entire exercise could begin all over again using the next two “sentences”. We now define the same two matrices we began with at the top of the screen (A and B), as a { {List } of { Lists}} named X and Y. Confirm this to be the case and class is over.
There is an explosion of understanding here that the mathematican wishes to speak. A quick 3 x 3 example of multiplication of matrices and by scalars are all immediately here. Do not underestimate the 2 x 2 square matrix named so perfectly A, and the “other” matrix B on this Notebook. A university student will never be asked to solve a rank and order matrix with crayons like the one we looked at here; the 8 x 8. But they will use that same shape, argument, algorithm or “sentence” to to solve the beyond cognitive )much bigger than eight letters representing pieces of space and squares of eights. When typing this is we should type X = { } and getting little black box with green flashing cursor. Then X = {{} {}} why a comma does not appear and neither do the familiar [Brackets] Is challenging. It is tempting to think X= [{a,b} , {c,d}] “list of lists”. You need to do this now and speak it in a sentence as fast as you can. Type in problem number . . . oh lets say # 26 (asks you to multiply two 3 x 2 matrices) in your Linear Algebra text. Bring the movie to the screen, watch it, “solve” it by many orders of magnitude, and move on to the next “problem”.