Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Math Topics » geometry.pre-college.independent

Topic: how to find 3rd edge in triangle
Replies: 2   Last Post: Jul 31, 2008 10:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kirby Urner

Posts: 4,709
Registered: 12/6/04
Re: how to find 3rd edge in triangle
Posted: Aug 11, 2007 4:15 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> How can I compute the 3rd edge in a scalene triangle
> if I know the other 2 edges and the angle between
> them?
> Thank you.


Many techniques possible.

Here's one:

Put included angle C at origin of XY plane at (o,o),
with one known edge 'b' along +X, terminating at
B = (b,o), other edge 'a' terminating at coordinates
A = (x,y).

Now use x = len(a)*cos(C), y = len(a)*sin(C)
for the (x,y) coordinates of A, then the
distance formula to find len(c), the distance
twixt point A and point B.

It'd be good to cross-check your result with the
Law of Cosines i.e. a**2 + b**2 - 2*a*b*cos(C)
should equal c**2.

Here's a little Python program (see plaintext view
for significant whitespace):

"""
Triangle Algorithm for finding c,
given a, b and included angle C

by K. Urner
"""

from math import sqrt, sin, cos, radians, degrees

class Point:

def __init__(self, x=0, y=0):
self.x = x
self.y = y

def distance(self, other):
return sqrt((self.x - other.x)**2 + (self.y - other.y)**2)

def __repr__(self):
return 'Point (%s, %s)' % (self.x, self.y)

def triangle(C, a, b):
"""
Angle C in degrees at the origin, included between
two sides of length a, b, return length c.
"""
pB = Point(b, 0)
pA = Point(a*cos(radians(C)), a*sin(radians(C)))
return pA.distance(pB)

def test():
a = 5
b = 25
C = 120 # degrees
c = triangle(C, a, b)
print c
print "%s == %s ?" % (c**2, a**2 + b**2 - 2*a*b*cos(radians(C)))

if __name__ == '__main__':
test()



Kirby



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.