Minimize initial velocity of projectile to arbitrary point

I'm supposed to shoot a projectile from the origin to a point $(x_0 , y_0)$ with minimal initial velocity $v_0$. (no air resistance; regular gravity)

The flight time should be $T=\frac{x_0}{v_x}$. Plugging in to the equation for y, I get $$y_0=\frac{-g}{2}\frac{x_0^2}{v_x^2}+\frac{x_0v_y}{v_x}$$

Recalling that $v_x = v_0\cos{\theta}$ and $v_y = v_0\sin{\theta}$ and some algebra yields: $$v_0=\sqrt{\frac{gx_0^2}{2\cos^2{\theta}(x_0\tan{\theta}-y_0)}}$$

To minimize initial velocity, I figure I have to take $\frac{dv}{d\theta}$, set it to 0 and hope for a minimum. This is prohibitively complicated. Am I missing some intuition about how the components are independent of each other in finding the minimum velocity (maybe minimize $v_y$ separately)? $\theta=\frac{\pi}{2}$ seems to make $v_0$ the smallest (by blowing up the denominator), but that would be shooting the object straight up, which doesn't make sense.

I think I got it. Just minimize $\frac{d(v_0^2)}{d\theta}$. That is: $$\frac{d}{d\theta} \frac{gx_0^2}{2\cos^2{\theta}(x_0\tan{\theta}-y_0)}=0$$
Set $a=gx_0/2$ and $b=y_0/x_0$ and you get: $$\frac{d}{d\theta} \frac{a}{\cos^2{\theta}(\tan{\theta}-b)}=\frac{-a\sec^4{\theta}(b\sin{2\theta}+\cos{2\theta})}{(b-\tan{\theta})^2}=0$$ $$-b=\cot{2\theta}$$ $$\theta = -\cot^{-1}{b} = -\cot^{-1}({\frac{y_0}{x_0}})$$