Find Missing Side of Triangle Calculator

Find Missing Side of Triangle Calculator

Solve for the Hypotenuse or Legs using the Pythagorean Theorem

Calculate Hypotenuse (Side c) Calculate Side a (given c and b) Calculate Side b (given c and a)

Understanding the Pythagorean Theorem

In geometry, a right triangle is a triangle in which one angle is exactly 90 degrees. The Pythagorean theorem is a fundamental principle used to find the length of a missing side. The formula is expressed as:

a² + b² = c²

  • a and b are the lengths of the legs (the sides that form the right angle).
  • c is the hypotenuse (the longest side, opposite the right angle).

How to Use the Calculator

Depending on which side is unknown, you can rearrange the formula to solve for the missing variable:

  1. To find the Hypotenuse (c): √ (a² + b²)
  2. To find Side a: √ (c² – b²)
  3. To find Side b: √ (c² – a²)

Common Calculation Examples

Side a Side b Hypotenuse (c)
3 4 5
5 12 13
8 15 17
function toggleInputs() { var type = document.getElementById("calcType").value; var groupA = document.getElementById("inputGroupA"); var groupB = document.getElementById("inputGroupB"); var groupC = document.getElementById("inputGroupC"); // Reset displays groupA.style.display = "block"; groupB.style.display = "block"; groupC.style.display = "block"; document.getElementById("resultArea").style.display = "none"; document.getElementById("errorArea").style.display = "none"; if (type === "hypotenuse") { groupC.style.display = "none"; } else if (type === "sideA") { groupA.style.display = "none"; } else if (type === "sideB") { groupB.style.display = "none"; } } function calculateTriangleSide() { var type = document.getElementById("calcType").value; var a = parseFloat(document.getElementById("sideA").value); var b = parseFloat(document.getElementById("sideB").value); var c = parseFloat(document.getElementById("sideC").value); var resultText = document.getElementById("resultText"); var resultFormula = document.getElementById("resultFormula"); var resultArea = document.getElementById("resultArea"); var errorArea = document.getElementById("errorArea"); resultArea.style.display = "none"; errorArea.style.display = "none"; var result = 0; var steps = ""; try { if (type === "hypotenuse") { if (isNaN(a) || isNaN(b) || a <= 0 || b <= 0) { throw "Please enter positive numeric values for Side a and Side b."; } result = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); steps = "c = √(" + a + "² + " + b + "²) = √(" + (a*a) + " + " + (b*b) + ")"; resultText.innerHTML = "Hypotenuse (Side c) = " + result.toFixed(4).replace(/\.?0+$/, ""); } else if (type === "sideA") { if (isNaN(c) || isNaN(b) || c <= 0 || b <= 0) { throw "Please enter positive numeric values for Hypotenuse and Side b."; } if (c <= b) { throw "Hypotenuse must be longer than Side b."; } result = Math.sqrt(Math.pow(c, 2) – Math.pow(b, 2)); steps = "a = √(" + c + "² – " + b + "²) = √(" + (c*c) + " – " + (b*b) + ")"; resultText.innerHTML = "Side a = " + result.toFixed(4).replace(/\.?0+$/, ""); } else if (type === "sideB") { if (isNaN(c) || isNaN(a) || c <= 0 || a <= 0) { throw "Please enter positive numeric values for Hypotenuse and Side a."; } if (c <= a) { throw "Hypotenuse must be longer than Side a."; } result = Math.sqrt(Math.pow(c, 2) – Math.pow(a, 2)); steps = "b = √(" + c + "² – " + a + "²) = √(" + (c*c) + " – " + (a*a) + ")"; resultText.innerHTML = "Side b = " + result.toFixed(4).replace(/\.?0+$/, ""); } resultFormula.innerHTML = steps; resultArea.style.display = "block"; } catch (err) { errorArea.innerHTML = err; errorArea.style.display = "block"; } } // Initial setup toggleInputs();

Leave a Comment