# Trig Question

**URL:** <https://boards.straightdope.com/t/trig-question/155330>\
**Category:** Factual Questions\
**Created:** [February 15, 2003, 11:51pm UTC](https://boards.straightdope.com/t/trig-question/155330 "2003-02-15T23:51:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![BioHazard](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BioHazard](https://boards.straightdope.com/u/BioHazard)\
**Post date:** [February 15, 2003, 11:51pm UTC](https://boards.straightdope.com/t/trig-question/155330/1 "2003-02-15T23:51:11Z")

</div>

If you have 3 points on a cartesian definining 2 lines with a shared endpoint, how do you find the number of degrees between the two lines?

PointA and PointB is Line1  
PointB and PointC is Line2

Help please.

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [February 16, 2003, 12:01am UTC](https://boards.straightdope.com/t/trig-question/155330/2 "2003-02-16T00:01:56Z")

</div>

Let’s say you have a triangle with lengths a, b, and c. The angle opposite c is C.

c[sup]2[/sup] = a[sup]2[/sup] + b[sup]2[/sup] - 2(a)(b)(cos C)

Then solve for C.

---

<div class="post-metadata">

**Author:** ![BioHazard](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BioHazard](https://boards.straightdope.com/u/BioHazard)\
**Post date:** [February 16, 2003, 12:06am UTC](https://boards.straightdope.com/t/trig-question/155330/3 "2003-02-16T00:06:47Z")

</div>

So you have to figure out the lengths first?

---

<div class="post-metadata">

**Author:** ![John\_Mace](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/john_mace/32/185_2.png) [@John\_Mace](https://boards.straightdope.com/u/John_Mace)\
**Post date:** [February 16, 2003, 12:14am UTC](https://boards.straightdope.com/t/trig-question/155330/4 "2003-02-16T00:14:45Z")

</div>

180 - arctan(absval(yB-yA)/(xB-xA)) - arctan(absval(yB-yC)/(xB-xC))

What you are doing is finding the angles of the other 2 sides of the triangle and subtracting them from 180.

---

<div class="post-metadata">

**Author:** ![Crafter\_Man](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crafter_man/32/458_2.png) [@Crafter\_Man](https://boards.straightdope.com/u/Crafter_Man)\
**Post date:** [February 16, 2003, 12:25am UTC](https://boards.straightdope.com/t/trig-question/155330/5 "2003-02-16T00:25:08Z")

</div>

> [@](#):
>
> \*Originally posted by BioHazard \*  
> \*\*So you have to figure out the lengths first? \*\*

Yea, but that’s easy enough. Use Pythagorean’s Theorem.

---

<div class="post-metadata">

**Author:** ![moes\_lotion](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@moes\_lotion](https://boards.straightdope.com/u/moes_lotion)\
**Post date:** [February 16, 2003, 12:30am UTC](https://boards.straightdope.com/t/trig-question/155330/6 "2003-02-16T00:30:32Z")

</div>

Another way of stating **Crafter\_Man** ’s answer is as follows. The dot product of two vectors **v** [sub]1[/sub] and **v** [sub]2[/sub] is defined as **v** [sub]1[/sub]. **v** [sub]2[/sub] = v[sub]1[/sub]v[sub]2[/sub]cos W where v[sub]1[/sub] and v[sub]2[/sub] are the magnitudes (lengths) of the vectors and W is the angle between. Given the three points A(x[sub]a[/sub],y[sub]a[/sub]), B(x[sub]b[/sub],y[sub]b[/sub]), C(x[sub]c[/sub],y[sub]c[/sub]) and defining the vectors **v** [sub]1[/sub] as (x[sub]b[/sub]-x[sub]a[/sub], y[sub]b[/sub]-y[sub]a[/sub]) and **v** [sub]2[/sub] as (x[sub]b[/sub]-x[sub]c[/sub],y[sub]b[/sub]-y[sub]c[/sub]), then:

if D = (x[sub]b[/sub]-x[sub]a[/sub])(x[sub]b[/sub] - x[sub]c[/sub]) + (y[sub]b[/sub]-y[sub]a[/sub])(y[sub]b[/sub]-y[sub]c[/sub])

and N = sqr{(x[sub]b[/sub]-x[sub]a[/sub])^2+(y[sub]b[/sub]-y[sub]a[/sub])^2}sqr{(x[sub]b[/sub]-x[sub]c[/sub])^2+(y[sub]b[/sub]-y[sub]c[/sub])^2}

then cosW = D/N and W = cos[sup]-1/sup

Easy, wasn’t it!

---

<div class="post-metadata">

**Author:** ![BioHazard](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BioHazard](https://boards.straightdope.com/u/BioHazard)\
**Post date:** [February 16, 2003, 12:50am UTC](https://boards.straightdope.com/t/trig-question/155330/7 "2003-02-16T00:50:34Z")

</div>

so the angle I’m looking for is  
angle = 180 - arctan(absval(yB-yA)/(xB-xA)) - arctan(absval(yB-yC)/(xB-xC))

???

---

<div class="post-metadata">

**Author:** ![John\_Mace](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/john_mace/32/185_2.png) [@John\_Mace](https://boards.straightdope.com/u/John_Mace)\
**Post date:** [February 16, 2003, 1:10am UTC](https://boards.straightdope.com/t/trig-question/155330/8 "2003-02-16T01:10:50Z")

</div>

Yes

---

<div class="post-metadata">

**Author:** ![BioHazard](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BioHazard](https://boards.straightdope.com/u/BioHazard)\
**Post date:** [February 16, 2003, 1:15am UTC](https://boards.straightdope.com/t/trig-question/155330/9 "2003-02-16T01:15:02Z")

</div>

moes,

and N = sqr{(xb-xa)^2+(yb-ya)^2}sqr{(xb-xc)^2+(yb-yc)^2}

what does the { } mean? same as () ? so that would be sqr(etc)\*sqr(etc)

???

---

<div class="post-metadata">

**Author:** ![moes\_lotion](https://avatars.discourse-cdn.com/v4/letter/m/7ba0ec/32.png) [@moes\_lotion](https://boards.straightdope.com/u/moes_lotion)\
**Post date:** [February 16, 2003, 1:53am UTC](https://boards.straightdope.com/t/trig-question/155330/10 "2003-02-16T01:53:12Z")

</div>

Yes, the curly braces are there just to try to keep clear the groupings… I was also starting to suffer from square bracket overload doing all that vbCoding. The magnitude of a vector is calculated using the square root of the sum of the squares of the x and y components as usual, the denominator of the expression is the product of the two magnitudes. It’s not a pretty formula, but if all you are given is the coordinates of the three points, it’s the most straight forward one I could dredge up from memory. Like all such formulae, calculating the angle requires performing an inverse trig function at some point. However, most all scientific calculators ahve these built in… {not like the good old days of slide rules and trig tables like when I was a wee shrubbery}

---

<div class="post-metadata">

**Author:** ![Jinx](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jinx](https://boards.straightdope.com/u/Jinx)\
**Post date:** [February 16, 2003, 5:32am UTC](https://boards.straightdope.com/t/trig-question/155330/11 "2003-02-16T05:32:45Z")

</div>

BioHazard, some math teachers like to play with words to help their students remember a math formula. Given two points on the Cartesian plane, the distance between them is “the square root of the square of the sums of the differences”. My trig teacher liked to run this phrase by us as often as he could…  
Or, in other words: D = ((x1-x0)^2 + (y1-y0)^2)^0.5

---

<div class="post-metadata">

**Author:** ![Jinx](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@Jinx](https://boards.straightdope.com/u/Jinx)\
**Post date:** [February 16, 2003, 5:33am UTC](https://boards.straightdope.com/t/trig-question/155330/12 "2003-02-16T05:33:58Z")

</div>

Oops! It SHOULD read as : “square root of the sum of the squares of the differences” - Jinx

---

<div class="post-metadata">

**Author:** ![BioHazard](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@BioHazard](https://boards.straightdope.com/u/BioHazard)\
**Post date:** [February 16, 2003, 7:51pm UTC](https://boards.straightdope.com/t/trig-question/155330/13 "2003-02-16T19:51:12Z")

</div>

Thanks guys!

I’m only a little dizzy right now…

_falls down_
