For implicit differentiation :

1.When differentiating a function of x do it normally d(sinx)/dx =cos(x)

2. when differentiating a function of differentiate with respect to y and multiply by dy/dx : d(sin(y)/dx = cos(y) dy/dx

for your problem:

xsin(x)-y^2=xy-4

sin(x) + xcos(x) -2ydy/dx = y + xdy/dx

Now solve for dy/dx:

sin(x) +xcos(x) - y = (2y +x) dy/dx

[sin(x) +xcos(x) - y ]/(2y+x) = dy/dx