Finding the derivative using slope