Optimizing a quadratic in one variable with parameterized coefficients Recently I was doing a physics problem and I ended up with this quadratic in the middle of the steps:
$$ 0= X \tan \theta - \frac{g}{2} \frac{  X^2 \sec^2 \theta }{ (110)^2 } - 105$$
I want to find $0 < \theta < \frac{\pi}2$ for which I can later take the largest $X$ value that solves this equation, i.e. optimize the implicit curve to maximize $X$.
I tried solving this by implicit differentiation (assuming $X$ can be written as a function of $\theta$) with respect to $\theta$ and then by setting $\frac{dX}{d\theta} = 0$:
\begin{align}
0 &= X \sec^2 \theta  + \frac{ d X}{ d \theta} \tan \theta - \frac{g}{2} \frac{ 2 \left( X \sec \theta \right) \left[  \frac{dX}{d \theta} \sec \theta + X \sec \theta \tan \theta \right]}{ (110)^2 } - 105 \\
0 &= X  \sec^2 \theta  - \frac{g}{2} \frac{ 2( X \sec \theta) \left[ X \sec \theta \tan \theta\right] }{ (110)^2 } \\
0 &= 1 - \frac{ Xg \tan \theta}{(110)^2} \\
\frac{ (110)^2}{ g \tan \theta} &= X
\end{align}
This is still not an easy equation to solve. However, one of my friends told we could just take the discriminant of the quadratic in terms of $X$, and solve for  $\theta$ such that $D=0$.
Taking discriminant and equating to 0, I get
$$ \sin \theta = \frac{ \sqrt{2 \cdot 10 \cdot 105} }{110}$$
and, the angle from it is, 24.45 degrees
I tried the discriminant method, but it gave me a different answer from the implicit differentiation method. I ended up with two solutions with the same maximum value of $X$ but different angles: $\theta =24.45^\text{o}$ and $X=1123.54$ (from discriminant method), and
$\theta = 47^\text{o}$ and $X=1123.54$ (from implicit differentiation).
I later realized the original quadratic can only have solutions if $D(\theta) > 0$, where $D$ is the discriminant. Using the discriminant, I can find a lower bound on the angle. Once I have the lower bound, if I can prove that $X$ decreases monotonically as a function of $\theta$, then I can use the lower bound for further calculations of $\theta$.
So then I used the implicit function theorem and got
$$ \frac{dX}{ d \theta} =- \frac{X \sec^2 \theta -\frac{g X^2}{2 (110)^2} 2 \sec \theta ( \sec \theta \tan \theta)  } {\tan \theta - \frac{g \sec^2 \theta}{2 (110)^2} 2X }$$
Now the problem here is that I can't prove this function is in monotonic in terms of $\theta$ as the implicit derivative is a function of both $\theta$ and $X$.
 A: This is a similar but simple approach which gives the same result. Seeing that $y=\tan(\theta)$ can take any positive value, we go for maximizing $x$ and get $\max(x) = 1123$.
We have: $105 = x\tan\theta-\frac{g}{2} \frac{x^2\sec^2\theta}{(110)^2}$
Let $\ a=105,\ y=\tan\theta,\ b = \frac{g}{2} \frac{1}{(110)^2}.\quad$  Then, $\ a=xy-bx^2(y^2+1)$
Taking $xy=c,\; x^2=\frac{c-bc^2-a}{b}$  (Note that since $y$ can take any positive value, so can $c$)
So, for $\,x_{\max},\quad \frac{d}{dc}\ (\frac{c-bc^2-a}{b}) = 0$ which gives $c=\frac{1}{2b}$
Now, $x_{\max} = \sqrt{\frac{c-bc^2-a}{b}}\quad at\, c=\frac{1}{2b},$ i.e. $\,x_{\max} \approx 1123$ by plugging in values of $a$ and $b.$
A: I reworded the problem setting $X=y$ and $\theta=x$. Considering  $g=9.81$, solving the quadratic equation for $y$ gives the two solutions
$$\displaystyle y =-\frac{ 1100}{981} \cos x \\ \left(    \sqrt{10} \sqrt{121000 \tan^2 x - 20601 \sec^2 x} - 1100 \tan x     \right)$$
$$\displaystyle y =\frac{ 1100}{981} \cos x \\ \left(    \sqrt{10} \sqrt{121000 \tan^2 x - 20601 \sec^2 x} +1100 \tan x     \right)$$
The separate plots of the two functions are here and here. The combined plot of the two functions is here.
By clarity, I also paste them here:



The maximal value is achieved by the second function. Its derivative is quite complicated, and a closed form for the value of $x$ that maximizes $y$ may probably not exist. However, as already noteď in the OP and in the comments,  the numerical solution is given by $x\approx 0.832$ radians (corresponding to about $47.67$ degrees), which leads to a maximum of $y\approx 1123.54$, as confirmed here. By a similar numerical assessment of the first function, it can be confirmed that the symmetrical minimum value of $y\approx -1123.54$ is achieved for $x\approx \pi-0.832\approx 2.309$ radians (corresponding to about $132.33$ degrees), as shown here.
Note that setting the determinant equal to zero, as cited by the OP, only gives the values of $x$ for which the values of the two functions coincide. These values, which have rather tricky closed forms that can be approximated by $x\approx 0.4253$ and $\approx 2.7163$, correspond to the points where the two functions meet, in the leftmost and rightmost portion of the combined plot.
A: You were on the right track; you just didn't go far enough. Your first equation relating $X$ and $\theta$ is
$$0=X\tan\theta-\frac{g}{2v^2}X^2\sec^2\theta-h\tag1$$
where I've written $h$ for the height of the cliff and $v$ for the initial velocity of the projectile in your original question posted to Physics SE.
(Why did you put in numbers for $h$ and $v$ but not for $g$? Why put in numbers at all, when you can get a nice general formula for any values of these parameters? Why were your values inconsistent between your physics post at your post here?)
You wanted the point on the $X(\theta$) curve that maximizes $X$. As you realized, this is the point where $dX/d\theta=0$.
You could solve (1), which is quadratic in $X$, for $X$ in terms of $\theta$ and then differentiate, set the derivative to zero, solve for $\theta$, and put that back in to find the maximum $X$. This works but involves more algebra than the better approach that you took involving implicit differentiation. You differentiated (1) and set $dX/d\theta$ to $0$, finding
$$\frac{v^2}{g\tan\theta}=X\tag2.$$
The maximum point on the $X(\theta)$ curve satisfies both (1) and (2): (1) because it is a point on the curve, and (2) because it is the maximum point. So you need to solve these two simultaneous equations.
This is straightforward: First use (2) to eliminate $X$ from (1), giving an equation involving only $\theta$:
$$0=\left(\frac{v^2}{g\tan\theta}\right)\tan\theta-\frac{g}{2v^2}\left(\frac{v^2}{g\tan\theta}\right)^2\sec^2\theta-h$$
which simplifies to
$$0=\frac{v^2}{g}-\frac{v^2}{2g}\frac{1}{\sin^2\theta}-h.$$
It's easy to solve this for the value of $\theta$ at the maximum point:
$$\sin\theta=\frac{1}{\sqrt{2-2q}}$$
where $q\equiv gh/v^2$.
From this one finds that
$$\cos\theta=\sqrt{1-\sin^2\theta}=\sqrt{\frac{1-2q}{2-2q}}$$
and
$$\tan\theta=\frac{\sin\theta}{\cos\theta}=\frac{1}{\sqrt{1-2q}}.$$
Substituting this into (2) gives the value of $X$ at the maximum point,
$$X=\frac{v^2}{g}\sqrt{1-\frac{2gh}{v^2}}.$$
Putting in the values $h=105\text{ m}$, $v=110\text{ m/s}^2$, and $g=9.81\text{ m/s}^2$ gives $X=1123.54$ m.
Note that simply completing your solution in this straightforward way does not require the clever substitution that Anonymous used.
Setting the discriminant of (1) to zero does not give the position of the maximum point on the $X(\theta)$ curve. Instead, as Anatoly's graphs show, it gives the point where the two solutions for $X$ coincide. It is also clear from those graphs that the upper solution with the maximum is not monotonic.
A: The trick is to write a quadratic in terms of $ \tan \theta $ and not in terms of $X$
$$ 0 =  X \tan \theta -\frac{g}{2} \frac{ X^2 (1 +\tan^2 \theta)}{(110)^2} - 105$$
applying the condition that tangent $ D>0$ for the quadratic in terms of $ \tan \theta$(taking g as 10),
I get, this
$$ 1> \frac{20}{(110)^2} ( 105 + \frac{5X^2}{(110)^2})$$
$$ -1100 < X<1100$$
Taking the upper bound, it becomes $X=1100$
A: We can proceed directly.. straightforward way. We have the given relation $ (x=X)$:
$$105 = x\tan\theta-\frac{g}{2} \dfrac{x^2\sec^2\theta}{(110)^2} \tag1 $$
To facilitate differentiation let us use symbols for the time being
$$\ h=105,\ V=110 , \tan\theta =t,\dfrac{2v^2}{g}=a \tag2 $$
$$ xt-x^2(1+t^2)/a -h =0 \tag3$$
We need to do implicit differentiation of the fourth order polynomial because $x,t$ are involved together.
Priming with respect to $t$ as independent variable
$$x^{'} t + x -\big[ 2x/a \cdot (1+t^2) \cdot x ^{'}  +x^2/a \cdot 2t \big]=0 \tag4 $$
Set $x^{'}=0 $ to find maximum $x,$ and simplify cancelling $x$ on LHS getting
$$ x= \dfrac{a}{2t}\tag5 $$
From (3) and (5) we can find $(t,\theta) $. Plugging this into (3) and simplifying
$$\dfrac{1+t^2}{t^2}=\dfrac{2a-4h}{a} \tag6 $$
$$\dfrac{t^2}{1}=\dfrac{a}{a-4h}\rightarrow t = \tan \theta =\sqrt{\dfrac{a}{a-4h}} =\dfrac{1}{\sqrt{1-2gh/V^2}}\tag7 $$
Plugging this into (5)
$$x_{max}=\dfrac{a}{2}\sqrt{\dfrac{a-4h}{a}} = \dfrac{V^2}{g} {\sqrt{1-2gh/V^2}} \tag8 $$
You can verify sign of second derivative to check it is maximum. To check for the special case
$$ h=0, \; x_{max}= \dfrac{a}{2}= \dfrac{V^2}{g}\tag9 $$
a well known result in projectile motion that the maximum range is double the height reached when projected vertically at angle $\theta =\pi/2 $ to horizontal.
For this particular case put $h=0$ in (7) to tally $ \theta = 45^{\circ} $ okay.
With given numerical values $\; V=110, \; g=9.81,\; h=105,$ we calculate
$$ X_{optimum}=1123.54,\;\theta_{optimum}=46.67^{\circ} \tag {10}$$
Projectile parabolic trajectories are shown below to scale.
By increasing and decreasing $\theta$ by $\pm 30^{\circ} $ the  blue, green parabolas should cut $ y=h=105\;$ at  values lower than 1123.54  for an optimum $X_m$ red parabola to be valid.. a fact that is graphically also verified.

