Trigonometric Ratios Calculator

.trig-calc-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; border: 1px solid #e1e4e8; border-radius: 12px; background-color: #ffffff; box-shadow: 0 4px 15px rgba(0,0,0,0.05); } .trig-calc-header { text-align: center; margin-bottom: 30px; } .trig-calc-header h2 { color: #2c3e50; margin-bottom: 10px; } .trig-calc-section { background: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 25px; } .trig-calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } .trig-input-group { margin-bottom: 15px; } .trig-input-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #34495e; } .trig-input-group input { width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 6px; font-size: 16px; box-sizing: border-box; } .trig-input-group input:focus { border-color: #3498db; outline: none; } .trig-btn { background-color: #3498db; color: white; padding: 12px 24px; border: none; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: bold; width: 100%; transition: background 0.3s; } .trig-btn:hover { background-color: #2980b9; } .trig-results { margin-top: 25px; padding: 20px; background: #eef7fe; border-left: 5px solid #3498db; border-radius: 4px; display: none; } .trig-results h3 { margin-top: 0; color: #2c3e50; } .trig-result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-top: 15px; } .trig-result-card { background: white; padding: 10px; border-radius: 6px; text-align: center; border: 1px solid #d6eaf8; } .trig-result-label { font-size: 12px; color: #7f8c8d; text-transform: uppercase; font-weight: bold; } .trig-result-value { font-size: 18px; color: #2c3e50; font-weight: bold; margin-top: 5px; } .trig-article { margin-top: 40px; line-height: 1.6; color: #444; } .trig-article h2, .trig-article h3 { color: #2c3e50; } @media (max-width: 600px) { .trig-calc-grid { grid-template-columns: 1fr; } }

Trigonometric Ratios Calculator

Calculate Sine, Cosine, Tangent and reciprocal ratios using angles or triangle sides.

1. Calculate by Angle

2. Calculate by Sides (Right Triangle)

Results

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

Understanding Trigonometric Ratios

Trigonometric ratios are mathematical values that describe the relationship between the angles and sides of a right-angled triangle. These ratios are fundamental to geometry, physics, engineering, and navigation.

The Core Trigonometric Ratios (SOH CAH TOA)

The acronym SOH CAH TOA is the easiest way to remember the primary ratios:

  • Sine (sin θ): Opposite / Hypotenuse (SOH)
  • Cosine (cos θ): Adjacent / Hypotenuse (CAH)
  • Tangent (tan θ): Opposite / Adjacent (TOA)

Reciprocal Ratios

In addition to the primary three, there are three reciprocal ratios:

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

How to Use This Calculator

This tool allows you to find trigonometric values in two ways:

  1. By Angle: Enter the degree of an angle to find all six trigonometric ratios instantly. For example, entering 30° will show that the Sine is 0.5.
  2. By Sides: Enter the lengths of the "Opposite" and "Adjacent" sides of a right triangle. The calculator will use the Pythagorean theorem (a² + b² = c²) to find the hypotenuse and then solve for all ratios.

Example Calculation

If you have a right triangle where the opposite side is 3 units and the adjacent side is 4 units:

  • Hypotenuse: √(3² + 4²) = √25 = 5
  • Sine: 3/5 = 0.6
  • Cosine: 4/5 = 0.8
  • Tangent: 3/4 = 0.75
function calculateByAngle() { var angleDeg = document.getElementById('inputAngle').value; var display = document.getElementById('trigResultsArea'); var sideInfo = document.getElementById('sideInfo'); if (angleDeg === "" || isNaN(angleDeg)) { alert("Please enter a valid angle in degrees."); return; } var angleRad = angleDeg * (Math.PI / 180); var sinVal = Math.sin(angleRad); var cosVal = Math.cos(angleRad); var tanVal = Math.tan(angleRad); updateDisplay(sinVal, cosVal, tanVal); document.getElementById('resultTitle').innerText = "Results for " + angleDeg + "°"; sideInfo.innerText = ""; display.style.display = "block"; } function calculateBySides() { var opp = parseFloat(document.getElementById('sideOpposite').value); var adj = parseFloat(document.getElementById('sideAdjacent').value); var display = document.getElementById('trigResultsArea'); var sideInfo = document.getElementById('sideInfo'); if (isNaN(opp) || isNaN(adj) || opp <= 0 || adj <= 0) { alert("Please enter positive numerical values for both sides."); return; } var hyp = Math.sqrt(Math.pow(opp, 2) + Math.pow(adj, 2)); var angleRad = Math.atan2(opp, adj); var angleDeg = angleRad * (180 / Math.PI); var sinVal = opp / hyp; var cosVal = adj / hyp; var tanVal = opp / adj; updateDisplay(sinVal, cosVal, tanVal); document.getElementById('resultTitle').innerText = "Results from Sides (" + opp + ", " + adj + ")"; sideInfo.innerText = "Calculated Hypotenuse: " + hyp.toFixed(4) + " | Calculated Angle: " + angleDeg.toFixed(2) + "°"; display.style.display = "block"; } function updateDisplay(s, c, t) { // Handle division by zero or infinity for ratios var format = function(val) { if (!isFinite(val)) return "Undefined"; if (Math.abs(val) < 0.0000000001) return "0"; return Number(val.toFixed(6)).toString(); }; document.getElementById('resSin').innerText = format(s); document.getElementById('resCos').innerText = format(c); document.getElementById('resTan').innerText = format(t); document.getElementById('resCsc').innerText = format(1 / s); document.getElementById('resSec').innerText = format(1 / c); document.getElementById('resCot').innerText = format(1 / t); }

Leave a Comment