I've been studying multivariable calculus the last 2 weeks, and I understand (I think) how to optimize 2 variable equations through normal optimization and constrained optimization via Lagrange.
I couldn't draw the connection though when I tried to optimize the projectile motion equations, attempting to find the optimal angle to cover a constant distance in the minimum amount of time.
$$ = \cos()$$ $$ = \sin()t − \frac{1}{2}\mathrm{}^2$$
I also don't understand how to implement the constrain of covering a certain distance nor how to rewrite this equation minimizing time in the optimization. I am genuinely confused by the amount of variables and can't seem to 'make the leap' so to speak from what I know to what I don't.
Edit:
I apologize for the lack of clarity on this post.
The problem is covering a certain distance in the least amount of time by finding the optimal launch angle at a constant velocity.
Through your responses, I think this means that $d$, total displacement, and $v$, constant velocity have been defined in our equations. This leaves θ and $t$ as our two variables.
If we then rewrite the two main equations in terms of $t$ as a function of θ, I believe this would point us towards finding the solution.
$$t = \frac{x}{vcos()}$$ and $$ t = \frac{y}{vsin()-\frac{1}{2}gt}$$ This would mean $$ \frac{x}{vcos()} = \frac{y}{vsin()-\frac{1}{2}gt}$$
I am stumped however on what to do after this. Mainly, given a total displacement of $d$, how would I go about writing that in terms of $x$ and $y$. I think $x = dcos()$ and $y = dsin()$ through vector resolution, but how would I incorporate that into the equations to calculate the optimal angle for the least amount of time.
If anything is incorrect or still unclear, do let me know. I appreciate all of your responses; they have indeed helped expand my thinking about this.

Does this require a Lagrangian (or any calculus)?
The greater the horizontal component of motion the better.
If we are firing off of a cliff, then $\theta = 0.$
If we are firing over level ground, then we need to find the minimal angle to cover the distance.
There is some time $t^*$ such that $y(t^*) = y(0) = 0$
$0 = t^*(v\sin\theta - \frac 12 gt^*)\\ t^* = \frac {2v\sin\theta}{g}$
$x(t^*) = \frac {2v^2\sin\theta\cos\theta}{g} = d\\ \sin2\theta = \frac {dg}{v^2}\\ \theta = \frac 12\arcsin(\frac {dg}{v^2})$
Update: since there seems to be some confusion with the "firing off a cliff."
The shot fired horizontally will cover more horizontal distance in the same amount of time, then a shot with the same initial velocity but different angle of trajectory.