Solving Triangles and Slopes: Sines, Cosines and Rise Over Run
Which law to use for SSS, SAS, ASA and SSA, why the ambiguous case has two answers, and how slope, angle and percent grade relate on a ramp or a roof.
· 9 min read

A carpenter has a wall 2.4 m tall and wants a brace that meets the floor at 50°. A student has a triangle with sides 5, 6 and 7 and needs all three angles. A homeowner wants to know whether a ramp that rises 30 cm over 3 m is legal. All three are the same small family of problems: a few known lengths and angles, and a couple of rules that fill in the rest.
This guide explains those rules, how to pick the right one for the values you have, and where the traps are. Every number can be reproduced in the Triangle Calculator and the Slope Calculator.
Three values fix a triangle, with one exception
A triangle has six measurements: three sides (a, b, c) and three angles (A, B, C), where each angle sits opposite the side with the same letter. Know any three, with at least one of them a side, and the other three follow. Three angles alone are not enough, because every enlarged or shrunk copy of the triangle has the same angles. You need a length to fix the scale.
Textbooks name the cases by the order the known parts appear as you walk around the triangle:
- SSS: three sides.
- SAS: two sides and the angle between them.
- ASA: two angles and the side between them.
- AAS: two angles and a side that is not between them.
- SSA: two sides and an angle that is not between them.
Each case points to the right tool. Two laws cover all of them.
The law of cosines relates three sides to one angle:
c² = a² + b² − 2ab·cos C
cos C = (a² + b² − c²) / (2ab)
When C is 90°, cos C is 0 and the law collapses into the Pythagorean theorem. Use it for SSS (rearranged to find each angle) and for SAS (to find the third side).
The law of sines links each side to its opposite angle:
a / sin A = b / sin B = c / sin C = 2R
R is the radius of the circle through all three corners. Use it once you know one side and the angle opposite it, which is what ASA and AAS become after you subtract the two known angles from 180°.
A worked SSS example
Sides 5, 6 and 7. The law of cosines gives cos A = (36 + 49 − 25) / 84 = 0.7143, so A = 44.42°. In the same way B = 57.12°, and C = 180° − A − B = 78.46°. The area from ½·a·b·sin C is 14.697, and Heron's formula agrees: the semiperimeter is s = 9, and √(9 × 4 × 3 × 2) = √216 = 14.697. The largest angle is under 90°, so the triangle is acute.
The triangle inequality is the first thing to check with three sides. The longest side must be shorter than the other two added together. Sides 1, 2 and 3 lie flat in a line and enclose no area; sides 1, 2 and 10 cannot meet at all.
The ambiguous case: when SSA has two answers
SSA is the case that catches people out, because the data can describe two different triangles, one, or none.
Take A = 30°, b = 10 and a = 6. Draw angle A at the left of a base line and side b up to corner C. Side a hangs from C and has to reach the base. Picture it as a hinge: it can swing left or right. The shortest distance from C to the base is the height, b·sin A = 10 × 0.5 = 5.
- If a is shorter than 5, it never reaches the base. No triangle.
- If a equals 5, it touches the base at one point, at a right angle. One triangle.
- If a is between 5 and 10, it crosses the base in two places. Two triangles.
- If a is 10 or more, the second crossing lands behind A, which is not a triangle. One triangle.
With a = 6 the law of sines gives sin B = 10 × 0.5 / 6 = 0.8333. Two angles have that sine: 56.44° and its supplement 123.56°. Both leave room for C (93.56° and 26.44°), so both triangles exist, with third sides of 11.98 and 5.34. The calculator lists both and lets you draw either. When the known angle is obtuse, there is at most one triangle, and only when the side opposite it is the longer of the two.
The practical lesson: if an answer key gives one solution and yours gives another, check whether the problem was SSA. Both may be right.
Right triangles and the special ratios
A right triangle needs only two values, because the 90° angle is the third. With the legs a and b and the hypotenuse c:
c² = a² + b²
sin A = a / c cos A = b / c tan A = a / b
That is SOH-CAH-TOA. The brace example: a hypotenuse at 50° to the floor reaching 2.4 m up the wall has length 2.4 / sin 50° = 3.13 m, and it lands 2.4 / tan 50° = 2.01 m from the wall.
Two right triangles turn up so often that their ratios are worth memorising. A 45-45-90 triangle is half a square, with sides 1 : 1 : √2. A 30-60-90 triangle is half an equilateral triangle, with sides 1 : √3 : 2, the short leg opposite 30°. A 30-60-90 triangle with a hypotenuse of 10 has legs 5 and 8.660. The calculator's special-triangle mode does the scaling from any one side.
Beyond sides and angles, a few derived lengths matter in practice. The height to a side is twice the area divided by that side. The median to side a runs to its midpoint and has length ½√(2b² + 2c² − a²). The inradius is the area divided by the semiperimeter, and the circumradius is a / (2 sin A). In a right triangle the circumradius is always half the hypotenuse, because the hypotenuse is a diameter of the circle through the three corners.
Slope is a right triangle in disguise
Any two points on a line form a right triangle with the horizontal and vertical between them. The horizontal leg is the run, the vertical leg is the rise, and the slope is rise over run:
m = (y₂ − y₁) / (x₂ − x₁)
The same triangle gives everything else the slope calculator reports. The distance between the points is the hypotenuse, √(Δx² + Δy²). The angle the line makes with the x-axis is arctan(m). The midpoint is the average of the coordinates.
For (1, 2) and (4, 7) the rise is 5 and the run is 3, so the slope is 5/3. The y-intercept is b = y₁ − m·x₁ = 2 − 5/3 = 1/3, giving y = (5/3)x + 1/3. Multiply through by 3 and rearrange for standard form: 5x − 3y = −1. Keeping the slope as a fraction instead of 1.6667 is what makes the integer standard form possible, which is why the calculator does exact arithmetic when the inputs are fractions or terminating decimals.
A vertical line has a run of zero, and dividing by zero has no answer. Its slope is undefined, and its equation is simply x = constant. Perpendicular lines have slopes whose product is −1, so the perpendicular to a slope of 5/3 has slope −3/5.
Grade, pitch and angle are not the same number
Builders, road engineers and maths teachers describe the same steepness in different units, and mixing them up is a real source of mistakes.
- Slope is the plain ratio, such as 1/12 or 0.06.
- Percent grade is the slope times 100. Road signs use it: a 6% grade rises 6 m per 100 m of horizontal distance.
- Pitch in roofing is the rise per 12 units of run. A 4-in-12 roof has a slope of 1/3.
- Angle is arctan of the slope, in degrees.
Grade and angle are not proportional. A 100% grade is 45°, not 90°, and a 6% road is only about 3.4°. At small slopes the angle in degrees is roughly 57.3 times the slope, but that shortcut drifts quickly above about 20%.
Back to the ramp: a 30 cm rise over 3 m of run is a slope of 0.1, a 10% grade, or 5.71°. The 2010 ADA Standards for Accessible Design limit a ramp's running slope to 1:12, which is 8.33% or 4.76°. The ramp is too steep; at 30 cm of rise it needs at least 3.6 m of run.
Checking your answers
A few habits catch most errors:
- The angles must add to 180°. If they do not, a value was typed in the wrong unit, usually radians in a degree field.
- The longest side faces the largest angle. If side c is the longest but C is not the largest angle, something is off.
- Compute area two ways. ½·a·b·sin C and Heron's formula should agree to the last displayed digit.
- Look at the drawing. A to-scale sketch makes a wrong 120° angle or a swapped side obvious in a way that a column of numbers does not.
- For slopes, swap the points. The slope must not change. If it does, the subtraction order was mixed.
For areas of other shapes and volumes of solids, see the Area Calculator and the Volume Calculator. For the building-specific versions of these problems, the Stair Calculator and Roofing Calculator wrap the same trigonometry in construction terms.