I wanted to find the value that makes the derivative of the following function equal to $0$ $$X(e)=v_i \sqrt{1-e^2}\left(\frac{v_ie}{g}+\sqrt{\frac{v_i^2e^2}{g^2}+\frac{2y_i}{g}}\right)$$ After deriving and simplifying i reached the following $$\frac{v_i[g \left(v_i(1-2e^2) \sqrt{\frac{v_i^2e^2}{g^2}+\frac{2y_i}{g} }-2ey_i \right)+v_i^2e(1-2e^2)]}{g^2\sqrt{\frac{v_i^2e^2}{g^2}+\frac{2y_i}{g} }\sqrt{1-e^2}}$$ But I am having a hard time trying to find the values of $e$ that make the derivative equal to $0$.
$$g[v_i(1-2e^2) \sqrt{\frac{v_i^2e^2}{g^2}+\frac{2y_i}{g} }-2ey_i]+v_i^2e(1-2e^2)=0$$
You can start by rearranging it to get rid of the square root (I'm dropping the subscripts because I'm lazy):
$$\begin{eqnarray} g\left[v(1-2e^2)\sqrt{\frac{v^2 e^2}{g^2} + \frac{2y}{g}} - 2ey \right] + v^2 e(1 - 2e^2) & = & 0 \\ gv(1-2e^2)\sqrt{\frac{v^2 e^2}{g^2} + \frac{2y}{g}} & = & 2egy - v^2 e(1 - 2e^2) \\ g^2v^2(1-2e^2)^2\left[\frac{v^2 e^2}{g^2} + \frac{2y}{g}\right] & = & 4e^2g^2y^2 - 4e^2gyv^2(1-2e^2) + v^4e^2(1-2e^2)^2 \end{eqnarray}$$
Then notice that the first term on the left cancels the last term on the right. With some more simplification, you can reduce the whole thing to a quadratic expression in $2e^2$ that you can then solve via normal means.