So I was solving the following problem
https://physics.stackexchange.com/questions/237497/somewhat-unusual-projectile-motion-question
and the minimum velocity involves the projectile intersecting the top of both walls, but I can't seem to understand why this has to be the case for minimum launch speed. Perhaps there is a visually intuitive way of understanding this condition but I can't seem to catch on to one.
Any help?
Hint.
From the movement kinematics we can obtain
$$ h = h_0 + \frac{v_y}{v_x} x -\frac 12\frac{g}{v_x^2} x^2 $$
where $v_0 = \sqrt{v_x^2+v_y^2}$ is the initial velocity.
Considering the movement origin at the top of the first wall we have the problem
$$ \min_{v_x,v_y} \sqrt{v_x^2+v_y^2}\ \ \text{s. t.}\ \ \frac{v_y}{v_x}\Delta x -\frac 12\frac{g}{v_x^2}\Delta x^2 = \Delta h $$
with $\Delta x = x_2-x_1$. This problem is equivalent to
$$ \min_{v_x,v_y} \left(v_x^2+v_y^2\right)\ \ \text{s. t.}\ \ \frac{v_y}{v_x}\Delta x -\frac 12\frac{g}{v_x^2}\Delta x^2 = \Delta h $$
The lagrangian is
$$ L(v_x,v_y,\lambda) = \left(v_x^2+v_y^2\right)+\lambda\left(\frac{v_y}{v_x}\Delta x -\frac 12\frac{g}{v_x^2}\Delta x^2 - \Delta h\right) $$
The stationary points are the solutions for
$$ \nabla L = 0 = \left\{ \begin{array}{rcl} 2 v_x^4-\lambda \Delta x v_y v_x+g \lambda \Delta x^2&=&0 \\ \frac{\lambda \Delta x}{v_x}+2 v_y & = & 0\\ \Delta h+\frac{\Delta x \left(g \Delta x-2 v_x v_y\right)}{2 v_x^2} & = & 0\\ \end{array} \right. $$
This system can be easily solved. Note that $v_xv_y = -\frac 12\lambda\Delta x$ so the solution for $v_0$ is
$$ v_0^2 = \left(\Delta h + \sqrt{\Delta h^2+\Delta x^2}\right)g $$
or
$$ v_0^2 = \left(\Delta h + L\right)g $$
Here $v_0$ is the initial velocity at the origin in the top of $h_1$, assuming $h_1 \le h_2$. Now considering $V_0$ as the initial velocity at ground, and knowing that $\frac 12V_0^2 = \frac 12 v_0^2 + gh_1$ we have finally
$$ V_0^2 = v_0^2 + 2g h_1 = \left(h_1+h_2+L\right)g $$
NOTE
We can solve this minimization problem, by substituting into $v_x^2+v_y^2$ the relationship $v_x = f(v_y)$ or $v_y = g(v_x)$ obtained from
$$ \frac{v_y}{v_x}\Delta x -\frac 12\frac{g}{v_x^2}\Delta x^2 = \Delta h $$
and then minimizing
$$ v_0^2 = f(v_y)^2+v_y^2 $$
regarding $v_y$