# Distance from unit circle from opposite side of right triangle?

Programmer here with severely rusty math skills. If I have a unit circle (i.e. - radius equals 1), and a right triangle with angle theta whose vertex is at the center of the circle, how I can calculate the minimum distance of the circle from the opposite side of the triangle given a point on the circle?

Pardon my crude drawing, but given the picture I made below, I want to know what the distance is from the purple dot on the circle to the closest point on the blue line that is the opposite side of the right triangle with angle theta. Is there a formula that, given a point on the circle expressed in sin and cos values, and given an angle theta, will tell me what that distance is? If not a formula, then some source code that iteratively determines the value would be fine too, might even be better.

Note, you may have to zoom the picture to see the small purple dot that lies on the circumference of the circle.

• You use the angle $\theta$ to determine the position of the blue line. What variable(s) do you use to determine the position of the dot? Do you have $x,y$ coordinates for it or is it also specified by an angle? Could the dot be somewhere other than on the arc inside angle $\theta$? Can $\theta$ be negative or greater than $90$ degrees? If the dot is above the top of the blue line or below its bottom, do you want the diagonal distance to the nearest endpoint or just the horizontal distance? These are all things that should be documented somewhere. Sep 8, 2022 at 1:49

The coordinates of the purple point will be $$( \cos{\alpha}, \sin{\alpha})$$, where alpha is some angle. $$|\cos\theta - \cos\alpha|$$ Is your answer. To see why, make a right triangle whose hypotenuse is the radius that touches the purple dot.