kill(all);

van=facebook.com/LearningCalculus$

eqn: M*dx + N*dy    = 0;
     M    + N*dy/dx = 0;

M:x+y-2$
N:x-y+4$

diff(M,y);
diff(N,x);

      So differential equation is exact.

%phi(x,y):= ''(integrate(M,x)+h(y));

diff(%phi(x,y),y)=N;

diff(h(y),y)=4-y;

h(y)=integrate(4-y,y);

%Phi(x,y):= ''(substitute(4*y-y^2/2,h(y),%phi(x,y)))+C;

diff(%Phi(x,y),x);
diff(%Phi(x,y),y);

f(x,y)=-M/N;