# Compute the minimal distance between two points in movement

There are two points, $A$ and $B$ that move according to these laws:

$$\vec{x_a}= 20 -10 t$$ $$\vec{x_b}= -15 +15 t$$

$A$ moves along the x axis, $B$ along the y axis.

I have to compute the time $t_0$ when the distance between $A$ and $B$ (called $h$) is minimal.

So the minimal distance is when $\frac{dh}{dt}=0$ $$h(t) = \sqrt{\big( 20-10t \big)^2 + \big( -15 +15t \big)^2} = \sqrt{325 t^2 -850t + 625}$$

$$\frac{dh}{dt} = -\frac{1}{2} \cdot \big( 325 t^2 -850t +625 \big) \cdot \big( 650t -850 \big)=-845t^3 + 3315t^2 -4515t + 17125$$

Which has one real and two complex solutions, but they're wrong (the solution is $t_0= 1.31s$). What's the mistake?

$$\sqrt{f(t)} = \left[f(t)\right]^{1/2}$$
$$\frac{1}{2} [f(t)]^{-1/2} \dot{f}$$
where $\dot{f} = df/dt$. You'll see the solution isn't hard to find from there.