Line distance between points (p,q) and (q,p)

2k Views Asked by At

I'm trying to find the distance between the points (p,q) and (q,p). As far as I can tell, my steps are correct, but I'm getting the answer $\sqrt{2q^2 + 2p^2}$ but the textbook gives the answer $\sqrt{2(p-q)^2}$. Can anyone check my steps please, and tell me what, if anything I'm doing wrong:

\begin{split} x_2 &= q\\ x_1 &= p\\ y_2 &= p\\ y_1 &= q\\ \\ x_2 - x_1 &= q - p\\ y_2 - y_1 &= p - q\\ \\ \text{ distance }&= \sqrt{(x_2 - x_1)^2} + \sqrt{(y_2 - y_1)^2}\\ \\ \text{ (plugging} &\text{ in values)}\\ \\ \text{ distance } &=\sqrt{(q-p)^2} + \sqrt{(p-q)^2}\\ \\ \text{($-p$ and $-q$ squared turn to $p^2$ } &\text{ and $q^2$, removing negative signs:)}\\ \\ &=\sqrt{q^2} + \sqrt{p^2} + \sqrt{p^2} + \sqrt{q^2}\\ \\ &=\sqrt{2q^2} + \sqrt{2p^2} \end{split}

The textbook answer however is $\sqrt{2(p-q)^2}$. Re-reading it, it did say to assume $p > q > 0$. Would that have changed the values / results?

Thanks and sorry about the formatting - first time poster.

2

There are 2 best solutions below

5
On BEST ANSWER

The square root doesn't distribute. That is to say,

$$\sqrt{a + b} \neq \sqrt{a} + \sqrt{b}$$

in general. (There are specific examples and cases where it does equal and looks like it distributes, but it doesn't always happen. For example, above, consider $a=4,b=9$.)

Therein lies one of your problems.


Also, we note, once you get to the step where

$$d = \sqrt{(q-p)^2 + √(p-q)^2}$$

notice that $(p-q)^2 = (q-p)^2$. If you have trouble convincing yourself of this, remember you can factor out a $-1$ from one of them and thus:

$$(q-p)=-1(p-q)$$

implying

$$(q-p)^2 = (q-p)(q-p) = (-1)(p-q)(-1)(p-q) = (-1)^2(p-q)^2 = (p-q)^2$$

This is probably the most confusing step of the textbook's solution. From there it should be clear how to proceed.

2
On

The distance is

$$ d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} $$

If you replace your points

$$ d = \sqrt{(p - q)^2 + (q - p)^2} = \sqrt{(p - q)^2 + (p - q)^2} = \sqrt{2(p - q)^2} = \sqrt{2} |p - q| $$