Find the equation of the locus of point P such that the line segment AB, joining the points $A \left(1,-6\right)$ and $B \left(4,-2\right)$, subtends a right angle at P.
Let $P \left(h, k\right)$ be a point on the required locus.
Since the line segment AB subtends a right angle at P, we have
$PA^2 + PB^2 = AB^2$ $\;\;\; \cdots \; (1)$
Given: $A = \left(1,-6\right)$, $B = \left(4,-2\right)$
$\begin{aligned}
\therefore \; PA^2 & = \left(h - 1\right)^2 + \left(k + 6\right)^2 \\\\
& = h^2 + k^2 - 2h + 12 k + 1 + 37 \\\\
& = h^2 + k^2 - 2h + 12 k + 37 \;\;\; \cdots \; (2a)
\end{aligned}$
$\begin{aligned}
PB^2 & = \left(h - 4\right)^2 + \left(k + 2\right)^2 \\\\
& = h^2 + k^2 - 8 h + 4 k + 16 + 4 \\\\
& = h^2 + k^2 - 8 h + 4k +20 \;\;\; \cdots \; (2b)
\end{aligned}$
and, $AB^2 = \left(1-4\right)^2 + \left(-6 + 2\right)^2 = 25$ $\;\;\; \cdots \; (2c)$
$\therefore$ $\;$ In view of equations $(2a)$, $(2b)$ and $(2c)$. equation $(1)$ becomes
$h^2 + k^2 - 2 h + 12 k + 37 + h^2 + k^2 - 8 h + 4 k + 20 = 25$
i.e. $2h^2 + 2 k^2 - 10 h + 16 k + 32 = 0$
i.e. $h^2 + k^2 - 5 h + 8k + 16 = 0$
$\therefore$ $\;$ The required equation of locus is: $\hspace{1em}$ $x^2 + y^2 - 5 x + 8 y + 16 = 0$