Optimizing Projectile Arclength I was running through some old Putnam problems and came across one from the 1940 exam that asked the following:

A stone is thrown from the ground with speed $v$ at an angle $θ$ to the horizontal. There is no friction and the ground is flat. Find the total distance it travels before hitting the ground. Show that the distance is greatest when $\sin θ \cdot\ln (\sec θ + \tan θ) = 1$.

My work:
We can describe the motion with the following vector:
$$\vec r(t)=\langle v\cos\theta \cdot t,v\sin\theta \cdot t-gt^2/2\rangle$$
We know the vector hits the ground when the $y$ component is equal to $0$. Solving for $t_0$, we get that the ball reaches the ground again at $t_0=\frac{2v\sin\theta}{g}$.
Let's set up an integral for the arc length $s$:
$$s=\int_0^{t_0}\sqrt{\left(\frac{dx}{dt}\right)^2+\left(\frac{dy}{dt}\right)^2}dt$$
Some quick differentiation and we can replace $\frac{dx}{dt}$ and $\frac{dy}{dt}$ with the following identities:
$$s=\int_0^{t_0}\sqrt{(-v\sin\theta)^2+(v\cos\theta-gt)^2}dt$$
Since we are trying to optimize $\theta$, if we take the derivative of the arc length, set it equal to $0$, and find the maximum, then we can solve for optimal $\theta$. We'll also replace $t_0$ with its identity in terms of $\theta$.
$$\frac{ds}{d\theta}=\frac{d}{d\theta}\int_0^{\frac{2v\sin\theta}{g}}\sqrt{v^2-2v\cos\theta\cdot gt+g^2t^2}dt$$
$$\frac{ds}{d\theta}=\frac{2v\cos\theta}{g}\sqrt{v^2-2v\cos\theta\cdot gt+g^2t^2}$$
Here I am unsure how to relate $t$ to $v$ and $\theta$. Do I use the identity for $t_0$, a kinematics equation, or simply treat $t$ as a constant? This, of course, assumes my work thus far has been valid.
Next I would either show that the identity holds after finding $\theta$ or use some relation involving $\theta$ and show that it's an identity to the listed equation.
Thanks for taking the time to read/respond.

WLOG, $v=1$ and $g=1$ (you can rescale time and space independently), the trajectory is
$$x=t\cos\theta,\\y=t\sin\theta-\frac{t^2}2,$$ and the total travel time is
$$2\sin\theta.$$
Then you want to maximize
$$L=\int_0^{2\sin\theta}\sqrt{(t-\sin\theta)^2+\cos^2\theta}\,dt=\int_{-\sin\theta}^{\sin\theta}\sqrt{t^2+\cos^2\theta}\,dt\\
=\sin^2\theta\int_{-1}^{1}\sqrt{u^2+\tan^2\theta}\,du\\
=\frac12\sin^2\theta\left.\left(u\sqrt{u^2+\tan^2\theta}+\tan^2\theta\log(u+\sqrt{u^2+\tan^2\theta})\right)\right|_{u=-1}^1\\
=\frac12\sin^2\theta\left(2\sec\theta+\tan^2\theta\log\frac{\sec\theta+1}{\sec\theta-1}\right).$$
The claim should follow by differentiation and simplification.
