Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

So i'm writing a program, and i need to write a method that will give me the angle of a specific angle of a triangle when i know only the adjacent length and opposite length. I know that "tan(A) = opposite/adjacent", but how would i solve for A in that equation?

share|improve this question
1  
Have you heard of inverse trigonometric functions. See here... en.wikipedia.org/wiki/Inverse_trigonometric_functions –  user21436 Jan 13 '12 at 18:53
    
Never have been taught that in school, thank you very much! –  Steven Rogers Jan 13 '12 at 18:55

2 Answers 2

Basically, as George Watts said, you're looking for the inverse tangent function. Depending on what programming language, that's probably a function called atan or arctan or some variant of that.

As you said you're working in a right triangle, the angle you're looking for is $0<\theta<\frac{\pi}{2}$ (it's most likely that the function in your programming language will give an answer in radians, not in degrees) and $$\tan\theta=\frac{\text{opposite leg}}{\text{adjacent leg}}\;\;\Leftrightarrow\;\;\theta=\arctan\left(\frac{\text{opposite leg}}{\text{adjacent leg}}\right).$$

Note that if you're not exactly trying to find an acute angle in a right triangle (e.g. if you're trying to find the angle of inclination of a line), you might be better off with the 2-argument arctan function (often atan2) or some other technique.

share|improve this answer

In terms of software, you have two options: you can search for a trig library that will make inverse tan available as a function/method or you can construct a look-up table. A look up table could be a two-dimensional array with angles from 0 to 180 in one column and corresponding inverse tan values in the other column.

share|improve this answer
    
A look-up table will be cumbersome if the input angles are allowed to be non-integers. –  Austin Mohr Jan 13 '12 at 21:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.