This applet lets you investigate the gradient of a straight line,
or gradient of the tangent at a point on a curve of a function.
The rate of change of y with respect to x between two points
is the change in y divided by the change in x ie.
For the straight line you will note that the gradient is constant throughout the line, between points P & Q.
For the curve, gradient of a point C between points P & Q changes (vary) as the point C is moved.
The "average gradient" is the gradient of a straight line joining P & Q.
The instantaneous rate of change at P, is the gradient (rate of change)at which the change in x is made very very small
(ie by moving point Q towards P)

Observe the gradient of a straight line.
Click on the relevant checkboxes and move point Q by dragging with mouse cursor (left button pressed down)
1. Is the gradient constant along the line between P & Q?
Use the curved function graph instead of the straight line (Select the relevant checkbox)
2. Is the gradient constant along the line between P & Q
Click on the instantaneous rate of change checkbox and move point Q (or C) and see how the instantaneous rate of change at a point
is related to the gradient of curve at a point.