reserve x,y for object,
  N for Element of NAT,
  c,i,j,k,m,n for Nat,
  D for non empty set,
  s for Element of 2Set Seg (n+2),
  p for Element of Permutations(n) ,
  p1, q1 for Element of Permutations(n+1),
  p2 for Element of Permutations(n +2),
  K for Field,
  a for Element of K,
  f for FinSequence of K,
  A for (Matrix of K),
  AD for Matrix of n,m,D,
  pD for FinSequence of D,
  M for Matrix of n,K;

theorem Th38:
  for A be Matrix of n,K st Det A <> 0.K for x,b be Matrix of K st
width x = n & x * A = b holds x = b * A~ & for i,j st [i,j] in Indices x holds
  x*(i,j) = (Det A)" * Det ReplaceLine(A,j,Line(b,i))
proof
  let A be Matrix of n,K such that
A1: Det A <> 0.K;
  A is invertible by A1,Th34;
  then A~ is_reverse_of A by MATRIX_6:def 4;
  then
A2: A*A~=1.(K,n) by MATRIX_6:def 2;
A3: width A=n by MATRIX_0:24;
  let x,b be Matrix of K such that
A4: width x = n and
A5: x * A = b;
A6: len A=n by MATRIX_0:24;
  then
A7: width b=n by A4,A5,A3,MATRIX_3:def 4;
  set MC=Matrix_of_Cofactor A;
  set D=Det A;
A8: len (MC@)=n by MATRIX_0:24;
A9: width (MC@)=n by MATRIX_0:24;
  len MC=n by MATRIX_0:24;
  then
A10: Seg n=dom MC by FINSEQ_1:def 3;
A11: len (A~)=n by MATRIX_0:24;
  x = x* 1.(K,n) by A4,MATRIXR2:67;
  hence
A12: x= b * A~ by A4,A5,A11,A6,A3,A2,MATRIX_3:33;
  let i,j such that
A13: [i,j] in Indices x;
A14: j in Seg n by A4,A13,ZFMISC_1:87;
  then
A15: 1<=j by FINSEQ_1:1;
A16: len Line(b,i)=n by A7,MATRIX_0:def 7;
A17: j<= n by A14,FINSEQ_1:1;
  thus x*(i,j) = Line(b,i)"*"Col(A~,j) by A11,A12,A13,A7,MATRIX_3:def 4
    .= Line(b,i)"*"Col(D" * MC@,j) by A1,Th35
    .= Line(b,i)"*"(D"*Col(MC@,j)) by A9,A15,A17,MATRIXR1:19
    .= (D"*Col(MC@,j))"*"Line(b,i) by FVSUM_1:90
    .= Sum(D"*mlt(Col(MC@,j),Line(b,i))) by A8,A7,FVSUM_1:69
    .= D"*(Col(MC@,j)"*"Line(b,i)) by FVSUM_1:73
    .= D"*(Line(MC,j)"*"Line(b,i)) by A14,A10,MATRIX_0:58
    .= D"*Sum(LaplaceExpL(RLine(A,j,Line(b,i)),j)) by A14,A16,Th28
    .= D"*Det RLine(A,j,Line(b,i)) by A14,Th25;
end;
