<s>[INST] Certain types of tangent values I was messing around with values of the tangent function and came across something interesting. For example, we have
$$\tan^2(\frac{\pi}{4\cdot2}) = \dfrac{\sqrt{4} - \sqrt{2}}{\sqrt{4} + \sqrt{2}}, \tan^2(\frac{\pi}{3\cdot4}) = \dfrac{\sqrt{4} - \sqrt{3}}{\sqrt{4} + \sqrt{3}}, \tan^2(\frac{\pi}{1\cdot1}) = \frac{\sqrt{1} - \sqrt{1}}{\sqrt{1} + \sqrt{1}}.$$
All of these values satisfy
$$\tan^2(\frac{\pi}{m\cdot n}) = \dfrac{\sqrt{m} - \sqrt{n}}{\sqrt{m} + \sqrt{n}}.$$
How could I go about to find all pairs $(m,n)$ which satisfy the equation?
 [/INST] 
Incomplete answer: I can't proceed through the last step but I think for those with higher level math knowledge, it might be proceedable.

Consider$$\tan^2\left(\frac{\pi}{m\cdot n}\right) =\frac{\sin^2\left(\frac{\pi}{m\cdot n}\right)}{\cos^2\left(\frac{\pi}{m\cdot n}\right)}=\frac{1-\cos^2\left(\frac{\pi}{m\cdot n}\right)}{\cos^2\left(\frac{\pi}{m\cdot n}\right)}$$
Let$$x={\cos^2\left(\frac{\pi}{m\cdot n}\right)}$$
Then
$$ \frac{1-x}{x}=\dfrac{\sqrt{m} - \sqrt{n}}{\sqrt{m} + \sqrt{n}}$$
Simplifying
$$2x=\frac{\sqrt{m} + \sqrt{n}}{\sqrt m}$$
Note that
$$\cos\left(\frac{2\pi}{m\cdot n}\right)+1=2x$$
Hence,
$$\cos\left(\frac{2\pi}{m\cdot n}\right)=\frac{\sqrt{m} + \sqrt{n}}{\sqrt m}-1=\sqrt{\frac nm}$$
</s>