\(cot^2a=\left(\dfrac{a^2-b^2}{2ab}\right)^2\Leftrightarrow\dfrac{cos^2a}{sin^2a}=\dfrac{a^4+b^4-2a^2b^2}{4a^2b^2}\)
\(\Leftrightarrow\dfrac{cos^2a}{sin^2a}+1=\dfrac{a^4+b^4-2a^2b^2}{4a^2b^2}+1\)
\(\Leftrightarrow\dfrac{1}{sin^2a}=\dfrac{a^4+b^4+2a^2b^2}{4a^2b^2}\)
\(\Leftrightarrow sin^2a=\dfrac{4a^2b^2}{a^4+b^4+2a^2b^2}\)
\(\Leftrightarrow cos^2a=1-sin^2a=1-\dfrac{4a^2b^2}{a^4+b^4+2a^2b^2}=\dfrac{a^4+b^4-2a^2b^2}{a^4+b^4+2a^2b^2}\)
\(\Leftrightarrow cos^2a=\left(\dfrac{a^2-b^2}{a^2+b^2}\right)^2\)
\(\Leftrightarrow cosa=\dfrac{a^2-b^2}{a^2+b^2}\)