Note - the solution relies on using AM$\geqslant$ GM inequality without proving it , check this link out if you are not familiar with this inequality Proofs of AM-GM inequality
Let's first initialise parametric coordinates for the circle
$x^2 + (y-8)^2 = 25$ as $P= (5 cos \theta , 8 + 5 \sin \theta )$
Let the given point be $Q(0,-5)$

Then find slope of line segment PQ
M($ \theta $)=$ \frac {13 + 5 \sin ( \theta)}{5 \cos ( \theta )}$
Which simplifies to$ \frac {13}{5} \sec( \theta ) + tan(\theta)$
We now find range of M
Let
$\sec( \theta) + \tan( \theta) = t$
Then $\sec(\theta) - tan(\theta) = \frac{1}{t} $(from trigonometric identites)
t lies on ( -$ \infty , + \infty$ )
Now , $\sec(\theta) = (t + \frac{1}{t} )/2$
And $tan(\theta) = (t - \frac{1}{t} )/2$
Putting it in the slope function M and simplifying
M = $\frac{18t}{10} + \frac{8}{10t}$
On positive range of t , applying AM $\geqslant$ GM
$$\frac{18t}{10} + \frac{8}{10t} \geq \sqrt{\frac{18t}{10} *\frac{8}{10t}}$$
$$M \geq \frac{12}{5} $$
Similarly , $M \leq -\frac{12}{5} $( to prove this assume t is -ve , then $-t$ will be positive , apply $AM \geq GM$ for this )
equality holds good for$ \frac{18t}{10} = \frac{8}{10t}) $ (in both the cases (namely t>0 and t<0 )
Hence t = +12/5 or -12/5
Using these to get $ \sec(\theta)$ and hence find the end points by putting the values of \theta in the circle's parametric coordinates .
