Right Triangle Calculator

Right Triangle Calculator
Two Sides (a and b)Side and Hypotenuse (a and c)Side and Angle (a and Angle A)Hypotenuse and Angle (c and Angle A)
<button type="reset" onclick="document.getElementById('answer').innerHTML='
Result will appear here

'" style="background:#f5f5f5;color:#333;padding:12px 30px;border:1px solid #ccc;border-radius:3px;font-size:16px;cursor:pointer;">Clear
Results:

Enter values to calculate missing sides, angles, area, and perimeter.

function updateInputs(){var mode=document.getElementById('given_data').value;var l1=document.getElementById('label1');var l2=document.getElementById('label2');var i1=document.getElementById('input1');var i2=document.getElementById('input2′);i1.value=";i2.value=";if(mode=='sides'){l1.innerHTML='Side a:';l2.innerHTML='Side b:';i1.placeholder='Leg length';i2.placeholder='Leg length';}else if(mode=='side_hyp'){l1.innerHTML='Side a:';l2.innerHTML='Hypotenuse c:';i1.placeholder='Leg length';i2.placeholder='Hypotenuse length';}else if(mode=='side_angle'){l1.innerHTML='Side a:';l2.innerHTML='Angle A (°):';i1.placeholder='Leg length';i2.placeholder='Angle in degrees';}else if(mode=='hyp_angle'){l1.innerHTML='Hypotenuse c:';l2.innerHTML='Angle A (°):';i1.placeholder='Hypotenuse length';i2.placeholder='Angle in degrees';}}function calculateTriangle(){var mode=document.getElementById('given_data').value;var v1=parseFloat(document.getElementById('input1').value);var v2=parseFloat(document.getElementById('input2').value);var showSteps=document.getElementById('steps').checked;if(isNaN(v1)||isNaN(v2)){alert('Please enter valid numeric values');return;}var a,b,c,angleA,angleB,area,perimeter,stepsHtml=";if(mode=='sides'){a=v1;b=v2;c=Math.sqrt(Math.pow(a,2)+Math.pow(b,2));angleA=Math.atan(a/b)*(180/Math.PI);angleB=90-angleA;stepsHtml='c = √(a² + b²)
A = arctan(a/b)';}else if(mode=='side_hyp'){a=v1;c=v2;if(a>=c){alert('Hypotenuse must be longer than side a');return;}b=Math.sqrt(Math.pow(c,2)-Math.pow(a,2));angleA=Math.asin(a/c)*(180/Math.PI);angleB=90-angleA;stepsHtml='b = √(c² – a²)
A = arcsin(a/c)';}else if(mode=='side_angle'){a=v1;angleA=v2;if(angleA>=90||angleA<=0){alert('Angle must be between 0 and 90 degrees');return;}var radA=angleA*(Math.PI/180);c=a/Math.sin(radA);b=Math.sqrt(Math.pow(c,2)-Math.pow(a,2));angleB=90-angleA;stepsHtml='c = a / sin(A)
b = a / tan(A)';}else if(mode=='hyp_angle'){c=v1;angleA=v2;if(angleA>=90||angleA<=0){alert('Angle must be between 0 and 90 degrees');return;}var radA=angleA*(Math.PI/180);a=c*Math.sin(radA);b=c*Math.cos(radA);angleB=90-angleA;stepsHtml='a = c * sin(A)
b = c * cos(A)';}area=0.5*a*b;perimeter=a+b+c;var res='
';res+='Side a: '+a.toFixed(4)+'
';res+='Side b: '+b.toFixed(4)+'
';res+='Hypotenuse c: '+c.toFixed(4)+'
';res+='Angle A: '+angleA.toFixed(4)+'°
';res+='Angle B: '+angleB.toFixed(4)+'°
';res+='Angle C: 90°
';res+='Area: '+area.toFixed(4)+'
';res+='Perimeter: '+perimeter.toFixed(4)+'
';if(showSteps){res+='
Formulas Used:
'+stepsHtml+'
Area = 1/2 * a * b
';}document.getElementById('answer').innerHTML=res;}

Right Triangle Calculator Use

The right triangle calculator is a versatile tool designed to solve any right-angled triangle. By entering just two known values—such as two sides, or one side and one angle—this tool instantly computes the remaining side lengths, interior angles, area, and perimeter. This is essential for students, architects, and engineers who need precise geometric calculations.

In geometry, a right triangle (or right-angled triangle) is a triangle in which one angle is exactly 90 degrees. This unique property allows us to use the Pythagorean theorem and trigonometric functions (sine, cosine, and tangent) to find unknown dimensions.

Side a & Side b (Legs)
The two sides that meet at the 90-degree angle. These are often referred to as the "opposite" and "adjacent" sides relative to the other angles.
Hypotenuse (Side c)
The longest side of the right triangle, located directly opposite the 90-degree right angle.
Angle A & Angle B
The two acute angles in the triangle. In any right triangle, these two angles must add up to exactly 90 degrees.

How It Works: The Formulas

To solve a triangle manually, our right triangle calculator uses several fundamental mathematical principles. Depending on your inputs, the following formulas are applied:

Pythagorean Theorem: a² + b² = c²

Trigonometric Functions:

  • sin(A) = Opposite / Hypotenuse (a / c)
  • cos(A) = Adjacent / Hypotenuse (b / c)
  • tan(A) = Opposite / Adjacent (a / b)

For instance, if you know sides a and b, the hypotenuse is found using the square root of the sum of their squares. If you know an angle and a side, the calculator uses the inverse trigonometric functions to determine the missing lengths.

Calculation Example

Example: Suppose you are building a ramp and you know the height (Side a) must be 3 feet and the horizontal length (Side b) must be 4 feet. You need to find the length of the ramp surface (Hypotenuse c).

Step-by-step solution:

  1. Input Side a = 3
  2. Input Side b = 4
  3. Apply Pythagorean Theorem: 3² + 4² = c²
  4. 9 + 16 = 25
  5. √25 = 5
  6. Result: Hypotenuse (Ramp length) = 5 feet.

Common Questions

What is a 3-4-5 triangle?

A 3-4-5 triangle is the most famous example of a Pythagorean triple. It is a right triangle where the sides are in the ratio of 3:4:5. Because 3² + 4² = 5² (9 + 16 = 25), it satisfies the theorem perfectly and is often used by builders to ensure corners are perfectly square.

Can a right triangle have two 90-degree angles?

No. The sum of all interior angles in any triangle must be exactly 180 degrees. If a triangle had two 90-degree angles, that would already total 180 degrees, leaving no room for a third angle or side closure, which is impossible in Euclidean geometry.

How do I find the area of a right triangle?

Finding the area of a right triangle is straightforward. Since the two legs (a and b) are perpendicular, they act as the base and height. The formula is: Area = 0.5 × base × height, or Area = (a × b) / 2.

Leave a Comment