Calculator Trigonometric

Trigonometric Function & Right Triangle Solver

Degrees Radians
Sine (sin):
Cosine (cos):
Tangent (tan):
Cosecant (csc):
Secant (sec):
Cotangent (cot):

Enter any two values to solve the right triangle (Angle C is 90°).

Triangle Solution:

function calculateTrigFunctions() { var angle = parseFloat(document.getElementById('trigAngle').value); var unit = document.getElementById('angleUnit').value; if (isNaN(angle)) { alert("Please enter a valid angle value."); return; } var rad = (unit === 'deg') ? angle * (Math.PI / 180) : angle; var s = Math.sin(rad); var c = Math.cos(rad); var t = Math.tan(rad); document.getElementById('resSin').innerText = s.toFixed(4); document.getElementById('resCos').innerText = c.toFixed(4); // Handle infinity cases document.getElementById('resTan').innerText = (Math.abs(c) < 0.000001) ? "Undefined" : t.toFixed(4); document.getElementById('resCsc').innerText = (Math.abs(s) < 0.000001) ? "Undefined" : (1/s).toFixed(4); document.getElementById('resSec').innerText = (Math.abs(c) < 0.000001) ? "Undefined" : (1/c).toFixed(4); document.getElementById('resCot').innerText = (Math.abs(s) < 0.000001) ? "Undefined" : (1/t).toFixed(4); document.getElementById('funcResults').style.display = 'block'; } function solveTriangle() { var a = parseFloat(document.getElementById('sideA').value); var b = parseFloat(document.getElementById('sideB').value); var c = parseFloat(document.getElementById('sideC').value); var angA = parseFloat(document.getElementById('angleA').value); var count = 0; if (!isNaN(a)) count++; if (!isNaN(b)) count++; if (!isNaN(c)) count++; if (!isNaN(angA)) count++; if (count < 2) { alert("Please provide at least two values (one must be a side length)."); return; } // Case 1: Two sides (a and b) if (!isNaN(a) && !isNaN(b)) { c = Math.sqrt(a*a + b*b); angA = Math.atan(a/b) * (180/Math.PI); } // Case 2: a and c else if (!isNaN(a) && !isNaN(c)) { b = Math.sqrt(c*c – a*a); angA = Math.asin(a/c) * (180/Math.PI); } // Case 3: b and c else if (!isNaN(b) && !isNaN(c)) { a = Math.sqrt(c*c – b*b); angA = Math.acos(b/c) * (180/Math.PI); } // Case 4: a and Angle A else if (!isNaN(a) && !isNaN(angA)) { var radA = angA * (Math.PI/180); c = a / Math.sin(radA); b = a / Math.tan(radA); } // Case 5: b and Angle A else if (!isNaN(b) && !isNaN(angA)) { var radA = angA * (Math.PI/180); a = b * Math.tan(radA); c = b / Math.cos(radA); } // Case 6: c and Angle A else if (!isNaN(c) && !isNaN(angA)) { var radA = angA * (Math.PI/180); a = c * Math.sin(radA); b = c * Math.cos(radA); } var angB = 90 – angA; if (isNaN(a) || isNaN(b) || isNaN(c) || a <= 0 || b <= 0 || c <= 0) { alert("Invalid geometry. Ensure sides form a valid right triangle."); return; } var summary = "Sides:" + "Side a: " + a.toFixed(3) + "" + "Side b: " + b.toFixed(3) + "" + "Side c (Hypotenuse): " + c.toFixed(3) + "" + "Angles:" + "Angle A: " + angA.toFixed(2) + "°" + "Angle B: " + angB.toFixed(2) + "°" + "Angle C: 90.00°"; document.getElementById('triSummary').innerHTML = summary; document.getElementById('triResults').style.display = 'block'; } function resetTriangle() { document.getElementById('sideA').value = "; document.getElementById('sideB').value = "; document.getElementById('sideC').value = "; document.getElementById('angleA').value = "; document.getElementById('triResults').style.display = 'none'; }

Understanding Trigonometry

Trigonometry is a branch of mathematics that studies the relationships between the side lengths and angles of triangles. It is essential in fields ranging from engineering and physics to astronomy and navigation.

The Core Functions: SOH CAH TOA

In a right-angled triangle, the three primary ratios are defined by the mnemonic SOH CAH TOA:

  • Sine (sin): Opposite / Hypotenuse
  • Cosine (cos): Adjacent / Hypotenuse
  • Tangent (tan): Opposite / Adjacent

Reciprocal Functions

There are also three reciprocal functions that are commonly used in advanced mathematics:

  • Cosecant (csc): 1 / Sine
  • Secant (sec): 1 / Cosine
  • Cotangent (cot): 1 / Tangent

Practical Examples

Example 1: Finding an Angle
If you have a ladder leaning against a wall, where the base of the ladder is 3 meters away from the wall (Side b) and the ladder itself is 5 meters long (Hypotenuse c), what is the angle the ladder makes with the ground?
Calculation: cos(A) = 3/5 = 0.6. Using the inverse cosine, Angle A ≈ 53.13°.
Example 2: Finding Height
You are standing 10 meters away from a tree (Side b). You measure the angle to the top of the tree to be 30° (Angle A). How tall is the tree (Side a)?
Calculation: tan(30°) = a / 10. Therefore, a = 10 * tan(30°) ≈ 5.77 meters.

Degrees vs. Radians

While we use degrees (0-360) in daily life, most mathematical calculus and physics formulas use Radians. One full circle is 360° or 2π radians. To convert from degrees to radians, multiply by π and divide by 180.

Frequently Asked Questions

What is the Unit Circle?

The Unit Circle is a circle with a radius of 1 centered at the origin (0,0). It allows for the extension of trigonometric functions to all real numbers, not just angles in a right triangle.

When is a Tangent undefined?

Tangent is undefined at 90° and 270° (and any odd multiple of 90°). This is because Tangent = Sine/Cosine, and at these angles, Cosine is zero, leading to division by zero.

Leave a Comment