Rates of change related to right triangles