According to the meaning of the question, suppose that after x hours, the two ships are the closest. The nearest distance is y kilometers.
Then from Pythagorean theorem
y^2=( 15x)^2 +( 125-20x)^2
y^2=625(x^2 -8x+25)
Accord to that property of quadratic function, when x=4,
Y 2 has a minimum value f(4)=9x625=5625.
So the minimum value of y is 75.
That is, after driving for four hours, the distance between the two ships is the shortest, which is 75 kilometers.