The range is the horizontal distance traveled before the projectile hits the ground.

The distance covered in the x-direction is simply:

x = v_{ox} t

To find the range, use t as the time of flight, which we just calculated to be:

t = 2 v_{o} sin(q) / g

Plugging in v_{ox} = v_{o} cos(q) gives:

x = 2 v_{o}^{2} sin(q) cos(q) / g

Using the trig. identity 2 sin(q) cos(q) = sin(2q) this can be written as:

x = v_{o}^{2} sin(2q) / g