How do derivative masks work for finding edges in image?

but I don't get it why they can detect edges and which one of them can find vertical edges and which one can find harizontal edges?

The results will be, on the $6$ central points for each: