Hello, dopi!
You seem to be using a coordinate system and vectors
. . and I don't know what you plan to do with them.
galactus gave you the solution . . . so why struggle with your approach?
I'll make some diagrams to accompany his excellent solution.
Originally Posted by
galactus
At t=0, they are both 10 kms from their intersection.
Code:
* Q


 10



P *         o
10
$\displaystyle t$ hours later, $\displaystyle P$ has moved $\displaystyle 30t$ km east to point $\displaystyle A$
. . and $\displaystyle Q$ has moved $\displaystyle 40t$ km south to point $\displaystyle B.$ Code:
*

 40t

o B

 1040t
*    o     *
30t A 1030t
And we want to minimize the distance $\displaystyle \overline{AB}.$
Originally Posted by
galactus
Think Pythagoras. Let D = square of distance between ships.
$\displaystyle D(t) \:= \1030t)^{2} + (1040t)^{2}$
$\displaystyle D'(t) \:= \:2(1030t)(30) + 2(10=40t)(40)$
$\displaystyle D'(t) \:= \:5000t  1400$
$\displaystyle 5000t 1400\:=\:0$
$\displaystyle t \:= \:\frac{7}{25}$