An idea becomes a theory when it is supported by observations and evidence. The idea is tested multiple times and if it gives similar results, then it is accepted and becomes a theory.
Einstein's general theory of relativity became theory when it was supported by various observations and evidence.
B. A hypothesis is just an idea. And can become a Theory if there is some evidence. However a Theory is not a law, but an idea with supportive evidence
Let t = Theta and p = Phi Tan t = y/x Then x =y/Tant. Tant = y/(x-d) x-d = y/Tanp y/Tant - d = y/Tanp y -d*Tanr = y*Tant/Tanp y-y*Tant/Tanp = d*Tanr y(1 - Tanr/Tanp = d*Tant