Pythagoras Theorem Calculator

.pythag-container { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; background-color: #f9fbfd; border: 1px solid #e1e8ed; border-radius: 12px; color: #333; box-shadow: 0 4px 6px rgba(0,0,0,0.05); } .pythag-container h2 { color: #2c3e50; text-align: center; margin-bottom: 25px; } .pythag-input-group { margin-bottom: 20px; } .pythag-input-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #4a5568; } .pythag-input-group select, .pythag-input-group input { width: 100%; padding: 12px; border: 2px solid #cbd5e0; border-radius: 6px; font-size: 16px; transition: border-color 0.3s; box-sizing: border-box; } .pythag-input-group input:focus { border-color: #4299e1; outline: none; } .pythag-btn { width: 100%; background-color: #3182ce; color: white; padding: 14px; border: none; border-radius: 6px; font-size: 18px; font-weight: bold; cursor: pointer; transition: background-color 0.3s; } .pythag-btn:hover { background-color: #2b6cb0; } .pythag-result-box { margin-top: 25px; padding: 20px; background-color: #edf2f7; border-radius: 8px; text-align: center; } .pythag-result-val { font-size: 24px; color: #2d3748; font-weight: 700; margin-top: 10px; } .pythag-formula-display { font-style: italic; color: #718096; margin-top: 5px; } .pythag-article { margin-top: 40px; line-height: 1.6; color: #4a5568; } .pythag-article h3 { color: #2d3748; border-left: 4px solid #3182ce; padding-left: 10px; margin-top: 30px; } .pythag-article p { margin-bottom: 15px; } .pythag-example { background: #fff; padding: 15px; border: 1px solid #e2e8f0; border-left: 4px solid #48bb78; margin: 15px 0; }

Pythagorean Theorem Calculator

Hypotenuse (Side c) Leg (Side a) Leg (Side b)
Result:

Understanding the Pythagoras Theorem

The Pythagorean Theorem is a fundamental principle in Euclidean geometry. It states that in a right-angled triangle (a triangle where one angle is exactly 90 degrees), the square of the length of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the lengths of the other two sides.

The mathematical formula is expressed as:

a² + b² = c²

Where:

  • a and b are the "legs" or sides adjacent to the right angle.
  • c is the "hypotenuse," which is always the longest side.

How to Use This Calculator

This calculator allows you to find any missing side of a right triangle as long as you know the lengths of the other two sides. Simply follow these steps:

  1. Select the side you are trying to find (Hypotenuse, Side A, or Side B) from the dropdown menu.
  2. Enter the numerical lengths of the two known sides in the input fields.
  3. The calculator will automatically apply the square root logic to find the missing value.
Example 1: Solving for the Hypotenuse
If Side a = 3 and Side b = 4:
3² + 4² = c²
9 + 16 = 25
√25 = 5. Therefore, the hypotenuse is 5.

Real-World Applications

While it may seem like simple classroom math, the Pythagorean Theorem is used daily in various fields:

  • Architecture and Construction: Ensuring corners are square (90 degrees) by using the 3-4-5 rule.
  • Navigation: Calculating the shortest distance (the "as the crow flies" path) between two points on a map.
  • TV and Screen Sizes: Screen sizes (like 55-inch or 65-inch) are measured diagonally across the screen using this logic.
  • Surveying: Determining the slopes of hills or the heights of buildings.
Example 2: Finding a Leg
If you know the Hypotenuse (c) is 13 and one side (a) is 5:
5² + b² = 13²
25 + b² = 169
b² = 169 – 25 = 144
√144 = 12. The missing leg is 12.
function updateLabels() { var mode = document.getElementById('solveFor').value; var label1 = document.getElementById('label1'); var label2 = document.getElementById('label2'); var input1 = document.getElementById('input1'); var input2 = document.getElementById('input2'); if (mode === 'hypotenuse') { label1.innerText = "Length of Side a"; label2.innerText = "Length of Side b"; input1.placeholder = "Enter side a"; input2.placeholder = "Enter side b"; } else if (mode === 'sideA') { label1.innerText = "Length of Hypotenuse (Side c)"; label2.innerText = "Length of Side b"; input1.placeholder = "Enter hypotenuse"; input2.placeholder = "Enter side b"; } else if (mode === 'sideB') { label1.innerText = "Length of Hypotenuse (Side c)"; label2.innerText = "Length of Side a"; input1.placeholder = "Enter hypotenuse"; input2.placeholder = "Enter side a"; } document.getElementById('resultArea').style.display = 'none'; } function calculatePythagoras() { var mode = document.getElementById('solveFor').value; var val1 = parseFloat(document.getElementById('input1').value); var val2 = parseFloat(document.getElementById('input2').value); var resultArea = document.getElementById('resultArea'); var pythagValue = document.getElementById('pythagValue'); var formulaSteps = document.getElementById('formulaSteps'); var resultMsg = document.getElementById('resultMsg'); if (isNaN(val1) || isNaN(val2) || val1 <= 0 || val2 <= 0) { alert("Please enter positive numeric values for both fields."); return; } var result; var stepText; if (mode === 'hypotenuse') { // c = sqrt(a^2 + b^2) result = Math.sqrt(Math.pow(val1, 2) + Math.pow(val2, 2)); resultMsg.innerText = "Length of Hypotenuse (Side c):"; stepText = "√(" + val1 + "² + " + val2 + "²)"; } else if (mode === 'sideA') { // a = sqrt(c^2 – b^2) if (val1 <= val2) { alert("The hypotenuse must be longer than the side leg."); return; } result = Math.sqrt(Math.pow(val1, 2) – Math.pow(val2, 2)); resultMsg.innerText = "Length of Side a:"; stepText = "√(" + val1 + "² – " + val2 + "²)"; } else if (mode === 'sideB') { // b = sqrt(c^2 – a^2) if (val1 <= val2) { alert("The hypotenuse must be longer than the side leg."); return; } result = Math.sqrt(Math.pow(val1, 2) – Math.pow(val2, 2)); resultMsg.innerText = "Length of Side b:"; stepText = "√(" + val1 + "² – " + val2 + "²)"; } pythagValue.innerText = result.toLocaleString(undefined, {maximumFractionDigits: 4}); formulaSteps.innerText = "Calculation: " + stepText; resultArea.style.display = 'block'; }

Leave a Comment