The average cost function is the straight line connecting the two endpoints of the interval 0<q<8, which are (0,0) and (8,32). The slope of the line is (32-0)/(8-0) = 4. The y-intercept is 0 since one of the points on the line is (0,0). So the equation of the average cost function is Caverage(q) = 4q.
To find the minimum cost, take the derivative of C(q) wrt q, set it to zero, and solve for q:
C(q) = q3 - 12q2 + 36q
C'(q) = 3q2 - 24q + 36
0 = 3q2 - 24q + 36
0 = q2 - 8q + 12 (divided both sides by 3)
0 = (q-2)(q-6)
So there are two extreme points, one at q = 2 and one at q = 6. One point will be the maximum cost, the other the minimum cost. To find which is which, you can either plug q=2 and q=6 into C(q) and see which is smaller; the q value that gives th4e smaller C(q) corresponds to the minimum cost. Or you can take the second derivative of C(q) then plug q = 2 and q = 6 into the second derivative. The value that gives you a positive value for the second derivative corresponds to the minimum cost.