Projectile Motion, finding the optimal angle 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 &theta; and $t$ as our two variables.

If we then rewrite the two main equations in terms of $t$ as a function of &theta;, 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.
If the goal is to cover the optimal distance in a given minimum time, then yes... shoot the projectile horizontally.  But that makes no physical sense... why would you care about that?  If on level ground, that would mean shooting the projectile horizontally and it stops immediately (hitting the ground).  

Presumably you want to get the maximum distance or range.

Here are graphs of a projectile leaving a cliff with the same initial speed but at different angles.  Note especially that the (red) horizontal trajectory does NOT yield the greatest range.  That is because even though it has the highest horizontal speed, it does not stay aloft as long as some other projectiles.
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.