Using the Law of Cosines Calculator
This page finds the third side of a triangle from the other two sides and the angle between them. Side c is the square root of a squared plus b squared, minus 2 times a times b times the cosine of that angle. Sides 3 and 4 with a 90 degree angle give side 5. The cosine of 90 degrees is 0, so the subtraction drops out and the square root of 9 plus 16 is the square root of 25, which is 5.
The angle is in degrees. It must be greater than 0 and less than 180. An angle of 0 or 180 is rejected. The page does not solve for an angle when three sides are known, and it does not draw the triangle.
The headline is side c. The lines show the cosine, the sum of the squares, and side c. The copied sentence names both sides, the angle, and side c. Check 3, 4, and 90 before you trust another triangle.
What Side c Is
The headline is the length of the side opposite the angle you typed, in the same length unit as sides a and b. The page does not name the unit. If you typed inches, side c is in inches. If you typed meters, side c is in meters. Mixing units between a and b makes the result meaningless, and the page will not detect the mix.
For the sample, the cosine line is 0, the sum of the squares is 25, and side c is 5. Those three lines are the whole calculation once the right angle has removed the cosine term. The copied sentence says sides 3 and 4 with an included angle of 90 degrees give side c of 5.
Reset returns the fields toward 3, 4, and 90. The previous result stays until the next calculation. A side of 0 is rejected.
How the Square Root Is Built
Square side a and square side b, then add those squares. For 3 and 4 the squares are 9 and 16, and the sum is 25. Multiply 2 times side a times side b times the cosine of the angle. For 90 degrees the cosine is 0, so that product is 0. Subtract it from 25, which leaves 25. The square root of 25 is 5.
A different angle keeps the same squares and changes the product you subtract. The cosine of an acute angle is positive, so side c is shorter than it would be for a right angle with the same two sides. The cosine of an obtuse angle is negative, so subtracting a negative number makes side c longer. The page applies that sign. You do not flip it yourself.
A roof span is a different length. The Rafter Length Calculator uses rise and run for a rafter. It does not ask for an included angle in this form. Use it for a rafter. Use 3, 4, and 90 on this page when you are checking the law of cosines.
What the Page Does Not Solve
The page does not find an angle from three sides. If you know all three sides and want the angle, this form is the wrong direction. It also does not find side a when you know side b, side c, and an angle that is not the included angle between a and b. The angle you type is the one between the two sides you type.
The page does not check the triangle inequality beyond the square root. If the value inside the square root is negative, the page rejects the inputs because they do not form a side length. A right angle with two positive sides always forms a side, which is why the sample is safe.
There is no diagram. The letters a, b, and c are labels in the result, not a picture. Side c is the one opposite the angle you entered.
The 3-4-90 Sample
Enter side a as 3, side b as 4, and the angle as 90. The cosine line is 0. The sum of the squares is 25. The headline is 5. Run it again. The 5 matches. Swap the sides to 4 and 3 and keep the angle at 90. The headline is still 5, because addition of the squares does not care which side you called a.
Enter an angle of 0 and confirm the rejection. Enter an angle of 180 and confirm the rejection. Enter a side of 0 and confirm the rejection. Enter a blank angle and confirm the rejection.
A roof pitch is a different angle. The Roof Pitch Calculator works from rise and run. It does not return side 5 for inputs 3, 4, and 90 in this law-of-cosines form. Use it for a pitch. Use this page for side c.
Limits of the Angle and the Sides
Each side must be greater than zero. The angle must be greater than 0 degrees and less than 180 degrees. Decimals are allowed. An angle of 90.0 is the same as 90, and the cosine is still the exact 0 this page uses for a right angle. Angles of 0, 180, and 360 degrees on a full circle are not accepted as an included angle of a triangle.
The cosine of 90, 0, 180, and 270 degrees is exact when the angle lands on those whole numbers, but only 90 sits inside the allowed range among those four. Other angles use a cosine rounded into the page's decimal width. The sample does not depend on that rounding, because the cosine is the exact 0.
The page does not convert degrees to a percent grade or to radians on the result. The angle field is degrees. A radian typed by mistake will be read as a huge or tiny degree measure and will usually be rejected for being outside 0 to 180, or it will produce a side you did not intend. Type degrees.
Common Mistakes
The usual miss is to use the law of cosines when the angle is not between the two sides. The sample works because 90 degrees is between the sides of length 3 and 4, and side 5 is opposite that angle. Another miss is to expect the page to return an angle. The headline is a length.
A third miss is to treat 5 as a rounded hypotenuse from a different formula. For this right angle the law of cosines and the Pythagorean relation agree, and 5 is exact. The cosine line of 0 is the reason they agree. If the cosine line is not 0, the angle was not 90 and the Pythagorean relation is the wrong check.
Plain arithmetic is a different page. The 4 Function Calculator will square 3 and 4 and add them if you press those keys. It will not take the cosine unless you already know it. Use it to recheck 9 plus 16. Use this page for the full side-c formula.
Reading Side 5 in a Note
Copy the sentence with the two sides and the angle. The number 5 alone can be a side, a sum, or an angle from another note. The sentence says sides 3 and 4 with an included angle of 90 degrees give side c of 5.
Record the unit you had in mind. The page did not store inches or meters. A later reader who assumes the other unit will scale the triangle without noticing.
Rebuilding the Sample
Enter 3, 4, and 90. Confirm the cosine is 0, the sum of the squares is 25, and side c is 5. Swap to 4, 3, and 90 and confirm side c is still 5. Enter angle 0 and confirm the rejection. Enter a side of 0 and confirm the rejection.
Estimating a value between two known points is a different page. The Interpolation Calculator estimates a number from surrounding values. It does not apply a cosine. Use it for an interpolation. Use this page when the relation is the law of cosines.
Checking a New Triangle
Confirm 3, 4, and 90 before you change a field. Side c should be 5 and the cosine should be 0. Then change only the angle to a value still between 0 and 180. The sum of the squares stays 25. The cosine line changes, and side c changes. If the cosine stays 0, the angle is still a right angle.
A straight-line estimate between two points is a different page. The Linear Interpolation Calculator fills a value on a line. It does not return side 5 from a cosine. Use it for that line. Use this page for a triangle side.
What the Fields Accept
Side a and side b are numbers greater than zero. The included angle is a number of degrees greater than 0 and less than 180. Blanks are rejected. A comma is not a decimal mark. Type 90, not 90 degrees, in the field. The label already says degrees.
Why 3, 4, and 90 Give 5
Three squared is 9. Four squared is 16. The sum is 25. The cosine of 90 degrees is 0, so 2 times 3 times 4 times 0 is 0. Subtracting 0 leaves 25. The square root of 25 is 5. Each of those steps is exact on this page. The cosine line, the sum line, and the headline are 0, 25, and 5.
Scaling the Right-Angle Sample
Doubling both sides and keeping the angle at 90 degrees doubles side c. Sides 6 and 8 at 90 degrees give side 10. The squares are 36 and 64, the sum is 100, the cosine is still 0, and the square root of 100 is 10. That pair is the sample multiplied by 2. It is a second exact check, not a new formula. Halving the sample gives sides 1.5 and 2 at 90 degrees and side 2.5. The cosine line stays 0 in every one of these right angles.
Checking the Calculator
Enter 3, 4, and 90. Confirm cosine 0, sum of squares 25, and side c of 5. Enter angle 180 and confirm the rejection. Enter a side of 0 and confirm the rejection. When those checks hold, the page is using the law of cosines, and the right angle is the exact case where the cosine term drops out.