# Trigonometry in computer science

What's the use of studying trigonometry in computer science? I mean, is it essential? Does it have a specific application in computer science? Because I can't seem to muster enough motivation for learning it.

• Isn't trig taught in high school? You make it seem like it's something you have to learn for a computer science curriculum at college. – gardenhead Jun 24 '14 at 0:40
• actually this could be an "early indicator." the numerous applications of trig are usually taught side-by-side with it (although there are many teaching styles). if you are turned off by a trig class, CS might not be for you, and conversely those that have an affinity for trig & other similar math classes will tend to do well/better in CS! also consider that maybe you just need a different teaching style/angle. – vzn Jun 24 '14 at 2:30

• Rotations: that arise in Computer Graphics and Robotics , through rotation matrices, Quaternions, etc.

• Cordics for computing these functions on a Microprocessor / FPGA

• Transforms in Image Compression and elsewhere , e.g. FFT computation in $O(n \log n)$ time

• Anything to do with the interface between CS and Signal Processing

• Pretty much anywhere in navigation and tracking, e.g. anything involving a GPS, IMU,etc.

• Somewhat indirectly in Computational Geometry (CG), in its application like in coverage & localization in wireless sensor networks.

.. to name a few! So if you want to really avoid trig functions, you should learn CG :-)

• do you mean at the end, you shouldnt learn CG to avoid trig? – vzn Jun 24 '14 at 2:26
• No I don't. I was merely referring to CG's inclination to avoid floating point computations - esp trig functions. – PKG Jun 24 '14 at 5:33
• huh? still not following. you think CG is "inclined to avoid floating point/trig functions"? do you have any ref for that? maybe as a technique to optimize (some) implementations? – vzn Jun 24 '14 at 15:02
• E.g See en.wikipedia.org/wiki/Point_in_polygon for inside-outside test. You could do this by summing the interior angles at a point and see whether you get 2pi - but due to finite precision effects you don't. That's my last comment. – PKG Jun 24 '14 at 18:57
• ok, it may be "inclined to avoid them" where possible but it is also awash in them – vzn Jun 24 '14 at 20:16

I assume laziness is not an issue here and you are interested in pursuing computer science and therefore want to be laser-sharp. But even then, our basic sciences seem to crop up everywhere later in higher studies, especially mathematics. And trigonometry comes up in mathematics a little too much to be ignored. If you want to go anywhere in any field, a minimum basic knowledge of related fields is a must.

Since computer science is fundamentally just mathematics, especially discrete algebra, strong mathematical roots don't hurt. I can imagine graphics could be one are where trigonometry can be directly applied.

Moreover, Trigonometry is nothing but a bunch of functions and their applications; how difficult can it be?

Interpolation. If by computer science you include numerical computing, any why the hell not, you often use trig functions in interpolation.

Sometimes you have a sampled version of a function, say a sampled signal, $<u_0, u_1, ...>$. You would like to find a function $f(t)$ such that $f(n*T) = u_n$, for some time period, $T$. Or maybe you don't care that $f(n*T)$ matches the $u_n$s exactly, but that it's in some sense the best approximation in its class. You could make $f$ a polynomial, say $f(t) = \sum_{k=0}^N a_k t^k$. But it turns out to be numerically superior to choose use the Chebyshev polynomials. These can be defined by $T_n(x) = \cos(n \arccos(x))$.

If you stick to applications of computer science strictly in the field of simple accounting (requiring some mastery of the four arithmetic operations) or classical database management (possibly enough with addition and subtraction), you can probably spend a whole carrier without ever requiring trigonometry.

For anything else, you'll need it someday.