Inverse tangent function


We're going to do a quick recap on the trigonometric function Tan and its inverse.  Nothing on this slide so far should surprise you. This is pretty standard high school maths.  We can re-arrange it to isolate Tan theta and we write that in terms of Y divided by X and then we can introduce the inverse tan function, so we can write theta in terms of the inverse tan of Y divided my X.

The inverse tan function is denoted in many different ways, but most commonly it's written as tan to the power of minus one, sometimes it’s written as A tan and sometimes it's written as Arc Tan.  They're perhaps the most common ways of representing the inverse tangent function.  Now let's look at some more complex cases, but we'll start off with the simplest of these cases.  And we have a triangle, its height is one, its width is two and the angle marked in the triangle is equal to 0.4636 radiance.  If I apply the inverse tan function to the ration one over two, then I get exactly the same value, 0.4636.  That's right for the case where the angle is negative.  In this case the width is two but the height is equal to minus one.

I can compute the arc tangent of minus one divided by two and I get the result which is minus 0.4636 just as I would expect.  Now let's consider the case of an angle that's bigger than Pi on two.  In this case the height is one and the width is equal to minus two.  In this case theta is equal to 2.6779 radiance.  If I compute the arc tangent of one over minus two, then I get a result which is minus 0.4636.  We see that there is a discrepancy between the actual angle of this line and the angle that is given to us by the arc tangent function.  And similarly for this case, the width is minus two, the height is minus one and if I compute the arc tangent of that, the result I get is 0.4636.  The problem in this last case is that negative one divided by negative two, gives a result which is the same as one divided by two.  It's a positive number and that's the same as the example we did at the beginning up here.

The underlying problem here is that inverse tan function has got a range which only spans from minus Pi on two to plus Pi on two.  To get around the problem we introduce a new function and it's commonly called "A Tan Two", you’ll find a function of this name in the mathematical library of many programming languages and you’ll certainly find it in MATLAB.  It takes into account the sign of A and the sign of B and from that information it can determine which quadrant of the circle the angle lies within.  So the range of this function is from minus Pi to plus Pi inclusive.  And here's a simple example using MATLAB, computing the arc tangent of one divided by minus two, it gives us the answer of 2.6779 radiance and that's an angle in the second quadrant of the circle.

A really important function when performing inverse kinematics is the inverse tangent or arctan function. We revise how this function works for angles in all quadrants of the circle and introduce a useful variant known as atan2.

Professor Peter Corke

Professor of Robotic Vision at QUT and Director of the Australian Centre for Robotic Vision (ACRV). Peter is also a Fellow of the IEEE, a senior Fellow of the Higher Education Academy, and on the editorial board of several robotics research journals.

Skill level

This content assumes an understanding of high school-level mathematics, e.g. trigonometry, algebra, calculus, physics (optics) and some knowledge/experience of programming (any language).

More information...

Rate this lesson


Check your understanding

Leave a comment