# Filling in gaps in a trig table

The previous post shows how you could use linear interpolation to fill in gaps in a table of logarithms. You could do the same for a table of sines and cosines, but there’s a better way. As before, we’ll assume you’re working by hand with just pencil, paper, and a handbook of tables.

## Linear interpolation

Suppose you want to find the sine of 12.3456° and you have a table of sines for angles in increments of 0.1°. In Table 4.10 of A&S we find

sin 12.3° = 0.21303 03862 74977
sin 12.4° = 0.21473 53271  67063

If we were to use linear interpolation, we’d estimate

sin 12.3456° = sin 12.3° + 0.456(sin 12.4° – sin 12.3°) = 0.21380 78393 21768

which is accurate to six decimal places.

## Better approach

Another approach would be to use the identity

sin(θ + φ) = sin θ cos φ + cos θ sin φ

rather than linear interpolation, setting θ = 12.3° and φ = 0.0456°. We can look up the sine and cosine of θ in our table, but how do we find the sine and cosine of φ?

The cosine is easy: set it to 1. For a small angle x (in radians) the cosine of x is approximately 1 with an error of less than x²/2. In radians,

φ = 0.0456 π/180 = 0.00079 58701 38909

and so the truncation error in approximating cos φ with 1 is about 3×10-7.

Computing the sine of φ is easy, but it requires converting φ to radians. You could probably find the conversion factor in your handbook, e.g. in Table 1.1 of A&S.

0.0456° = 0.0456 × 0.01745 32925 19943

Once φ is in radians, sin φ = φ with an error of less than φ³/6 (see here).

Putting the pieces together we have

sin(θ + φ) = sin 12.3° × 1 + cos 12.3° × φ

which, using the numbers above, gives us 0.21380785249034476, which is off by about 6×10-8.

## More accuracy

If we want even more accuracy, we need to find the weakest link in our calculation. The error in approximating sin φ as φ is on the order of φ³ while the error in approximating cos φ as 1 is on the order of φ², so the latter is the largest source of error.

If we approximate cos φ as 1 – φ²/2, the error is on the order of φ4, and the weakest link would be the sine approximation which has error on the order of φ³, which is still quite small. The overall error in computing sin 12.3456° would be less than 10-10 if we use this higher order approximation for cosine φ.

## Compare and contrast

Let’s go back to approximating the cosine of a small angle by 1 and compare the two approximation approaches above.

Linear interpolation:

sin 12.3456° = sin 12.3° + 0.456(sin 12.4° – sin 12.3°)

sin 12.3456° = sin 12.3° + 0.0456 (π/180) (cos 12.3°)

The the second terms in the two approaches are

0.0456(sin 12.4° – sin 12.3°)/0.1

and

0.0456 (π/180) (cos 12.3°).

The two are similar because

(sin 12.4° – sin 12.3°)/0.1 ≈ (π/180) (cos 12.3°).

The term on the left is the difference quotient for sine at 12.3° with step h = 0.1 and the term on the right is the derivative of sine at 12.3°.

Wait, isn’t the derivative of sine just cosine? It is when you’re working in radians, which is why calculus almost always uses radians, but when you work in degrees, the derivative of sine is π/180 times cosine.

What this shows is that if you approximate cosines of small angles as 1, the sum formula reduces to a one-term Taylor approximation.