# maximising the angle $\theta$

OK, suppose I have two points in cartesian coordinate system, say $P(x_1,y_1)$ and $Q(x_2,y_2)$. I have a line as well, that is, for simplicity $$y=mx$$ Assuming that $$y_1\neq mx_1,y_2\neq mx_2$$ I need to find the point $A$ on the line so that the angle $PAQ$ is maximum. So I assume that point is $A(h,k)$. So the slope of $PA$ is ${k-y_1 \over h-x_1}$, and that of $QA$ is ${k-y_2 \over h-x_2}$. Then I find $\theta$ (the angle $PAQ$) by the inverse tangent way $$\theta=arctan({m_1-m_2 \over 1+m_1m_2 })$$ For the maxima, I differentiate this angle with respect to either $h$ or $k$ using the fact that $k=mh$ and put it to zero. Then all of that and the answer comes out. I plug that back and get a value. But the range of $arctan$ is from $[{-\pi \over 2},{\pi \over 2}]$. I do not think my way will work for obtuse angles. Is there any other way? P.S.Just give me a hint.

I apologize if this is too "elementary". Diagram-

• so it means that you can calculate slope and intercept from this two point,maximum angle can be calculate easily ,maximum is theta or $\pi-theta$ Commented Apr 21, 2013 at 10:42
• By line, what exactly do you mean? $x$-axis ? $y$-axis? Commented Apr 21, 2013 at 10:44
• @Inceptio: I mean the line $y=mx$ that passes through the origin. Commented Apr 21, 2013 at 10:45
• A geometric hint: you get the maximum angle when the moving point lies on a circle passing through $P$ and $Q$ and tangent to the given line. Using this approach, you don't need any calculus, just simple trig/geometry. Commented Apr 21, 2013 at 11:27
• It's not a standard result, but it's based on well-known geometric facts. A chord subtends the same angle at all points on a circle. Obviously the angle will get bigger as the circle radius gets smaller. I expect I could prove all this. But it would be messy, and your original reasoning will work, anyway, if you take a bit more care with angles, as I suggested. Commented Apr 21, 2013 at 13:36

Let $C(x_c,m\,x_c)$ be the point on the line. By law of cosines $$\theta=\arccos \bigg(\frac{q^2+p^2-c^2}{2\, p\, q}\bigg)$$ where $$p=\sqrt{(x_2-x_c)^2+(y_2-m\,x_c)^2}$$ $$q=\sqrt{(x_1-x_c)^2+(y_1-m\,x_c)^2}$$ $$c=\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$ If you differentiate wrt $x;_c$ and solve for $x_c$ in $\frac{d\theta}{dx_c}=0$ set of solution $$x_c=\frac{x_1\,y_2-x_2\,y_1}{m\,x_1-m\,x_2-y_1+y_2}$$ $$x_c=\frac{(1+m^2)(x_1y_2-x_2y_1)-\sqrt{(1+m^2)(mx_1-y_1)(mx_2-y_2)\big((x_1-x_2)^2+(y_1-y_2)^2\big)}}{(1+m^2)(m(x_1-x_2)-y_1+y_2)}$$ $$x_c=\frac{(1+m^2)(x_1y_2-x_2y_1)+\sqrt{(1+m^2)(mx_1-y_1)(mx_2-y_2)\big((x_1-x_2)^2+(y_1-y_2)^2\big)}}{(1+m^2)(m(x_1-x_2)-y_1+y_2)}$$ If you run the second derivative test you will see that max occurs at (it depends on relative location of P, Q and the line) $$x_c=\frac{(1+m^2)(x_1y_2-x_2y_1)-\sqrt{(1+m^2)(mx_1-y_1)(mx_2-y_2)\big((x_1-x_2)^2+(y_1-y_2)^2\big)}}{(1+m^2)(m(x_1-x_2)-y_1+y_2)}$$
• Maybe I got the hint- arccos has the range of $[0,\pi]$ and that can return a maximum value which might be obtuse. Commented Apr 21, 2013 at 11:08