# Mental estimate for tangent of an angle (from $0$ to $90$ degrees)

Does anyone know of a way to estimate the tangent of an angle in their head? Accuracy is not critically important, but within $5%$ percent would probably be good, 10% may be acceptable.

I can estimate sines and cosines quite well, but I consider division of/by arbitrary values to be too complex for this task. Multiplication of a few values is generally acceptable, and addition and subtraction are fine.

My angles are in degrees, and I prefer not have to mentally convert to radians, though I can if necessary. Also, all angles I'm concerned with are in the range of [0, 90 degrees].

I am also interested in estimating arc tangent under the same conditions, to within about 5-degrees would be good.

Backstory

I'm working on estimating the path of the sun across the sky. I can estimate the declination pretty easily, but now I want to estimate the amount of daylight on any given day and latitude. I've got it down to the arc cosine of the product of two tangents, but resolving the two tangents is now my sticking point. I also want to calculate the altitude of the sun for any time of day, day of the year, and latitude, which I have down to just an arc tangent.

• Darn it. I had a wonderful method, until I read that you prefer not to convert to radians – Ataraxia Jul 17 '13 at 20:13
• To get a ballpark figure, you could use $\frac{x}{90-x}$, which is more accurate near $45^{\circ}$ (the relative error decreases as $x \to 45$). But it does not stay within 5 or 10 percent accuracy, so I hesitate to post it as a solution. I guess if you like it, you may post it yourself :) – Shaun Ault Jul 17 '13 at 20:21
• My idea was to use a piecewise power series approximation. Up to 22 degrees, $\tan(x)=x$ within 5% accuracy. Beyond that would have to be $tan(x)=x+x^3/3$. However this only works when $x$ is in radians, so it doesn't fully solve the asker's problem. But figured it was worth mentioning. – Ataraxia Jul 17 '13 at 20:27
• This is a fantastic pursuit, and I wish you luck! I starred this so I can learn how to do this once someone posts an answer. – Jesse Smith Jul 17 '13 at 20:51
• Do you accept the result as a fraction? – RicardoCruz Jul 17 '13 at 22:48

If you want to stay within 10%, the following piecewise linear function satisfies $$.9\tan\theta \le y \le 1.1\tan\theta$$ for $0\le\theta\le60$ degrees:

$$y={\theta\over60}\text{ for }0\le\theta\le20$$ $$y={2\theta-15\over75}\text{ for }20\le\theta\le45$$ $$y={\theta-20\over25}\text{ for }45\le\theta\le60$$

It might help to rewrite them as

$$y={5\theta\over300}\text{ for }0\le\theta\le20$$ $$y={8\theta-60\over300}\text{ for }20\le\theta\le45$$ $$y={4\theta-80\over100}\text{ for }45\le\theta\le60$$

so that you really don't have to divide by anything other than $3$. The line segment approximations lie above $\tan\theta$ from $\theta\approx25$ to $\theta=45$ and below it elsewhere, so you should round down and up accordingly when doing the mental arithmetic.It's obviously possible to extend this for angles greater than $60$ degrees, but whether (or how far) you can do so with formulas that use only "simple" multiplications and divisions is unclear.

A word of explanation: What I tried to do here was take seriously the OP's request for estimates you can calculate in your head. The ability to do mental arithmetic, of course, varies from person to person, so I used myself as a gauge. As for where the formulas came from, my starting point was the observation that the conversion factor between degrees and radians, $180/\pi$, is approximately $60$, so the estimate $\tan\theta\approx\theta/60$ should be OK for a while. A little trial and error showed it's good up to $\theta=20$ degrees (since $.9\tan20\approx.328$). It was easy to see that connecting $(0,0)$ to $(20,1/3)$ and $(20,1/3)$ to $(45,1)$ with straight lines would stay within the prescribed bounds. Finally, noting that $.9\tan60\approx1.55$, I saw that the line connecting $(45,1)$ to $(60,1.6)$ would have a nice slope and stay within the prescribed bounds as well.

Consider trivial trig identity: $$\tag 1\tan(a+b) = \frac {\tan a + \tan b}{1-\tan a\tan b}$$ Now substitute: $$\tan a = N_1/D_1$$ $$\tan b = N_2/D_2$$ So 1 becomes: $$\tag 2\tan(a+b) =\frac {N_1D_2+N_2D_1}{D_1D_2-N_1N_2}$$ $$\tag 3\tan(a-b) =\frac {N_1D_2-N_2D_1}{D_1D_2+N_1N_2}$$ And use this "magic hash table": $$\tan 26.57^\circ = 1/2$$ $$\tan 18.43^\circ = 1/3$$ $$\tan 14.04^\circ = 1/4$$ $$\tan 11.31^\circ = 1/5$$

And a following useful identities for small angels in radians $$\tan a = a, |a| <0.05 (3.0 ^\circ)$$ And for angles more than $45^\circ$ $$\tan a = 1/\tan(90°−a)$$

You can also recursively repeat this process to get more and more precious approximation then:

$$a_i=a_{i-1}\pm b_{i-1}$$

$$\tag 4 \tan b_i=b_i=x - a_i$$

Where $a_0$ and $b_0$ picked from the table and $x$ is initial angle value

While evaluating $(4)$ you need conversion to radians. It is simply multiplication on $7/400$ So you need to aproximate $x-a_i$ with such fraction what it has $7$ in denominator and/or dividers of $400$ in numerator.

Google for "Fast_Approximation_of_Elementary_Functions.pdf" paper for further information on this trick. Direct link is prohibitted for some strange reason.

P.S. Drawing for using instead of remebering the hash table and for fast picking of $a_0$ $b_0$:

P.P.S. To remember $(2)$ consider product of two complex numbers $$z=(D1,N1)(D2,N2)$$ so $(2)$ becomes:
$$\frac {\Im z}{\Re z}$$ to get $(3)$ just swap signs

• I think the identity $\tan a \approx a$ is only valid if you write $a$ in radians. – Ali Jul 18 '13 at 10:44
• Yes, should mention this explicit in the text. – igumnov Jul 18 '13 at 10:47
• Great, I've seen that paper before been at that time I was learning how to approximate exponentials so I disregarded the tangent, and subsequently couldn't remember the name of the paper. Anyway, this does look like a very good method, but it will definitely take some time to get a knack for it and memorize the "magic hash table" =) – brianmearns Jul 18 '13 at 10:52
• Do not remember anything and do not calculate first round of approximation just use the picture from papper i added. – igumnov Jul 18 '13 at 11:18

Because of the numerical coincidence that $(\pi/180)^2/3$ is nearly $10^{-4}$, the Taylor polynomial $\tan x \approx x+x^3/3$ becomes nearly $$\tan(y {\rm\ deg}) \approx .017y(1+10^{-4}y^2)$$ which seems to be accurate within 5 percent up to about 38 degrees, and within about 8 percent up to 45 degrees. Beyond 45 degrees I don't know what to do unless you can divide as in $\tan x = 1/\tan(\pi/2-x)$.

For $\theta = \frac{180^{\circ}}{\pi}\arctan x$ you can use: $$\theta \approx \frac{180x}{3+x} \quad \mathrm{for} \quad 0 \leq x \leq 1$$ $$\theta \approx 90^{\circ}- \frac{180}{3x+1} \quad \mathrm{for} \quad x > 1$$ where $\theta$ is measured in degrees.

This may not be the best for in-your-head calculation, but for $x$ in degrees $$\tan\left(\frac{\pi x}{180}\right)\approx\frac{x(990-4x)}{(90-x)(630+4x)}\tag{1}$$ is at most $0.6\%$ off for $0\le x\le90$.

Here is a plot of the relative error:$\displaystyle\left.\frac{x(990-4x)}{(90-x)(630+4x)}\middle/\tan\left(\frac{\pi x}{180}\right)-1\right.$ :

$\hspace{2cm}$

Equation $(1)$ looks a little daunting, but at least $x$ is in degrees, and the relative error is quite small. Really, the only constant that needs to be remembered for $(1)$ is $\frac{990}{4}$; that is, $$P(x)=x\left(\frac{990}{4}-x\right)\implies\tan\left(\frac{\pi x}{180}\right)\approx\frac{P(x)}{P(90-x)}\tag{2}$$

• Wow, that's a pretty remarkable error, but you're right, that would be a bit much for mental math, primarily because there are so many different values to keep track of. I wonder if it can be simplified any more, allowing for more generous error bounds. – brianmearns Jul 18 '13 at 10:55
• @sh1ftst0rm: If we recall that $\tan(90^\circ-x)\tan(x)=1$, we only need to remember $\frac{990}{4}$. Let $P(x)=x\left(\frac{990}{4}-x\right)$, then \begin{align} \tan\left(\frac{\pi x}{180}\right) &=\frac{P(x)}{P(90-x)}\\ &=\frac{x\left(\frac{990}{4}-x\right)}{(90-x)\left(\frac{630}{4}+x\right)} \end{align} Still the numerator and denominator are quadratics. – robjohn Jul 18 '13 at 11:51

We have $\tan(x) = \frac{1}{\cot(x)}$, so split $[0,\frac{\pi}{2}]$ into 4 invervals of length $\frac{\pi}{8}$ and then use

\begin{align} f_1(x) &= x & f_2(x) &= -0.19+1.5x \\ f_3(x) &= \frac{1}{f_2(\frac{\pi}{2}-x)} & f_4(x) &= \frac{1}{f_1(\frac{\pi}{2}-x)} \end{align}

Functions $f_1$ and $f_4$ have relative error of $6\%$ while $f_2$ and $f_3$ about $4\%$, see: here, here, here and here.

I know this is in radians and contains division, but it still might help ;-)

This is probably way too simplistic, but I think of it literally as "slope". In other words, if you have an angle with a leg on the positive x-axis, the line that is tangent to the angle (thinking of tangent literally like the tangent to a circle) is the other leg of the angle, and the slope $\frac{y}{x}$ of this line, is the value of the trigonometric tangent function. So if you have ways to estimate slope (there are simple tools for this), you can use that as a tangent estimate as long as you can frame your problem in a context in which "slope" makes sense. Ultimately, though, this is just a guessing / eyeballing / memorization method, but if you do memorize a few reference values ($45^\circ$ an obvious one), I think it is possible without an extreme amount of rote memorization to make very rough estimates. For more accuracy, or at least a cross-reference, could make a similar triangle, estimate a ratio for the legs directly, and perform the single division.

The function $$f(x):={{3\over2}x-{1\over100}x^2\over 90-x}$$ produces a relative error which is less than $6\%$ over the whole range $[0,{\pi\over2}[\$. See the following figure: