Condition:
Water stands at a depth H in a tank, Whose side walls are vertical. A hole is made on one of the walls at a depth h below the water surface. Find at what value of h this range is maximum?
Solution:

Apply Bernoulli's equation for water located inside the container at depth h and for water just flowing out of it at the same depth: patm+ρgh=patm+2ρv2 . We obtain v=(2gh)0.5 .
Here we have a projectile problem that starts horizontally at height H−h with the speed v .
It accelerates downward with free fall acceleration, and the travelling time until the water hits the ground is found from the condition H−h=2gt2 , therefore t=(g2(H−h))0.5 . During that time interval the horizontal distance travelled is vt
x=vt=(2gh)0.5∗(g2(H−h))0.5=(g2(H−h)2gh)0.5=2((H−h)h)0.5.
For maximum range:
dhdx=dhd(2((H−h)h)0.5)=0→H−2h=0→h=21H.
Answer: 21H .