# (Basic) Trig Question

#### Othersider

Registered Member
Hi all,

I have a trig question related to some programming I'm doing (rotating images), but my school doesn't cover trig until next year or so. I think this should be fairly simple. Here's my diagram:

Given x, y, and z as integers representing the lengths of the sides of this triangle, is there any way to find the measure of angle a? Would it be possible if the triangle is NOT right? And how would the solution change if the triangle is right?

Thanks in advance .

The sides and angle are related by the cosine rule:

z<sup>2</sup> = x<sup>2</sup> + y<sup>2</sup> - 2xy cos a

Notice that for a right angled triangle, with a=90 degrees, this formula is just Pythagoras's theorem (and z is the hypotenuse). But it also works when a doesn't equal 90 degrees.

Thanks for the reply.

Completely new example (ignore values of old variables from above). Given:
cos(x) = y

If I know y, how can I find x? Programmatically there are methods for finding an angle from an arc cosine and a hyperbolic cosine, but I don't think either work for what I'm trying to do. I'm not sure entirely sure at all...

Sorry for the confusion.

If cos(x) = y then x = arccos(y).

In words, x is the inverse cosine of y. If you're programming a computer, the relevant function will probably be called something like acos(y) (depending on what programming language you're using).