f(x) = x² + 2x + 1
f(x + h) = (x + h)² + 2(x + h) + 1
f(x + h) = (x + h)(x + h) + 2(x) + 2(h) + 1
f(x + h) = (x(x + h) + h(x + h)) + 2x + 2h + 1
f(x + h) = (x(x) + x(h) + h(x) + h(h)) + 2x + 2h + 1
f(x + h) = (x² + hx + hx + h²) + 2x + 2h + 1
f(x + h) = (x² + 2hx + h²) + 2x + 2h + 1
f(x + h) = x² + 2x + 2hx + h² + 2h + 1