(*Exercise 1*)
A={{1,2,1,0},{3,1,0,1}};
b={4,6};
X=Array[x,4];

A//MatrixForm

RowReduce[A]//MatrixForm

Solve[A.X==b]

subMatrix[A_,B_]:=A[[All,B]];

subMatrix[A,{1,2}]
subMatrix[A,{3,4}]
subMatrix[A,{1,3}]

v={2,0,2,0};
A.v==b

(*If v={2,0,2,0} is a basic feasible solution, then what is B=? *)
B={1,3} ;(*because v_j = 0 for all j not in B!*)
subMatrix[A,B]//MatrixForm

(*This matrix is invertible!*)

subMatrix[A,{3,4}]

A.{x1,x2,0,0}==b
Solve[A.{x1,x2,0,0}==b]

(*Exercise 2*)
subMatrix[A,{1,3}]//MatrixForm
subMatrix[A,{1,4}]//MatrixForm

(*Exercise 3*)

A={{1,2,1,0,0},{3,1,0,1,0},{1,0,0,0,1}};
b={4,6,2};
X=Array[x,5];

subMatrix[A,{3,4,5}]//MatrixForm

A.{x1,x2,x3,0,0}==b
Solve[A.{x1,x2,x3,0,0}==b]

subMatrix[A,{1,3,4}]//MatrixForm
Inverse[subMatrix[A,{1,3,4}]]//MatrixForm

Inverse[subMatrix[A,{1,3,4}]].A//MatrixForm
Inverse[subMatrix[A,{1,3,4}]].b//MatrixForm

(*Solution to LP is:*)
Minimize[-x1+x2,x1+2x2≤4&&3x1+x2≤6&&x1≤2&&x1≥0&&x2≥0,{x1,x2}]