1995 USAMO Problems/Problem 2 I tried to solve this problem:

A calculator is broken so that the only keys that still work are the $\sin, \cos, \tan, \sin^{-1}, \cos^{-1}, \tan^{-1}$ buttons. The display initially shows $0$. Given any positive rational number $q$ show that pressing some finite sequence of buttons will yield $q$. Assume that the calculator does real number calculations with infinite precision. All functions are in terms of radians.

and i want to know how the author of the solution came up with $\sqrt {\frac m n}$.
 A: Since $\cos^{-1}\sin\theta = \pi/2 - \theta$ and $\tan(\pi/2 - \theta) = 1/\tan \theta$ for $0 < \theta < \pi/2$, we have for any $x > 0$,$$\tan\cos^{-1}\sin\tan^{-1}x = \tan(\pi/2 - \tan^{-1}x) = 1/x.\tag*{$(1)$}$$Also for $x \ge 0$,$$\cos\tan^{-1}\sqrt{x} = 1/\sqrt{x + 1}.\tag*{$(2)$}$$By $(1)$ and $(2)$, we can obtain $\sqrt{r}$ for any nonnegative rational number $r$ that can be obtained from $0$ using the operations$$x \mapsto x + 1 \text{ and }x \mapsto 1/x.$$We now prove that every nonnegative rational number $r$ can be so obtained, by induction on the denominator of $r$. If the denominator is $1$, we can obtain the nonnegative integer $r$ by repeated application of $x \mapsto x + 1$. Now assume we can get all $r$ with denominator up to $n$. In particular, we can get any of$${{n+1}\over1},\,{{n+1}\over2},\dots,\,{{n+1}\over{n}},$$so we can also get$${1\over{n+1}},\,{2\over{n+1}}, \dots ,\,{n\over{n+1}},$$and any positive $r$ of exact denominator $n + 1$ can be obtained by repeatedly adding $1$ to one of these.
Thus for any positive rational number $r$, we can obtain $\sqrt{r}$. In particular, we can obtain $\sqrt{q^2} = q$.
