JLSLDKSKDDODODKDKDMXMXMDMDDKD
The average value over the interval is the area under the curve divided by the width of the interval.
Area = 4*(6 -1) +5(8 -6) = 30
Width = 8 - 1 = 7
Average value = 30/7 = 4 2/7
When you get to the point where the width is larger than the length, you can stop because you have exhausted all the possibilities. The greatest area will be the rectangle that is closer in to a square than any of the others.
(8, 9) will be the midpoint of the segment.
You can find this by applying the formula
(x1 + x2)/2 , (y1 + y2)/2