1)   Consider the following matrices: 
A = (2 3 1                        
       3 3 1 
       2 4 1);
       
 B = (2 0 0
       1 - 4 8 
       1 - 1 2);
       
a)  Enter the matrices in Mathematica
b)  Compute the matrix  W = 3A - 4B and display it in matrix form; Compute also AB and BA.
c) Extract from W: 
  	- the entry in row 2 and column 1
  	- the second row
  	- the third column
  	- the submatrix obtained by deleting row 1 and column 3 
 d) Generate a  3x3 random matrix whose entries are numbers between 0 and 1.
  Generate a 5x4 random matrix whose entries are  integers -9 and 9
  e) For the matrix A  find the inverse  A^(-1) and show that A A^(-1) =I,where I is the identity matrix.

a)  Enter the matrices in Mathematica

A={{2,3,1},
{3,3,1},
{2,4,1}};
MatrixForm[A]

B={{2,0,0},
{       1, - 4, 8 },
{       1, - 1, 2}};
MatrixForm[B]

b)  Compute the matrix  W = 3 A - 4 B and display it in matrix form; Compute also AB and BA.

W=3A-4B;MatrixForm[W]

dAB=Dot[A, B];
MatrixForm[dAB]

dBA=Dot[B, A];
MatrixForm[dBA]

dAB==dBA

c) Extract from W : 
    	- the entry in row 2 and column 1
  	- the second row
  	- the third column
  	- the submatrix obtained by deleting row 1 and column 3

W[[2,1]]

W[[2]]

WT=Transpose[W];
WT[[3]]

subW=W[[{2,3},{1,2}]];
MatrixForm[subW]

d) Generate a  3 x3 random matrix whose entries are numbers between 0 and 1.
  Generate a 5 x4 random matrix whose entries are  integers - 9 and 9

tt=Table[Random[],{3},{3}]

tti=Table[
Random[Integer,{9,-9}],
{5},
{4}
]

e) For the matrix A  find the inverse  A^(-1) and show that A A^(-1) = I, where I is the identity matrix.

AI = Inverse[A];
MatrixForm[AI]

Id = IdentityMatrix[3];MatrixForm[Id]

A.AI == Id

AI.A == Id

(***************************)

2)
Let A be the matrix given by 

A = (2 1 -3 
       0  4  5 
       -1 3  2)
              
a) Find Det (A)
b) Show that Det (A^T) = Det (A), where A^T is the transpose of A
c) Verify that Det (2 A) = 2^3 Det (A)      
d) Let A1 be the matrix that is obtained by interchanging rows 1 and 2 of A.
Show that Det (A1) = -Det (A)
e) Let A2 be the matrix that is obtained from A  by replacing the third row of A2 by the sum of row 3 and 5 times row 1. Show that Det (A2) = Det (A).

Clear[A]

A = {{2,1,-3},{0,4,5},{-1,3,2}};
MatrixForm[A]

MatrixRank[A]

a) Find Det (A)

da=Det[A]

b) Show that Det (A^T) = Det (A), where A^T is the transpose of A

Det[Transpose[A]]==da

c) Verify that Det (2 A) = 2^3 Det (A)

Det[2A]==2^3da

d) Let A1 be the matrix that is obtained by interchanging rows 1 and 2 of A.
Show that Det (A1) = -Det (A)

A1=A[[{2,1,3}]];
MatrixForm[A1]

Det[A1]==-da

e) Let A2 be the matrix that is obtained from A  by replacing the third row of A2 by the sum of row 3 and 5 times row 1. 
Show that Det (A2) = Det (A).

A2=A;
A2[[3]] = 5A[[1]]+A[[3]];
MatrixForm[A2]

Det[A2] == da

(***************************)

3) Solve the following system of equations:

(Subscript[x, 1]) + 2 (Subscript[x, 2])+ 3(Subscript[x, 3]) + 4 (Subscript[x, 4]) = 1
2(Subscript[x, 1]) + 3 (Subscript[x, 2])+ 4(Subscript[x, 3])= 1
3(Subscript[x, 1]) + 4 (Subscript[x, 2]) = 1
4(Subscript[x, 1]) = 1

Hint: see LinearSolve

?LinearSolve

mat={{1,2,3,4},{2,3,4,0},{3,4,0,0},{4,0,0,0}};
unknown={x1,x2,x3,x4};
vect=Table[1,{Length[unknown]}];
Map[MatrixForm,{mat,unknown,vect}]
Map[TableForm,{mat . unknown ,vect}]

mat={{1,2,3,4},{2,3,4,0},{3,4,0,0},{4,0,0,0}};
Dimensions[mat]
vect=Table[1,{Dimensions[mat][[1]]}];Map[MatrixForm,{mat,vect}]

sol=LinearSolve[mat,vect];
MatrixForm[sol]
MatrixForm[N[sol]]
MatrixForm[N[sol,30]]

mat .sol==vect