added diff function

Tested on vectors of length 2 and 1.