For
, differentiate with respect to x first, then with respect to y. Remember, when you differentiate with respect x, you pretend all other variables are constants. And when you differentiate with respect to y, you pretend all other variables are constants.
By the chain rule:
By the product rule:
Now carry out the differentiation, remembering to use the product rule again on the 2nd term.
Now do the same again, only change the order of differentiation. Wrt y first, then wrt x. See if you get the same result.
In general
if the function is sufficiently smooth.