The formal definition of divergence I have seen is 
but I don’t understand how that is equivalent to the formula used to calculate divergence in Cartesian coardinates,

All the derivations I have seen used some hand waving and assumed that the limit for any 2 shapes give the same number. Does anyone have a formal derivation?