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$.

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.$
