High School Modules > Trigonometry by Gregory A. Moore
The Law of Cosines
Discussion of the law of cosines and applications to solving triangles.
[Directions : Execute the Code Resource section first. Although there will be no output immediately, these definitions are used later in this worksheet.]
0. Code
| > | restart; with(plots): |
Warning, the name changecoords has been redefined
| > | TriPlot := proc(A,B,C) local sA,sB,sC,d; d := 1/4: sA := [ (C[1]+B[1])/2, (C[2]+B[2])/2]; sB := [ (A[1]+C[1])/2, (A[2]+C[2])/2]; sC := [ (A[1]+B[1])/2, (A[2]+B[2])/2]; display( plot( [A,B,C,A], color = blue, thickness = 3, axes = none ), textplot( [A[1]-d, A[2]-d, `angle A`]), textplot( [B[1]+d, B[2]+d, `angle B`]), textplot( [C[1]+d, C[2]-d, `angle C`]), textplot( [sA[1]+2*d, sA[2], `side a`]), textplot( [sB[1], sB[2]+d, `side b`]), textplot( [sC[1]-2*d, sC[2]+d, `side c`]) ); end: |
| > | TriPlotN := proc(A,B,C) local sA,sB,sC,d, da,db,dc; d := 1/4: sA := [ (C[1]+B[1])/2, (C[2]+B[2])/2]; sB := [ (A[1]+C[1])/2, (A[2]+C[2])/2]; sC := [ (A[1]+B[1])/2, (A[2]+B[2])/2]; da := evalf(sqrt( (C[1]-B[1])^2 + (C[2]-B[2])^2 ),3); db := evalf(sqrt( (C[1]-A[1])^2 + (C[2]-A[2])^2 ),3); dc := evalf(sqrt( (A[1]-B[1])^2 + (A[2]-B[2])^2 ),3); display( plot( [A,B,C,A], color = blue, thickness = 3, axes = none ), textplot( [A[1]-d, A[2]-d, `angle A`]), textplot( [B[1]+d, B[2]+d, `angle B`]), textplot( [C[1]+d, C[2]-d, `angle C`]), textplot( [sA[1]+3*d, sA[2], cat(`a = `,convert(da,string))]), textplot( [sB[1], sB[2]+d, cat(`b = `,convert(db,string))]), textplot( [sC[1]-2*d, sC[2]+d, cat(`c = `,convert(dc,string))]) ); end: |
1. The Law of Cosines
The law of cosines is a generalization of Pythagoras' theorem that applies to non-right triangles.
| > | LoC := a^2 + b^2 -2*a*b*cos(theta) = c^2; |
| > | TriPlot([0,0],[10,6],[7,0]); |
Here is a table showing how changing the angle of a triangle affects the length of the opposite side (keeping the two sides which form the angle fixed in length).
| > | n := 8: a:= 3: b := 4: A := array( [seq( [ i*Pi/n, a, b, evalf(sqrt(a^2 + b^2 -2*a*b*cos(i*Pi/n))) ], i = -1..n ) ]): A[1,1] :=theta: A[1,2]:= 'a': A[1,3] := 'b': A[1,4]:=`c`: `With a & b fixed, theta increasing makes c increase`; print(A); |
| > | n := 8: a:= 5: b := 12: A := array( [seq( [ i*Pi/n, a, b, evalf(sqrt(a^2 + b^2 -2*a*b*cos(i*Pi/n))) ], i = -1..n ) ]): A[1,1] :=theta: A[1,2]:= 'a': A[1,3] := 'b': A[1,4]:=`c`: `With a & b fixed, theta increasing makes c increase`; print(A); |
| > | a:= 'a': b:= 'b': c:= 'c': |
2. Solving Triangles - Two Sides & Angle Known
Example 2.1 :
a = 100, b = 140, and the angle between them is 38 degrees. Find the third side.
| > | rad_angle := 38*(Pi/180); |
| > | subs( {a = 100, b = 140, theta = rad_angle}, LoC); |
| > | evalf(%); |
| > | solve(%, c): abs(%[1]); |
Of course, only the positive solution makes sense.
| > | TriPlotN([0,0],[140 + 100*cos(142*Pi/180), 100*sin(142*Pi/180)],[140,0]); |
Example 2.2 :
A right triangle has sides 7, 24, and 25. If the two bases are fixed in length, and the right angle is
increased to 95 degrees, how long will the hypotenuse be?
| > | rad_angle := 95*(Pi/180); |
| > | subs( {a = 7, b = 24, theta = rad_angle}, LoC); |
| > | evalf(%); solve(%, c): abs(%[1]); |
Example 2.3 :
A right triangle has sides 9, 40, and 41. If the two bases are fixed in length, and the right angle is
increased to 10%, what percentage increase will the hypotenuse experience?
| > | rad_angle := (Pi/2)*1.10; |
| > | subs( {a = 9, b = 40, theta = rad_angle}, LoC); |
| > | evalf(%); solve(%, c): abs(%[1]); |
| > | %/41; |
| > | %-1; |
| > | %*100,%; |
Example 2.4 :
A bug walks from the origin along the x-axis to the point (200,0). Then the bug turns left, and heads
off at 71 degrees above the axis, and walks 100 units. How far is the bug away from the origin?
| > | angle := 180 - 71; |
| > | rad_angle := (Pi/2)*angle; |
| > | subs( {a = 200, b = 100, theta = rad_angle}, LoC); |
| > | evalf(%); solve(%, c): abs(%[1]); |
3. Solving Triangles - Three Sides Known
The law of cosines has four unknowns - the three sides and an angle. If we know the three sides of a triangle, we can then find "the angle" - which is the angle opposite of the "hyptenuse" (although this is not necessarily a right triangle and the side opposite of the angle is not necessarily the longest side.)
Example 3.1 :
a = 31, b = 42, c = 22. Find the angle formed by sides a and b.
| > | subs( {a = 31, b = 42, c = 22 }, LoC); |
| > | solve( %, theta): % = evalf(%), `radians`; evalf( %%*180/Pi), `degrees`; |
In fact, a triangle has three angles and any of them can be considered the angle in the formula. This is selected implicitly by selecting which side is c - which is opposite of the angle in question.
Example 3.2 :
a = 10, b = 9, c = 8. Find all three angles.
| > | `the angle formed by sides a & b is opposite of side c`; subs( {a = 10, b = 9, c = 8}, LoC); |
| > | Angle_ab := solve( %, theta); % = evalf(%),` radians`; %% = evalf( %%*180/Pi), ` degrees`; |
Ok, we found the angle formed by sides a & b. What about the other angles? We can do this is two different ways - relabel the sides (now we call "a" by "c" and "c" by "a" and use the same formula) or create a new version of the formula with a and c reversed.
| > | `the angle formed by sides a & c is opposite of side b`; subs( {a = 8, b = 9, c = 10}, LoC); |
| > | Angle_ac := solve( %, theta); % = evalf(%),` radians`; %% = evalf( %%*180/Pi), ` degrees`; |
| > | `the angle formed by sides a & c is opposite of side b`; subs( {a = 10, b = 9, c = 8}, c^2 + b^2 -2*c*b*cos(theta) = a^2); |
| > | Angle_ac := solve( %, theta); % = evalf(%),` radians`; %% = evalf( %%*180/Pi), ` degrees`; |
We get the same answer either way of course. The third angle is easy to find
| > | Angle_bc := Pi - Angle_ab - Angle_ac; % = evalf(%),` radians`; %% = evalf( %%*180/Pi), ` degrees`; |
| > | Angle_ab, Angle_bc, Angle_ac: evalf(%,3), ` radians`; evalf(%%*180/Pi,3),` degrees`; |
| > |
© 2002 Waterloo Maple Inc