I want to calculate this simple problem
$$\cos(\arctan(-2))$$
My attempts,
$$\sin^2x+\cos^2x=1$$ $$\tan^2x+1=\frac1{\cos^2x}$$ $$\cos x= ±\sqrt{\frac1{\tan^2x+1}}$$
Then, I wrote $\tan x=-2$ where $x=\arctan(-2)$ then, I must find $\cos x=?$
I find $$\cos x=±\frac1{\sqrt5}$$ or $$\cos(\arctan(-2))=±\frac1{\sqrt5}$$
Where is the mistake in my attempts? Because the answer is $$\cos(\arctan(-2))=\frac1{\sqrt5}$$
You should take only the positive square root, because $\arctan(-2)\in\left(-\frac\pi2,\frac\pi2\right)$ and therefore $\cos\bigl(\arctan(-2)\bigr)>0$.