The formula for the revenue as a function of units sold x per definition:
R(x)= x · (500 - 0.5x) = 500x - 0.5x2
Taking the first derivative equal to zero will result in linear equation with solution for x (re: finding the extreme of quadratic function):
500 - x = 0
thus the answer is:
x=500 (units sold)
Hope this will help.