# 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?

• Draw a right angled triangle such that the tan of the one of the angles is $2$. Then calculate the cosine of that angle Jan 17 '16 at 20:47

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}$

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.

• Your usage of $\implies$ is, to say the least, misleading. As far as I know, the arctangent takes values in $(-\pi/2,\pi/2)$, where the cosine is positive (not the sine). Jan 17 '16 at 21:06
• Actually, $\arctan x: (-\infty, \infty) \to \left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$. Jan 17 '16 at 21:06
• @egreg Really? Why? Jan 17 '16 at 21:07
• @N.F.Taussig Duly noted, I will fix that. Jan 17 '16 at 21:08
• I suspect that egreg's objection is to the statement $\sin x = 2\cos x \Longrightarrow \sin^2x + \cos^2x = 1$. Jan 17 '16 at 21:10

$$\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}$$