reserve a,a1,a2,a3,b,b1,b2,b3,r,s,t,u for Real;
reserve n for Nat;
reserve x0,x,x1,x2,x3,y0,y,y1,y2,y3 for Element of REAL n;

theorem Th43:
  for x1,x2,y1 being Element of REAL n ex y2 being Element of REAL
  n st y2 in Line(x1,x2) & x1-x2,y1-y2 are_orthogonal
proof
  let x1,x2,y1 being Element of REAL n;
  now
    per cases;
    case
A1:   x1<>x2;
      set mu = - |(x1-x2,y1-x1)|/|.x1-x2.|^2;
      set y2 = (1-mu)*x1 + mu*x2;
      |.x1-x2.|<>0 by A1,Lm1;
      then
A2:   |.x1-x2.|^2 <> 0 by SQUARE_1:12;
      |(x1-x2,y1-y2)| = |(x1-x2,y1 - (1 + -mu)*x1 - mu*x2)| by RVSUM_1:39
        .= |(x1-x2,y1 - (1 *x1 + (-mu)*x1) - mu*x2)| by EUCLID_4:7
        .= |(x1-x2,y1-1 *x1-(-mu)*x1-mu*x2)| by RVSUM_1:39
        .= |(x1-x2,(y1-x1)-(-mu)*x1-mu*x2)| by EUCLID_4:3
        .= |(x1-x2,(y1-x1)-((-mu)*x1+mu*x2))| by RVSUM_1:39
        .= |(x1-x2,(y1-x1)-((-mu)*x1+ (-(-mu)*x2)))| by Th3
        .= |(x1-x2,(y1-x1)-((-mu)*x1+ (-mu)*(-x2)))| by Th3
        .= |(x1-x2,(y1-x1)-(-mu)*(x1 -x2))| by EUCLID_4:6
        .= |(x1-x2,y1-x1)| - |(x1-x2,(-mu)*(x1-x2))| by EUCLID_4:26
        .= |(x1-x2,y1-x1)| - (-mu)*|(x1-x2,x1-x2)| by EUCLID_4:21
        .= |(x1-x2,y1-x1)| + mu*|(x1-x2,x1-x2)|
        .= |(x1-x2,y1-x1)| + mu*|.x1-x2.|^2 by EUCLID_2:4
        .= |(x1-x2,y1-x1)| + (- |(x1-x2,y1-x1)|)/|.x1-x2.|^2*|.x1-x2.|^2 by
XCMPLX_1:187
        .= |(x1-x2,y1-x1)| + (- |(x1-x2,y1-x1)|) by A2,XCMPLX_1:87
        .= 0;
      hence y2 in Line(x1,x2) & x1-x2,y1-y2 are_orthogonal by RVSUM_1:def 17;
    end;
    case
A3:   x1=x2;
      let mu be Real;
      set y2 = (1-mu)*x1 + mu*x2;
      take y2;
      x1 - x2 = 0*n by A3,Th2;
      then |(x1-x2,y1-y2)| = 0 by EUCLID_4:18;
      hence y2 in Line(x1,x2) & x1-x2,y1-y2 are_orthogonal by RVSUM_1:def 17;
    end;
  end;
  hence thesis;
end;
