Initial velocity vector: $\vec{u} = u \cos \theta \hat{i} + u \sin \theta \hat{j}$. Velocity at time $t$: $\vec{v} = u \cos \theta \hat{i} + (u \sin \theta - gt) \hat{j}$. For the motion to be perpendicular, the dot product $\vec{u} \cdot \vec{v} = 0$: $$(u \cos \theta)(u \cos \theta) + (u \sin \theta)(u \sin \theta - gt) = 0$$ $$u^2 \cos^2 \theta + u^2 \sin^2 \theta - ugt \sin \theta = 0$$ Since $\cos^2 \theta + \sin^2 \theta = 1$: $$u^2 - ugt \sin \theta = 0$$ $$u = gt \sin \theta$$ $$t = \frac{u}{g \sin \theta}$$ This time $t$ is when the velocity vector makes an angle of $(90+\theta)$