How to compute $\cos(\arctan(2)) = 1/\sqrt{5}$ I'm doing matrices and I rotated a line about an angle. The gradient of my line I'm rotating to the $x$-axis is $2$, from $y=2x$. So obviously the angle that the line $y=2x$ makes with the $x$-axis is $\arctan(2)$.
My question is how do I arrive at  $\cos(\arctan(2)) = 1/\sqrt{5}$. <---
The $1/\sqrt{5}$ is what I'm confused with, how do I get this?
 A: We have
$$
\cos(x)=\frac{1}{\sqrt{\tan^2x+1}}
$$
for $0\le x\le \frac{\pi}{2}$.
This implies
$$
\cos(\arctan(2))=\frac{1}{\sqrt{\tan(\arctan(2))^2+1}}=
\frac{1}{\sqrt{2^2+1}}=\frac{1}{\sqrt{5}}
$$
because of $0\le\arctan(2)\le \frac{\pi}{2}$
A: Well..
Let $\arctan 2 = x$.
$\arctan (2) = x \implies \tan x = \sin x/\cos x = 2 \implies \sin x = 2 \cos x \implies  \sin^2 x + \cos^2 x =  4\cos^2 x + \cos^2 x = 1 \implies \cos^2 x = 1/5 \implies \cos x = \pm 1/\sqrt{5}$.
By convention $\arctan$ takes values in (-$\pi/2, \pi/2$) where $\cos$ is presumed to be positive.  So $\cos x = 1/\sqrt{5}$.
====
In general if $\tan x = b$ then $\sin x = b \cos x$ so $\sin^2 x + \cos^2 x = (b^2 + 1) \cos^2 x$ so $\cos x = 1/\sqrt{b^2 + 1}$ and hence the trig identity $\cos x = 1/\sqrt{\tan^2 x + 1}$ which is, confession time, one of those trig identities I absolutely can not remember and derive every single time.
A: $$\cos(\arctan(\color{red}2)) = \frac{\color{green}1}{\color{blue}{\sqrt{5}}}$$
$$\color{red}2^2 + \color{green}1^2 = \color{blue}{\sqrt 5}^2$$

$$\cos(\theta) = \frac{\color{green}1}{\color{blue}{\sqrt 5}}$$
$$\tan(\theta) = \frac{\color{red}2}{\color{green}1}$$
