Calculate the sine, cosine, and tangent of the sum or difference of two angles using standard trigonometric identities.
Calculates: sin(A ± B), cos(A ± B), tan(A ± B)
Calculation Results
sin(A + B)–
sin(A – B)–
cos(A + B)–
cos(A – B)–
tan(A + B)–
tan(A – B)–
function calculateCompoundAngles() {
// Get inputs
var angleAInput = document.getElementById('angleA');
var angleBInput = document.getElementById('angleB');
var resultBox = document.getElementById('resultContainer');
var valA = parseFloat(angleAInput.value);
var valB = parseFloat(angleBInput.value);
// Validation
if (isNaN(valA) || isNaN(valB)) {
alert("Please enter valid numerical values for both Angle A and Angle B.");
return;
}
// Convert Degrees to Radians for Calculation
var radA = valA * (Math.PI / 180);
var radB = valB * (Math.PI / 180);
// Calculate Sum and Difference
var sumRad = radA + radB;
var diffRad = radA – radB;
// Calculate Trig Functions
// We use standard Math library, but format to 6 decimal places for precision
var sinSum = Math.sin(sumRad);
var sinDiff = Math.sin(diffRad);
var cosSum = Math.cos(sumRad);
var cosDiff = Math.cos(diffRad);
var tanSum = Math.tan(sumRad);
var tanDiff = Math.tan(diffRad);
// Handle Tangent Asymptotes/Undefined behavior visually
// If cos is effectively 0, tan is undefined (Infinity)
function formatResult(val, cosVal) {
if (Math.abs(cosVal) < 1e-10) {
return "Undefined";
}
return val.toFixed(6);
}
// Update DOM
document.getElementById('resSinSum').textContent = sinSum.toFixed(6);
document.getElementById('resSinDiff').textContent = sinDiff.toFixed(6);
document.getElementById('resCosSum').textContent = cosSum.toFixed(6);
document.getElementById('resCosDiff').textContent = cosDiff.toFixed(6);
document.getElementById('resTanSum').textContent = formatResult(tanSum, cosSum);
document.getElementById('resTanDiff').textContent = formatResult(tanDiff, cosDiff);
// Show results
resultBox.style.display = 'block';
}
Understanding Compound Angle Formulas
In trigonometry, compound angle formulas (also known as addition and subtraction theorems) describe how the trigonometric ratios of a sum or difference of angles relate to the ratios of the individual angles. These identities are fundamental in calculus, physics (wave interference), and engineering.
The Formulas
The calculator above utilizes the following standard trigonometric identities:
Function
Formula
Sine Addition
sin(A + B) = sin(A)cos(B) + cos(A)sin(B)
Sine Subtraction
sin(A – B) = sin(A)cos(B) – cos(A)sin(B)
Cosine Addition
cos(A + B) = cos(A)cos(B) – sin(A)sin(B)
Cosine Subtraction
cos(A – B) = cos(A)cos(B) + sin(A)sin(B)
Tangent Addition
tan(A + B) = (tan A + tan B) / (1 – tan A tan B)
Tangent Subtraction
tan(A – B) = (tan A – tan B) / (1 + tan A tan B)
Why are these useful?
Compound angle formulas allow mathematicians and engineers to break down complex waveforms into simpler components. For example, in electrical engineering, when analyzing alternating currents (AC) that have phase shifts, the sum of two sine waves often requires these formulas to determine the resulting voltage or current.
Example Calculation
Suppose you want to find the exact value of sin(75°) without a calculator. You can treat 75° as the sum of two "special angles" derived from the unit circle: 45° and 30°.
This calculator accepts inputs in degrees. To convert radians to degrees manually, multiply the radian value by 180/π. For example, π/4 radians is 45 degrees.
Why do the signs change in the Cosine formulas?
Notice that for cos(A + B), the operator in the expansion is subtraction. Conversely, for cos(A – B), the operator is addition. This sign reversal is a unique property of the cosine function's relationship to the unit circle and vector rotation.
Can I use negative angles?
Yes. Trigonometric functions are defined for negative angles. Remember the even/odd identities: sin(-x) = -sin(x) and cos(-x) = cos(x). The calculator handles negative inputs correctly.