Derivation check of a parabolic trajectory problem The problem is from Morin's blue book. He tells to not solve quantitatively from scratch, but I don't really see the point in not doing so, thus I went ahead and tried to do it. This question isn't really about physics but rather what I did wrong in my proof.

A wall has height $h$ and is a distance $\ell$ away. You wish to throw a ball over the wall with a trajectory such that the ball barely clears the wall at the top of its parabolic motion. What initial speed is required?

The given answer is $\sqrt{2gh+g\ell^2/2h}$, but my answer of $\sqrt{2gh+2g\ell^2/h}$ is kind of close but a little bit off. My derivation is this: 
We know that $y_{max} = h = \frac{v_o^2sin^2\theta}{2g}$, so $v_o = \sqrt{\frac{2gh}{sin^2\theta}}$, where $v_o$ is the intial speed, and $\theta$ is this angle by which the ball is thrown, so $\theta = \arctan({\frac{h}{\ell}})$. It's well-known that $\sin(\arctan(x))=\frac{x}{\sqrt{1+x^2}}$, so $$\sin^2(\arctan(\frac{h}{\ell}))=\frac{h^2/\ell^2}{1+h^2/\ell^2}.$$
So, we have $$\frac{2gh}{sin^2\theta}=\frac{2gh}{\frac{h^2}{\ell^2}/(1+\frac{h^2}{\ell^2})}=\frac{2gh+2gh^3/\ell^2}{h^2/\ell^2}=\frac{2gh\ell^2+2gh^3}{h^2}=2g\ell^2/h+2gh,$$
Therefore $$v_o=\sqrt{2gh+2g\ell^2/h}.$$
I would look at the solution, but the solution does not solve the problem "from scratch", instead it looks at special cases of choosing $h \rightarrow 0$ and $\ell \rightarrow 0$ limits. Where did I go wrong in my proof? I've checked my initial projectile motion equations and they're correct.
 A: Your approach is incorrect from the point that you say that $\theta = \arctan(h/\ell)$.  Here's a derivation you might like, though.
The $y$-component of the velocity must satisfy $h = \frac{v_y^2}{2g} \implies v_y = \sqrt{2gh}$.  We must now choose an $x$-component $v_x$ such that the total horizontal distance traveled is $\ell$. The time required for the ball to reach the top of its arc will be given by $h = \frac 12gt^2 \implies t = \sqrt{2h/g}$.  Thus, $v_x$ must satisfy $v_x = \ell/t = \ell  \sqrt{\frac{g}{2h}}$.
Now, calculate the speed as $\|v\| = \sqrt{v_x^2 + v_y^2}$.
A: 
$\theta = \arctan({\frac{h}{\ell}})$.

Your mistake is this. For the ball to clear the wall, due to gravity, a bigger projection angle than this is required.

We know that $$h=y_\text{max} = \frac{v_o^2\sin^2\theta}{2g}\tag1,$$ where $v_o$ is the intial speed, and $\theta$ is this angle by which the ball is thrown

Yes, and another standard projectile-motion equation gives $$l=x_{y_\text{max}}=\frac{v_0^2\sin(2\theta)}{2g}.\tag2$$
From $(1):$ $$\sin\theta=\frac{\sqrt{2gh}}{v_0}\\
\cos\theta=\frac{\sqrt{v_0^2-2gh}}{v_0}.$$
Substituting into $(2):$ $$2gl=v_0^2 \times2\left(\frac{\sqrt{2gh}}{v_0}\right)\left(\frac{\sqrt{v_0^2-2gh}}{v_0}\right)\\v_0=\sqrt{2gh+\frac{gl^2}{2h}}.$$
