I've been learning about the unit circle, sine, cosine, and the like in my introduction to trigonometry course, but I'm drawing a blank here.
If I have a circle centered at the origin, with radius r and point(x,y), how do I find the measure of the angle from (r,0) to (x,y)?
For example, if the radius is 1 and the point is ($-\frac{1}{\sqrt{2}}$,$\frac{1}{\sqrt{2}}$), the number I would want is 135 degrees, or the equivalent in radians.
edit: Actually, I would also appreciate a formula to calculate this measurement between any two points on a circle.
Best Answer
There is a two variable function, called $\text{atan2}$ in C, that may do the job for you, if something like it is built into the piece of software that you are using.
For some discussion of the $\text{atan2}$ function, see this.
Roughly speaking, $\text{atan2}(y,x)$ is $\arctan(y/x)$ if $x$ is positive. If $x$ is negative, and $y\ge 0$, then $\text{atan2}(y,x)=\pi+\arctan(y/x)$, while if $x<0$ and $y<0$, then $\text{atan2}(y,x)=-\pi+\arctan(y/x)$. And so the program won't blow up, $\text{atan2}(y,x)$ is defined in the reasonable way when $x=0$.
In particular, $\text{atan2}(1/\sqrt{2},-1/\sqrt{2})=3\pi/4$, precisely what you wanted. You may be less happy with $\text{atan2}(-1/\sqrt{2},-1/\sqrt{2})$.
Warning: While many software packages implement an $\text{atan2}$-like function, the name and the syntax are not universal. Sometimes $x$ and $y$ are interchanged. The details for Fortran, C, Mathematica, MATLAB, and Excel, to mention some examples, are slightly different!