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-

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)}$$