MASTERSHEET
Copy/Paste Formulae for Chapter 4 Matrices

>Copy the formula you need
>Paste it into the other workbook you are using
>Type into the pink boxes as instructed in your other workbook
>NOTE: Do NOT alter the formulae in this workbook, these are your templates only.

1. The Basics of a Matrix

Three ways to write Matrices

Method 1

{{"row 1 elements"},{"row 2 elements"}}//MatrixForm

{{a,b,c}, {d,e,f}}//MatrixForm

Method 2

Top tool bar: Insert > Table/Matrix >New... >Create Matrix with row numbers and column numbers, for example 3X3, then fill elements in your new Matrix:

(({{\[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder], \[Placeholder]}}))

Method 3

Top tool bar: Palettes  > Basic Math Assistant > Basic Commands

Define a matrix with an upper case letter

Examples:

A=(({{a, b, c}, {d, e, f}}))

B=(({{1, 0, -7, 2}, {5, 5, 5, 5}, {-4, 3, 2, 0}}))

F=(({{2, 4}, {1, 7}}))

2.  Adding,  subtracting & Transposing matrices Scalar multiplication

a. Adding Matrices

"matrix 1"+"matrix 2"//MatrixForm

F+(({{1, 2}, {3, 4}}))//MatrixForm

b. Subtracting Matrices

"matrix 1"-"matrix 2"//MatrixForm

F-(({{1, 2}, {3, 4}}))//MatrixForm

c. Scalar Multiple

"scalar number"×"matrix"//MatrixForm

3A//MatrixForm

3F//MatrixForm

d. Transposing Matrix

Transpose["matrix"]//MatrixForm

Transpose[(({{1, 2}, {3, 4}}))]//MatrixForm

3.  Matrices Multiplication Power

a. Multiplication

"matrix 1"."matrix 2"//MatrixForm

(({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}})).(({{2, 3, 4}, {3, 4, 5}, {5, 6, 7}}))//MatrixForm

G=(({{1, 2}, {3, 4}}))

L=(({{1, 1, 2}, {0, 3, 1}}))

G.L//MatrixForm

(({{2, 0}, {0, 3}})).(({{-7}, {9}}))//MatrixForm

b. Powers

MatrixPower["matrix","powers"]//MatrixForm

Example 1: (G^3)

MatrixPower[G,3]//MatrixForm

4.  Identity, inverse matrices & Determinant of a Matrix

a. Identity Matrix

IdentityMatrix["row or column numbers"]

IdentityMatrix[3]

b. Inverse Matrix

Inverse["matrix"]//MatrixForm

Inverse[(({{1, 2}, {3, 4}}))]//MatrixForm

c. Complicated Inverse Calculation

mA="the 1st matrix know";
mB="the 2nd matrix know";
mC="the 3rd matrix know";
mD="the 4th matrix know";
Inverse["Calculation inside INVERSE brackets"]//MatrixForm

mA=(({{3, -1}, {4, 5}}));
mB=(({{-7, 2}, {3, 1}}));
mC=(({{-4, 9}, {6, 8}}));
mD=(({{0, 8}, {4, -1}}));
(mA.mB+Inverse[mD])//MatrixForm

d. Determinant of a Matrix

determinant[det_,x_]:=Det["matrix"]//N
NSolve[determinant["the value of Determinant","the unknown letter, if a matrix given, just type any number in matrix here"]=="the value of Determinant",Reals]

determinant[det_,x_]:=Det[(({{1, 2}, {m, 4}}))]//N
NSolve[determinant[0,m]==0,Reals]

5.  Solving simultaneous equations using matrices

a. LinearSolve: Determinant = 0 means no solution or non-unique solutions

LinearSolve["Left side of standard equations - coefficient matrix","Right side of standard equations - constant matrix"]//MatrixForm

LinearSolve[(({{2, 3}, {1, -2}})),(({{6}, {4}}))]//MatrixForm//N

b. Alternatively

Solve[{equation here number one,another equation here},{variable1,variable2}]

Solve[{2x+3y==6,x-2y==4},{x,y}]//N

c. Given Matrices, write Equations

eqns=Thread["Left side of standard equations - coefficient matrix"."unknown matrix"=="Right side of standard equations - constant matrix"]

eqns=Thread[(({{1, 1, 1}, {1, 0, 1}, {0, 1, 1}})).(({{x}, {y}, {z}}))==(({{6}, {4}, {5}}))]

d. Given Equations, write Matrices

l={"Write all equations here, separate by comma, each equation needs two == signs"};
lm=CoefficientArrays[l,{"Write all unknown letters here, separate by comma,"}][[2]]//MatrixForm
Print[Normal[lm],{"Write all unknown letters here, separate by comma,"}//MatrixForm, "= Write right side of the equations constant numbers in a column matrix here"]

l={x-y-z==0,x+2 y+z==1,x+2y+5z==5};
lm=CoefficientArrays[l,{x,y,z}][[2]]//MatrixForm
Print[Normal[lm],{x,y,z}//MatrixForm, "= Write right side of the equations constant numbers in a column matrix here"]

(({{1, -1, -1}, {1, 2, 1}, {1, 2, 5}}))(({{x}, {y}, {z}}))= (({{0}, {1}, {5}}))

6.  Solving equations for matrices

mA="the 1st matrix know";
mB="the 2nd matrix know";
mX=Array[X,{"the row number of unknow","the column number of unknow"}]
Solve["left side of the equation"=="right side of the equation",Flatten[mX]]

mA=(({{2, 1, 3}, {1, 2, 1}, {2, 2, 2}}));
mB=(({{3, 2}, {4, 3}}));
mC=(({{-6, -1}, {5, 6}}));
mD=(({{3}, {4}}));
mE=(({{5}, {7}, {9}}));
mX=Array[X,{2,1}]
Solve[mB.mX+(({{7}, {6}}))==mD,Flatten[mX]]

mX=(({{-8}, {10}}))

7.  Recurrence tables of Matrices from the first Matrix/ Transition Matrices

lindiff[n_]:= "Transition Matrix".n 
NestList[lindiff,"Initial Matrix","How many more Matrices"]//MatrixForm//N

lindiff[n_]:= (({{0.7, 0.2, 0.1}, {0.1, 0.5, 0.4}, {0.2, 0.3, 0.5}})).n 
NestList[lindiff,(({{1100}, {1200}, {1300}})),3]//MatrixForm//N

8.  Matrices Multiplication Step by step with working out

nA=oA="the 1st matrix know";
nB=oB="the 2nd matrix know";
step1=MatrixForm[Inner[Inactive[Times],"the first matrix for multiplication e.g. nA","the first matrix for multiplication e.g. nB",Inactive[Plus]],TableSpacing->{3,3}]
step2=Activate[step1,Times]
Activate[step2]

nC=oC=(({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}));
step1=MatrixForm[Inner[Inactive[Times],nC,nC,Inactive[Plus]],TableSpacing->{3,3}]
step2=Activate[step1,Times]
Activate[step2]