reserve D for non empty set,
  i,j,k,l for Nat,
  n for Nat,
  x for set,
  a,b,c,r,r1,r2 for Real,
  p,q for FinSequence of REAL,
  MR,MR1 for Matrix of REAL;

theorem Th21:
  for p being non empty FinSequence of REAL for q being
  FinSequence of REAL for M being Matrix of REAL holds M = (ColVec2Mx p) * (
  LineVec2Mx q) iff (len M = len p & width M = len q & for i,j st [i,j] in
  Indices M holds M*(i,j) = p.i * q.j)
proof
  let p be non empty FinSequence of REAL;
  let q be FinSequence of REAL;
  let M be Matrix of REAL;
  set M1 = ColVec2Mx p;
  set M2 = LineVec2Mx q;
A1: len M1 = len p by MATRIXR1:def 9;
A2: len M2 = 1 by MATRIXR1:def 10;
A3: len p > 0;
  then
A4: width M1 = 1 by MATRIXR1:def 9;
A5: width M2 = len q by MATRIXR1:def 10;
  hereby
    assume
A6: M = M1 * M2;
    then
A7: len M = len M1 by A4,A2,MATRPROB:39;
    thus len M = len p & width M = len q by A1,A4,A2,A5,A6,MATRPROB:39;
A8: width M = width M2 by A4,A2,A6,MATRPROB:39;
    thus for i,j st [i,j] in Indices M holds M*(i,j) = p.i * q.j
    proof
      let i,j such that
A9:   [i,j] in Indices M;
A10:  i in Seg len M by A9,MATRPROB:12;
      then
A11:  i in dom p by A1,A7,FINSEQ_1:def 3;
      j in Seg width M by A9,MATRPROB:12;
      then
A12:  j in dom q by A5,A8,FINSEQ_1:def 3;
      i in dom M1 by A7,A10,FINSEQ_1:def 3;
      then
A13:  Line(M1,i) = M1.i by MATRIX_0:60
        .= <*p.i*> by A3,A11,MATRIXR1:def 9;
      thus M*(i,j) = Line(M1,i) "*" Col(M2,j) by A4,A2,A6,A9,MATRPROB:39
        .= <*p.i*> "*" <*q.j*> by A12,A13,Th20
        .= Sum mlt(<*p.i*>,<*q.j*>) by RVSUM_1:def 16
        .= Sum <*p.i * q.j*> by RVSUM_1:62
        .= p.i * q.j by RVSUM_1:73;
    end;
  end;
  assume that
A14: len M = len p and
A15: width M = len q and
A16: for i,j st [i,j] in Indices M holds M*(i,j) = p.i * q.j;
  for i,j st [i,j] in Indices M holds M*(i,j) = Line(M1,i) "*" Col(M2,j)
  proof
    let i,j such that
A17: [i,j] in Indices M;
    j in Seg width M by A17,MATRPROB:12;
    then
A18: j in dom q by A15,FINSEQ_1:def 3;
A19: i in Seg len M by A17,MATRPROB:12;
    then
A20: i in dom M1 by A1,A14,FINSEQ_1:def 3;
    i in dom p by A14,A19,FINSEQ_1:def 3;
    then
A21: <*p.i*> = M1.i by A3,MATRIXR1:def 9
      .= Line(M1,i) by A20,MATRIX_0:60;
    thus M*(i,j) = p.i * q.j by A16,A17
      .= Sum <*p.i * q.j*> by RVSUM_1:73
      .= Sum mlt(<*p.i*>,<*q.j*>) by RVSUM_1:62
      .= <*p.i*> "*" <*q.j*> by RVSUM_1:def 16
      .= Line(M1,i) "*" Col(M2,j) by A18,A21,Th20;
  end;
  hence thesis by A1,A4,A2,A5,A14,A15,MATRPROB:39;
end;
