function [r_x,r_y,s_x,s_y,J] = GeometricFactors2D(x,y,D_r,D_s)

% compute the metric elements for the local mappings of the elements

x_r = D_r * x; x_s = D_s * x; y_r = D_r * y; y_s = D_s * y;
J = x_r .* y_s - x_s .* y_r;
r_x = y_s ./ J; r_y = -x_s ./ J; s_x = -y_r ./ J; s_y = x_r ./ J;

end