Distance from point in circle to edge of circle The situation is as follows:
I have a circle with a diameter of $20$ and a center at $(0,0)$.
A point $P$ inside that circle is at $(2,0)$.
How do I calculate the distance from $P$ to the edge of the circle for a given angle $\theta$?
 A: A different solution without having to solve an equation is by rotating the axis back and forth. (more suitable for mathematical programs)
r is the radius of the circle.
O is the origin at [0, 0].
P is any point within the circle [Px, Py].
Q is point at perimeter of the circle
θ is angle from point P to Q positive with x-axis
R is the rotation matrix  with R = [cosθ -sinθ; sinθ cosθ]
R' is the inverse rotation matrix
Now rotate such that x-axis is parallel to PQ.
Describe point P and Q as P'and Q' in the new axis orientation. 
P' = R'P
because of the parallel alligned the following formula's are true:
Q' = [Q'x, Q'y] = [r * cosφ, r * sinφ], 
with φ is angle from O to Q (positive with rotated x-axis)
Q'y = P'y
Substitute φ for P'y gives:
Q'x = r * sin(arccos(P'y/r))
Now all that is left to do is rotate the axis back how it was
Q = RQ'
you can now use pythagoras to get the length PQ
A: Let the centre of the circle be $O$, and let the point $(2,0)$ be $P$. Draw a line $PQ$ to the periphery of the circle, making an angle $\theta$ with the positive $x$-axis. We want to find the length of $PQ$.
Consider the triangle $OPQ$. We have $\angle OPQ=180^\circ-\theta$. By the Cosine Law, with $x=PQ$, we have
$$100=x^2+4-(2x)(2\cos(180^\circ-\theta))=x^2+4+4x\cos\theta.$$
This is a quadratic equation in $x$: Solve.
A: The distance from $(2,0)$ to $(20,0)$ + the distance from $(2,0)$ to $(0,0)$ equals the radius.
