Find minimum in a constrained three-variable equation After my last question I have worked through the math quite a bit and now I'm stuck again. This time my question is less wordy.
I have two equations for $t$, one with respect to each $a_{x}$ and $a_{y}$:
\begin{align*}
t&=\frac{-2(u_{x}^{A}-v_{x}^{B})\pm\sqrt{4(u_{x}^{A}-v_{x}^{B})^{2}-8a_{x}(c_{x}^{A}-c_{x}^{B})}}{2a_{x}}\\\
t&=\frac{-2(u_{y}^{A}-v_{y}^{B})\pm\sqrt{4(u_{y}^{A}-v_{y}^{B})^{2}-8a_{y}(c_{y}^{A}-c_{y}^{B})}}{2a_{y}}
\end{align*}
Additionally $a_{x}$ can be specified as an inequality in terms of $a_{y}$:
$a_{x}\leq\sqrt{a_{max}^{2}-a_{y}^{2}}$
All the variables except $t$, $a_{x}$ and $a_{y}$ are constants. How can I find a function to yield the values for $a_{x}$ and $a_{y}$ that give the lowest value for $t$? 
EDIT: and this is how I arrived there:
$s_{x}^{A}, s_{y}^{A}, s_{x}^{B}, s_{y}^{B}$ : Functions for position of particles A and B on the x and y axis
$t$ : Time elapsed
$a_{x}^{A}, a_{y}^{A}$ : Acceleration of A on each axis
$a_{max}$ : Maximum magnitude of acceleration of A
$c_{x}^{A}, c_{y}^{A}, c_{x}^{B}, c_{y}^{B}$: Starting positions of A and B (constant)
$u_{x}^{A}, u_{y}^{A}$ - Starting velocity of A (constant)
$v_{x}^{B}, v_{y}^{B}$ - Velocity of B (constant)
$s^{A}=u^{A}t + \frac{a^{A}t^{2}}{2} + c^{A}$ : Function for position of A in terms of time and acceleration on one axis
$s^{B}=v^{B}t + c^{B}$ : Formula for position of B in terms of time on one axis
$a_{y}^{A}\le \sqrt{a_{max}^{2} - {a_{x}^{A}}^{2}}$ : Inequality yielding maximum acceleration on one axis in terms of acceleration on another
Optimize for t where $s^{A}=s^{B}$ on both axis:
\begin{align*}
s^{A}&=s^{B}\\\
u^{A}t + a^{A}t2/2 + c^{A} &= v^{B}t + c^{B}\\\
u^{A}t + a^{A}t2/2 - v^{B}t &=  c^{B} - c^{A}\\\
2u^{A}t + a^{A}t2 - 2v^{B}t &=  2c^{B} - 2c^{A}\\\
a^{A}t2 + 2t(u^{A}-v^{B}) + (2c^{A}-2c^{B}) &= 0
\end{align*}
\begin{align*}
t&=\frac{-2(u^{A}-v^{B})\pm\sqrt{4(u^{A}-v^{B})^{2}-8a(c^{A}-c^{B})}}{2a}&&\mbox{(quadratic formula)}\\\
t&=\frac{-2(u_{x}^{A}-v_{x}^{B})\pm\sqrt{4(u_{x}^{A}-v_{x}^{B})^{2}-8a_{x}(c_{x}^{A}-c_{x}^{B})}}{2a_{x}}
&&\mbox{For X}\\\
t&=\frac{-2(u_{y}^{A}-v_{y}^{B})\pm\sqrt{4(u_{y}^{A}-v_{y}^{B})^{2}-8a_{y}(c_{y}^{A}-c_{y}^{B})}}{2a_{y}}&&\mbox{For Y}
\end{align*}
By my questionable reasoning these functions for $t$ should give how long it will take to reach the target for a given acceleration. The two values for acceleration could be plotted on the X and Z axis in a 3D space, with $t$ on the Y axis. The constraints to maximum acceleration would reduce the function to a circular disc. The points where the acceleration would never reach the target will be undefined or infinite or something. The lowest positive point on the 'disc' on the Y axis is a point where there is a valid combination of accelerations in each direction to reach the target, and should be the fastest. 
Have I gone wrong somewhere? 
EDIT 2: It would be really super great if someone could point me in the right direction to learn about optimisation in 3D. Even if you think I'm approaching the problem presented in my other question wrong, I'd still like to know how to do it, which is why I phrased this question the way I did.
 A: It is very simple to convince yourself (at least intuitively, but also a proof can be given if necessary) that in order to have the time $t$ as small as possible, it is best to have the largest acceleration possible. Thereby, $a_x^2+a_y^2=a_\text{max}^2$. The equations which should be fulfilled are given by
$$\frac{a_x t^2}{2} + v^A_x t+ c^A_x =  v^B_x t+ c^B_x \qquad   \frac{a_y t^2}{2} + v^A_y t+ c^A_y = t v^B_y + c^B_y.$$
Replacing $a_y$ by $a_y = \sqrt{a_\text{max}^2 - a_x^2}$,  we obtain
$$\frac{\sqrt{a_\text{max}^2 - a_x^2} t^2}{2} + v^A_y t+ c^A_y = t v^B_y + c^B_y.$$
Solving the first equation for $a_x$, and plugging everything the result into the second equation yields
$$\frac{\sqrt{a_\text{max}^2 - \left[\frac{2 (c^A_x- c^B_x +t (v^A_x -v^B_x)}{t} \right]^2} t^2}{2} + v^A_y t+ c^A_y =  v^B_y t + c^B_y.$$
After some manipulations the last equation can be brought into the form
$$\begin{multline}
\frac{a_\text{max}^2}{4} t^4 + [(v^A_y- v^B_y)^2 - (v^A_x- v^B_x)^2] t^2  - 2[(c^A_x - c^B_x)(v^A_x - v^B_x)+ (c^A_y - c^B_y)(v^A_y - v^B_y)] t\\ -(c^A_x -c^B_x)^2 - (c^A_y -c^B_y)^2 =0.
\end{multline}$$
Solving this equation for $t$ gives the optimal (minimal) time required. Note however that this is a quartic equation such that the solution becomes quite messy and that is why I will not write it down here.
