This types of problems are solved by observing projectile movements in $x$ and $y$ direction separately. In $x$ direction you have constant velocity movement
$$v_x = v_{x0} = v_0 \cos(\theta), \; (1)$$
$$x = v_{x0} t +x_0 = v_0 \cos(\theta) \; t +x_0, \; (2)$$
and in $y$ direction you have constant acceleration movement with negative acceleration $-g$
$$v_y = - g t + v_{y0} = - g t + v_0 \sin(\theta), \; (3)$$
$$y = - \frac{1}{2} g t^2 + v_{y0} t + y_0 = - \frac{1}{2} g t^2 + v_0 \sin(\theta) \; t + y_0. \; (4)$$
Your initial conditions are
$$x_0 = 0, \; y_0 \ne 0,$$
and final conditions (at moment $t=T$ projectile falls back on the ground) are
$$t = T, \; x = d, \; y = 0.$$
If you put initial and final conditions into equations (2) and (4) you end up with two equations and two unknowns $v_0, T$. By eliminating $T$ you get expression for $v_0$.
My calculations show that
$$v_0 = \frac{1}{\cos(\theta)}\sqrt{\frac{\frac{1}{2} g d^2}{d \tan(\theta)+y_0}}$$
which is I believe equal to your equation. Maybe your problem is that $d$ means displacement in direction $x$, while the total displacement is $\sqrt{d^2+y_0^2}$?
We can first find the angle since the initial and final velocities are not given, while the initial displacement are given as X = Y = 0 and the final displacement as X = 4.57 m and Y = 0.61 m.
The goal is to eliminate the initial unknown velocities where
$$v_x = v_i\cos(\theta)$$
$$v_y = v_i\sin(\theta)$$
To do this we use equations
$$x = v_i\cos(\theta)t$$
$$y = v_i\sin(\theta)t-\frac12gt^2$$
Substituting for $v_i$ we get have
$$y = \tan(\theta)x-\frac 12 g\left(\frac x{v_i\cos\theta}\right)^2$$
We can use this equation to solve for $\theta$ which is the angle at which the target is hit.
Given $\theta$ we can find $v_i$ using $$y = v_i\sin(\theta)t-\frac12gt^2$$
Best Answer
Consider the projectile at an initial position $(x_0, y_0)$, given an initial velocity of $u$ making an angle $\theta$ above the horizontal.
\begin{align} u_x &= u \cos(\theta);\\ u_y &= u \sin(\theta);\\ \end{align}
The velocity remains constant in the $x$ direction, if you neglect dissipative effects like drag.
The velocity in the $y$ direction changes due to gravity:
\begin{align} v_x &= u_x;\\ v_y &= u_y - gt; \end{align}
The x and y displacements can be given as
\begin{align} s_x &= u_x t;\\ s_y &= y_y t - \frac{1}{2}gt^2; \end{align}
The position of the projectile, hence, is:
\begin{align} x &= x_0 + s_x = x_0 + u_x t;\\ y &= y_0 + s_y = y_0 + u_y t - \frac{1}{2}gt^2; \end{align}
Suppose the projectile is launched from a hill 100m above ground level. You want to find the angle of launch which will allow you to hit an object on the ground, 1000m away.
This gives you:
\begin{align} x_0&=0;\\ y_0&=100;\\ x_{final}&=1000;\\ y_{final}&=0; \end{align}
Putting these values in the equations for $x$ and $y$,
\begin{align} 1000 &= 0 + u \cos(\theta) \times t;\\ 0 &= 100 + u \sin(\theta) \times t - \frac{1}{2}gt^2; \end{align}
You now have 2 equations, with 2 variables ($t$ and $\theta$), which you can solve to get the answer. Note: The equation is quadratic in $t$, meaning you'll get 2 values for $t$. One of these can be eliminated (you'll see why when you solve it)