f(x)=x2+2x-7
So, f(x+h)=(x+h)2+2(x+h)-7 = x2 + 2hx + h2 + 2x + 2h - 7 = (x2 + 2x - 7) + h2 + 2h + 2hx.
Note that f(x)=x2+2x-7 so, you can write f(x+h) = f(x)+ h(h + 2 + 2x).
So, subtracting f(x) from each side gives: f(x+h)-f(x) = h(h + 2 + 2x).
Dividing by h gives (f(x+h)-f(x))/h = 2x + h + 2.