Let \(A\) and \(B\) be on the same side of a line, and let \(P\) move on the line. Then \(|PA - PB|\) is never more than \(AB\), and it equals \(AB\) at the point where the line \(AB\) meets the line \(P\) moves on. So the greatest value of \(|PA - PB|\) is \(AB\).
The triangle rule
In any triangle, each side is less than the sum of the other two: \(PB < PA + AB\).
So \(PB - PA < AB\).
When it is equal
When \(P\), \(A\) and \(B\) are on one line with \(A\) between \(P\) and \(B\), the triangle is flat: \(PB = PA + AB\).
Then \(PB - PA = AB\) exactly.
Why it is true: turn \(PA\) onto \(PB\)
Take \(A(4, 4)\), \(B(7, 8)\) and \(P(7, 0)\) on the \(x\)-axis. Here \(PA = 5\) and \(PB = 8\).
Turn \(PA\) about \(P\) until it lies along \(PB\). The piece of \(PB\) left over is \(PB - PA = 3\).
The path from \(P\) to \(A\) to \(B\) is longer than the straight \(PB\), so \(PA + AB > PB\) and the piece is less than \(AB = 5\).
This holds for every \(P\) on the axis that is not on the line \(AB\).

Where the greatest value is
Slide \(P\) along the axis. The piece grows until \(P\) reaches the line \(AB\): there \(A\) lies on \(PB\), and the piece is \(AB\) itself.
From \(A\) to \(B\) is 3 right and 4 up, so \(AB = \sqrt{3^2 + 4^2} = 5\). The same step back from \(A\) (3 left, 4 down) reaches the axis at \(P(1, 0)\).
Check: \(PA = 5\), \(PB = 10\), \(PB - PA = 5 = AB\).

Careful
Do not mirror here. For the least \(PA + PB\) with \(A\), \(B\) on the same side, you mirror one point in the line. For the greatest \(|PA - PB|\) with \(A\), \(B\) on the same side, you do not: the answer is \(AB\) itself.
Opposite sides. If \(A\) and \(B\) are on opposite sides of the line, mirror one of them first; then they are on the same side and the rule above applies.
\(AB\) parallel to the line. Then the line \(AB\) never meets it, and \(|PA - PB|\) has no greatest value: it comes as close to \(AB\) as you like but never reaches it.
Solved example
\(A(1, 2)\) and \(B(7, 10)\); \(P\) moves on the \(x\)-axis. Find the greatest value of \(|PA - PB|\) and the point \(P\) where it occurs.
Greatest value. \(A\) and \(B\) are above the axis, so it is \(AB = \sqrt{6^2 + 8^2} = 10\).
Where. The step from \(A\) to \(B\) is 6 right and 8 up. Going down 2 from \(A\) to the axis is \(\frac{1}{4}\) of a step back: \(x = 1 - \frac{6}{4} = -\frac{1}{2}\). Check: \(PA = \frac{5}{2}\), \(PB = \frac{25}{2}\), \(PB - PA = 10\).
10, at \(P\left(-\frac{1}{2}, 0\right)\)
Key results
\[ \begin{aligned}A, B \text{ on the same side: greatest } |PA - PB| &= AB, \text{ where line } AB \text{ meets the line}\\[3pt] A, B \text{ on the same side: least } PA + PB &= AB', \text{ with } B' \text{ the mirror image of } B\\[3pt] A, B \text{ on opposite sides: greatest } |PA - PB| &= AB', \text{ with } B' \text{ the mirror image of } B\end{aligned} \]
Practice set
Easy to hard. \(P\) moves on the \(x\)-axis unless the question says otherwise. Try each one before you open its answer.
Quiz from the Short. \(A(0, 2)\), \(B(12, 7)\). The greatest value of \(|PA - PB|\) is: (A) 15 (B) 13 (C) 5.
Show answer
(B) 13. \(A\) and \(B\) are on the same side, so the greatest value is \(AB = \sqrt{12^2 + 5^2} = 13\), at \(P(-4.8, 0)\). 15 is \(AB'\) with \(B\) mirrored, which is the trick for the least \(PA + PB\), not this.
\(A(1, 1)\), \(B(4, 5)\). Find the greatest value of \(|PA - PB|\) and the point \(P\).
Show answer
5, at \(P\left(\frac{1}{4}, 0\right)\). \(AB = \sqrt{3^2 + 4^2} = 5\). Down 1 to the axis is \(\frac{1}{4}\) of the step back: \(x = 1 - \frac{3}{4}\).
\(A(2, 3)\), \(B(5, 7)\), and \(P\) moves on the \(y\)-axis. Find the greatest value of \(|PA - PB|\) and the point \(P\).
Show answer
5, at \(P\left(0, \frac{1}{3}\right)\). Both points have \(x > 0\). Left 2 to the axis is \(\frac{2}{3}\) of the step back: \(y = 3 - \frac{2}{3} \times 4 = \frac{1}{3}\).
\(A(0, 3)\), \(B(4, 3)\). Does \(|PA - PB|\) have a greatest value? Explain.
Show answer
No. \(AB\) is parallel to the axis, so \(P\) is never on the line \(AB\): \(|PA - PB| < 4\) always, and it comes as close to 4 as you like as \(P\) moves far away.
\(A(1, 2)\), \(B(5, -4)\). Find the greatest value of \(|PA - PB|\) and the point \(P\).
Show answer
\(2\sqrt{5}\), at \(P(-3, 0)\). Mirror \(B\) to \(B'(5, 4)\): \(PB' = PB\). Then \(AB' = \sqrt{4^2 + 2^2} = 2\sqrt{5}\), and the line \(AB'\) meets the axis at \(x = -3\).
Find the greatest value of \(\left|\sqrt{(x - 1)^2 + 4} - \sqrt{(x - 4)^2 + 16}\right|\) for real \(x\), and the \(x\) where it occurs.
Show answer
\(\sqrt{13}\), at \(x = -2\). The roots are the distances from \((x, 0)\) to \(A(1, 2)\) and \(B(4, 4)\): the greatest is \(AB = \sqrt{3^2 + 2^2} = \sqrt{13}\), where the line \(AB\) meets the axis.