Task
A gun is intended to hit an elevated target at a given angle. How big does the muzzle velocity v0 have to be? What is the minimum size of the angle for the present case? (The air resistance and the Coriolis force can be neglected.)

Solution
A solution video will be published soon on this channel.
The accelerations in direction x and direction y are
¨x=0
¨z=−g
The integration of both accelerations leads to the velocity
˙x=c1
˙z(t)=−gt+c2
and the location.
x(t)=c1t+c3
z(t)=−12gt2+c2t+c4
The position of the projectile at time t = 0 in the x-direction is equal to zero, from which c3 can be calculated.
x(t=0)=0
0=c1t+c3
c3=0
The z-position at time t = 0 is also zero, which results in c4.
z(t=0)=0
0=−12gt2+c2t+c4
c4=0
The speed in the x direction at time t = 0 is the horizontal component of v0, which delivers c1.
˙x(t=0)=v0⋅cosα
c1=v0⋅cosα
˙x=v0⋅cosα
The speed in the z-direction is the vertical component of v0, so that c2 can be determined.
˙z(t=0)=v0⋅sinα
v0⋅sinα=−gt+c2
c2=v0⋅sinα
With the integration constants determined so far, the functions for the position of the projectile now look like this:
x(t)=v0⋅cosα⋅t
z(t)=−12gt2+v0⋅sinα⋅t
The time of impact is referred to as T in the following. The x position at time t = T is 2a.
x(t=T)=2a
2a=v0⋅cosα⋅T
T=2av0⋅cosα
The z-position at time T is a.
z(t=T)=a
a=−12gT2+v0⋅sinα⋅T
The calculated T (equation 23) is now inserted and the equation can be solved for v0.
a=−12g⋅(2av0⋅cosα)2+v0⋅sinα⋅2av0⋅cosα
a=−12g⋅4a2v20⋅cos2α+sinα⋅2acosα
a=−12g⋅4a2v20⋅(cos(2α)+1)+2a⋅tanα
4a⋅tanα−2a=g⋅4a2v20⋅(cos(2α)+1)
(4a⋅tanα−2a)⋅(cos(2α)+1)4a2g=1v20
v0=√4a2g(4a⋅tanα−2a)⋅(cos(2α)+1)
Determination of the minimum angle
Consider the two terms in brackets below the brackets in equation 31. If one of the two becomes zero, the equation no longer provides a solution. So it applies
4a⋅tanα−2a>0
α>arctan12
α>26.57°
as
cos(2α)+1>0
α>arccos(−1)2
α>180°
Obviously, the minimum angle is found with equation 34, while equation 37 represents the upper limit value.
Validation of the function
Below are two diagram plots with the x and y coordinates of the projectile for two different angles of fire (45 ° and 60 °) with the same parameters for distance and height. The destination is marked with a cross.

At a firing angle of 45 °, the projectile hits the target at the apex of its trajectory.

At a firing angle of 60 °, the projectile moves on a significantly elevated trajectory and hits the target in its downward movement.