The cosine is a fundamental trigonometric function that relates an angle of a right-angled triangle to the ratio of the length of the adjacent side to the length of the hypotenuse. In a more general context, especially on the unit circle, the cosine of an angle θ is defined as the x-coordinate of the point where the terminal side of the angle intersects the circle.
Mathematical Definition
For a right-angled triangle:
cos(θ) = Adjacent / Hypotenuse
On the unit circle (a circle with radius 1 centered at the origin), for an angle θ measured counterclockwise from the positive x-axis:
cos(θ) = x
where (x, y) are the coordinates of the point of intersection.
Key Properties and Use Cases
Periodicity: The cosine function is periodic with a period of 360 degrees or 2π radians. This means cos(θ) = cos(θ + 360°) = cos(θ + 2π).
Range: The output of the cosine function always falls between -1 and 1, inclusive. -1 ≤ cos(θ) ≤ 1.
Symmetry: Cosine is an even function, meaning cos(-θ) = cos(θ).
Applications: Cosine is extensively used in various fields, including:
Physics: Analyzing wave phenomena (like sound and light), simple harmonic motion, projectile motion, and AC circuits.
Engineering: Signal processing, structural analysis, robotics, and control systems.
Mathematics: Calculus, Fourier analysis, and geometry.
Computer Graphics: Calculating lighting, shading, and reflections.
Using This Calculator
This calculator allows you to find the cosine of an angle. Simply enter the angle's value and select whether the angle is measured in degrees or radians. The calculator will then provide the corresponding cosine value, which will always be between -1 and 1.
function calculateCosine() {
var angleValueInput = document.getElementById("angleValue");
var angleUnitSelect = document.getElementById("angleUnit");
var resultDiv = document.getElementById("result");
var angleValue = parseFloat(angleValueInput.value);
var angleUnit = angleUnitSelect.value;
// Input validation
if (isNaN(angleValue)) {
resultDiv.innerHTML = "Please enter a valid number for the angle.";
return;
}
var angleInRadians;
if (angleUnit === "degrees") {
// Convert degrees to radians
angleInRadians = angleValue * (Math.PI / 180);
} else {
// Angle is already in radians
angleInRadians = angleValue;
}
// Calculate cosine using JavaScript's Math.cos()
// Math.cos() expects the angle in radians
var cosineValue = Math.cos(angleInRadians);
// Display the result
resultDiv.innerHTML = "cos(" + angleValue + " " + angleUnit + ") = " + cosineValue.toFixed(6);
}