Optimizing a quadratic in one variable with parameterized coefficients

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


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:

enter image description here

enter image description here

enter image description 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.


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.