TC=2Q^2+Q-500.5.
Average cost is 2(average of Q^2)+(average of Q)-500.5/Q.
Q=quantity, starting at 1, so average Q^2=(1+4+9+16+...+Q^2)/Q=(2Q^3+3Q^2+Q)/6Q=(2Q^2+3Q+1)/6, because the sum of the natural squares up to n is (2n^3+3n^2+n)/6.
Average of Q is Q(Q+1)/2Q=(Q+1)/2, so average cost is (2Q^2+3Q+1)/3+(Q+1)/2-500.5/Q.
This reduces to (4Q^3+9Q^2+5Q-500.5)/6Q.