Angle between segments resting against a circle Motivation:
A couple of days ago, when I was solving this question, I had to consider a configuration like this

Now, I didn't intentionally make those two yellow bars stand at what appears to be a $90^{\circ}$-angle but it struck me as an interesting situation, so much so that I thought the following question might be an interesting one to solve.
The Question:
Given a circle of radius $r$, a horizontal line a distance $c>r$ from the circle's centre, and two points $A$ and $B$ on that line located as indicated in the picture below, find the angle $\Theta$ as a function of the parameters given ($a,b,c,r$). The blue and red lines passing through $M$ are tangents to the circle, at $P$ and $Q$ respectively.


Set Cartesian coordinates on the plane so that the center of the circle
is $(0,0)$ and the black line $\overline{AB}$ is parallel to the $x$-axis.
The coordinates of $A$ are $(-(a - b), c)$ and the distance $OA$ is
$\sqrt{(a - b)^2 + c^2}$. Therefore 
\begin{align}
\angle OAB & = \arcsin\left( \frac{\sqrt{(a - b)^2 + c^2}}{c} \right)
= \arctan \left( \frac{c}{a-b} \right) & \text{and} \\
\angle OAQ & = \arcsin\left( \frac{\sqrt{(a - b)^2 + c^2}}{r} \right).
\end{align}
The coordinates of $B$ are $(b, c)$ and the distance $OB$ is
$\sqrt{b^2 + c^2}$, so 
\begin{align}
\angle OBA & = \arcsin\left( \frac{\sqrt{b^2 + c^2}}{c} \right)
= \arctan \left( \frac cb \right) & \text{and} \\
\angle OBP & = \arcsin\left( \frac{\sqrt{b^2 + c^2}}{r} \right).
\end{align}
Since $\angle BAM = \angle OAB + \angle OAQ$
and $\angle ABM = \angle OBA - \angle OBP$,
and $\theta = \pi - \angle BAM - \angle ABM$,
\begin{align}
\theta & = \pi - (\angle OAB + \angle OAQ) - (\angle OBA - \angle OBP) \\
& = \pi - \arctan \frac{c}{a-b}
        - \arcsin \frac{\sqrt{(a - b)^2 + c^2}}{r} 
        - \arctan \frac cb
        + \arcsin \frac{\sqrt{b^2 + c^2}}{r} .
\end{align}

Another approach: consider the figure below, which shows line $\overline{AB}$
and segments  $\overline{OP}$ and $\overline{BP}$. It also shows the
perpendicular from $O$ to $\overline{AB}$, which intersects $\overline{AB}$
at $C$ and $\overline{BP}$ at $R$.

From the original problem statement, we have $OP = r$, $BC = |b|$, and $OC = c$.
Let $OR = |u|$, with $u$ positive if $R$ is between $O$ and $C$ as shown. Then $CR = |c - u|$ and $PR = \sqrt{u^2 - r^2}$, and by similar triangles,
$$ \frac{\sqrt{u^2 - r^2}}{r} = \pm\frac{c - u}{b}.$$
There are actually three cases represented here:


*

*$b > 0$, shown in the figure;

*$-r < b < 0$, in which case $R$ is on the extension of $\overline{OC}$ beyond $C$, $u > c$, and $\triangle BCR$ has (positive) leg lengths $-b$ and $u - c$; and

*$b < -r$, in which case $R$ is on the extension of $\overline{OC}$ beyond $O$, $u < -r$, and $\triangle BCR$ has (positive) leg lengths $-b$ and $c - u = c + |u|$. This is the case that requires the "$-$" option of the $\pm$ sign.


In all three cases I assume $c > r$.
Squaring both sides of this equation and rearranging terms appropriately,
we get:
$$ (b^2 - r^2)u^2 + 2cr^2 u - (b^2 + c^2)r^2 = 0.  \tag 1$$
If $b^2 \neq r^2$ this is a quadratic equation in $u$, and it has roots
$$ u = \frac{-cr^2 \pm br \sqrt{b^2 + c^2 - r^2}}{b^2 - r^2}.$$
We want the positive root if $b > -r$ and the negative root if $b < -r$, so
$$ \angle CBP = \arccos \frac ru 
 =
\begin{cases}
\arccos  \dfrac{b^2 - r^2}{-cr + b \sqrt{b^2 + c^2 - r^2}}
 & \text{if $b > r$} \\
\arccos  \dfrac{b^2 - r^2}{-cr - b \sqrt{b^2 + c^2 - r^2}}
 & \text{if $b < r$ and $b \neq -r$.}
\end{cases}$$
But if $b = r$, then
$ u = \dfrac{c^2+r^2}{2 c} $
and
$$ \angle CBP = \arccos \frac ru 
 = \arccos  \frac{2cr}{c^2+r^2} ,$$
whereas if $b = -r$ then $\angle CBP = \frac\pi2$.
And oh, look, all of these formulas apply to $\angle BAQ$ in the original figure
if we substitute $b - a$ for $b$ 
(and $b - a < -r$ provided that $\angle BAQ$ is acute, as shown), so
if we assume $b > -r$,
\begin{align}
\theta & = \pi - \angle BAQ - \angle CBP \\
& \begin{aligned}
      = \pi & - \arccos  \dfrac{(a - b)^2 - r^2}
                               {-cr + (a - b) \sqrt{(a - b)^2 + c^2 - r^2}} \\
            & - \begin{cases}
                 \arccos  \dfrac{b^2 - r^2}{-cr + b \sqrt{b^2 + c^2 - r^2}}
                  & \text{if $b > r$} \\
                 \arccos  \dfrac{b^2 - r^2}{-cr - b \sqrt{b^2 + c^2 - r^2}}
                  & \text{if $-r < b < r$} \\
                 \arccos  \dfrac{2cr}{c^2+r^2} & \text{if $b = r$}
                \end{cases}
  \end{aligned} \\
&  = \arcsin \dfrac{(a - b)^2 - r^2}
                   {-cr + (a - b) \sqrt{(a - b)^2 + c^2 - r^2}} \\
& \qquad\qquad +
  \begin{cases}
    \arcsin  \dfrac{b^2 - r^2}{-cr + b \sqrt{b^2 + c^2 - r^2}}
     & \text{if $b > r$} \\
    \arcsin  \dfrac{b^2 - r^2}{-cr - b \sqrt{b^2 + c^2 - r^2}}
     & \text{if $-r < b < r$} \\
    \arcsin  \dfrac{2cr}{c^2+r^2} & \text{if $b = r$}
  \end{cases}
\end{align}
So that's just two trig functions, though there are three cases depending
on the value of $b$.
As suggested in a comment, we could get this down to one trig function if
we could find the three sides of $\triangle ABM$ without using trigonometry;
but I think this would involve saying something about the triangles
$\triangle OPM$ and $\triangle OQM$, and I do not yet see how to do it. 
