As you have used f(x) I am assuming you are using Calculus.
color(blue)("Short cut method")
By sight: "rate of change "-> (dy)/(dx)=2x
At x=0" "(dy)/(dx)=2(0)=0
At x=2" "(dy)/(dx)=2(2)=4
Thus the average rate of change is
(0+4)/2=2
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
color(blue)("From first principles")
Let " "y=x^2+2..........................(1)
Increment x" by the very small amount of "deltax
As x has change then y will change as well
Let the change in y" be "deltay
Now we have
y+deltay=(x+deltax)^2+2
y+deltay=x^2+2xdeltax+2.....................(2)
Subtract equation (1) from equation (2)
y+deltay=x^2+2xdeltax+2
underline(y" "=x^2" "+2) apply the subtraction
" "deltay = 0""+2xdeltax+0
Divide by deltax
(deltay)/(deltax)=2x xx(deltax)/(deltax)
but (deltax)/(deltax)=1
So
lim_(deltaxto0) (deltay)/(deltax)= (dx)/(dy)=2x
Then solve for average rate of change as above.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that lim_(deltaxto0) means consider the situation where
deltax gets so small it may as well be zero, but in reality it has not quite got there!