First find the distance between the x-coordinates. The distance between two points AxA yA A x A y A and BxB yB B x B y B in two-dimensional Cartesian coordinate plane is the length of the segment connecting them AB dA B xB xA2 yB yA2 A B d A B x B - x A 2 y B - y A 2. Using Calculus to find the length of a curve.
We extend it to the origin 0 0.
We will find the distance RS which I hope you agree is equal to the distance PQ that we wanted at the start. Now we construct another line parallel to PQ passing through the origin. Lets call it line RS. Since this format always works it can be turned into a formula.