What is minimum speed needed to throw object over a wall that height h and at distance d? (I am not expert in English. I will write as well as I can.)
I ask this question because I want to solve
(What is minimum speed needed to jump over sphere object that has radius R and at distance d?)
But I think I have to this question before. This question is like that question but condition to find u minimum is less complex.
If I know how to solve this question, I may be able to solve that question.
To understand this question easier, lets see this picture.

From this picture, what is minimum initial speed to throw red ball over this blue wall?
(assume red ball is very small and throw form h=0 and blue wall is very thin)
d and h can be any positive real number. g is a gravitational acceleration(approximately 9.80665 $m/s^2$).
This is a mathematical-physics question but mainly in maths.
I can do physics part but have problem in maths part.
Physics Part : Let red ball in all pictures is at origin point and y is height

The relation between x and y for projectile motion is $y(x) = xtan\theta - \frac{gx^2}{2u^2cos^2\theta}$ , $0 < \theta < \frac{\pi}{2}$
Condition of the wall is $y(d) \geq h$ but for $u_{min}$, $y(d) = h$
$dtan\theta - \frac{gd^2}{2u^2cos^2\theta} = h$
$tan\theta - \frac{gd}{2u^2cos^2\theta} = \frac{h}{d}$
$\frac{gd}{2u^2cos^2\theta} = tan\theta - \frac{h}{d}$
$\frac{1}{u^2} = \frac{2cos^2\theta}{gd}( tan\theta - \frac{h}{d} )$
$u = \sqrt{ \frac{gd}{2cos^2\theta( tan\theta - \frac{h}{d} )} }$
At this point, I don't how to find $u_{min}(d,h)$ from this equation.
(If you give value of d and h (for example, d = 2m and h = 1m), it is possible to find $\theta$ that minimize u.)
I know only that y(x) (parabola curve) for $u_{min}(d,h)$ look like.
Case : d $\leq$ ch (c is a constant. There is a ratio that if d > ch , y(x) won't have maximun point at the top of the wall.)

Case : d > c*h

Please help me.
 A: Substituting $(d,h)$ into the standard projectile trajectory equation gives
$$\begin{align}h&=d\tan\theta-\frac {gd^2}{2u^2\cos^2\theta}\\
u^2&=\frac {gd^2}{2\cos^2\theta(d\tan\theta-h)}\\
&=\frac {gd^2}{2(d\sin\theta\cos\theta-h\cos^2\theta)}\\
&=\frac {gd^2}{d\sin2\theta-h(1-\cos 2\theta)}\\
&=\frac {gd^2}{R(\frac dR\sin2\theta+\frac hR\cos 2\theta) -h}
&&\scriptsize(R=\sqrt{d^2+h^2})\\
&=\frac {g(R^2-h^2)}{R(\sin2\theta\cos\alpha+\cos 2\theta\sin\alpha) -h}
&&\scriptsize(\tan\alpha=h/d)\\
&=\frac {g(R^2-h^2)}{R(\underbrace{\sin(2\theta-\alpha))}_{<=1}-h}\\
{u^*}^2&=\frac {g(R^2-h^2)}{R-h}
&&\scriptsize (u^*=\text{minimum launch velocity})\\\
&=g(R+h)\\
&=\color{red}{g(\sqrt{d^2+h^2}+h)}
\end{align}$$
Note that launch velocity is at a minimum when $2\theta-\alpha=\frac\pi2$, i.e. when $\theta=\frac\pi 4+\frac\alpha 2$.
A: You've started just fine, but then lost the forest for the trees, I think. You want to maximize the function
$$f(\theta) = \sin(2\theta)-\frac{2h}d \cos^2\theta.$$
($f(\theta)$ gives a constant times the quantity $1/u^2$ needed to achieve height $h$ at horizontal distance $d$.)
Basic calculus tells you that this function has a unique critical point on $(0,\pi/2)$ and that it is the maximum point. That maximum occurs when
$$\tan(2\theta) = -\frac dh.$$
A: The last solutions is absolutely correct and complete, however, I would suggest a slightly different approach which would simplify the Math.
Instead of looking for a minimum of launch velocity $u$, one could solve for a maximum of the following (inverse) quantity: $C = g/u^2$,
$$C d^2= - h + h \cos (2 \theta) + d \sin(2 \theta)$$
$$C_{\max} d^2 = - h + \sqrt{h^2+d^2}$$
