kill(all);

van=facebook.com/LearningCalulus;

square(x):=x^2;

Y(X):=(((A[y]+((X+-A[x]))^(2)))^(1/2)+(((B[y])^(2)+((B[x]-X))^(2)))^(1/2));

diff(Y(X),X);

first(%)=-second(%);

%^2;

solve(%,X);

Y((A[x]*B[y]^2+(B[x]-A[x])*sqrt(A[y])*B[y]-B[x]*A[y])/(B[y]^2-A[y]));

Y(-(-A[x]*B[y]^2+(B[x]-A[x])*sqrt(A[y])*B[y]+B[x]*A[y])/(B[y]^2-A[y]));