The Cosine function (cos(x))
The cosine function cos(x) maps an angle to a real number in the interval [−1, 1]. In a right triangle, cos(x) is the ratio of the adjacent leg to the hypotenuse — the geometric meaning the function inherits from its 2000-year-old origins in Greek astronomy. On the unit circle (radius 1, centered at the origin), cos(x) is simply the x-coordinate of the point at angle x measured counterclockwise from the positive x-axis. This unit-circle definition is the modern one because it extends naturally to all real angles — positive, negative, and beyond a full rotation.
Here are the key properties of cosine that this calculator exploits and that you will use everywhere from physics homework to AC circuit analysis:
- Definition on the Unit Circle: For an angle x (in radians), cos(x) is the x-coordinate of the point on the unit circle reached by rotating counterclockwise from (1, 0) by angle x. This visual is the fastest way to recall any cosine value — picture where the angle lands on the circle and read off the horizontal coordinate.
- Periodicity: cos(x) = cos(x + 2πk) for every integer k. The function repeats every full rotation — every 360° or every 2π radians — which is why cosine is the natural model for any cyclic phenomenon (waves, alternating current, planetary orbits, sound).
- Range: cos(x) is always between −1 and +1 inclusive. Outputs outside this range mean a calculation error somewhere — typical when students mistakenly compute arccos of a value greater than 1 or less than −1.
- Even Function: cos(−x) = cos(x) for every x — the graph is symmetric about the y-axis. This contrasts with sine, which is odd, and is the source of half the trigonometric simplifications you encounter.
- Key Values: cos(0°) = 1, cos(30°) = √3/2 ≈ 0.866, cos(45°) = √2/2 ≈ 0.707, cos(60°) = 1/2, cos(90°) = 0, cos(180°) = −1, cos(270°) = 0, cos(360°) = 1. Memorize these eight values and the rest of the cosine table falls into place by symmetry and periodicity.
- Relationship to Sine: cos(x) = sin(π/2 − x) — cosine is a phase-shifted sine, lagging by 90°. The Pythagorean identity sin²(x) + cos²(x) = 1 follows directly from x² + y² = 1 on the unit circle and is the most-used identity in all of trig.
- Graph: A smooth wave starting at (0, 1), descending through (π/2, 0) to (π, −1), back through (3π/2, 0) to (2π, 1), repeating forever. The pattern is the gold standard for visualizing any oscillation.
- Applications: AC circuit analysis (V = V₀ cos(ωt + φ)), sound and light waves, mechanical vibrations, signal processing (every discrete cosine transform underlies JPEG and MP3 compression), 3D graphics (rotations are sin/cos linear combinations), astronomy (planetary positions), and structural engineering (force resolution on inclined surfaces).
In calculus, d/dx cos(x) = −sin(x) and ∫cos(x) dx = sin(x) + C. The Taylor series cos(x) = 1 − x²/2! + x⁴/4! − x⁶/6! + ... converges for every real x (and every complex z), and converges fast enough that just five or six terms give double-precision accuracy for |x| < 1 — which is how every electronic calculator actually computes cosine internally.
What is Degrees (deg °) and Radians (rad)?
Trigonometric functions accept angles in two standard units, and mixing them up is the #1 source of trig errors. Always check which mode your calculator is in before computing.
- Degrees: 360 in a full circle, named for the Babylonian sexagesimal (base-60) system around 1500 BCE. Degrees are intuitive for navigation, geometry, and any quantity where humans need clean fractions of a circle (90° quadrants, 60° equilateral triangles, 45° diagonals).
- Radians: 2π in a full circle, defined so one radian is the arc whose length equals the radius. Radians are the natural unit for calculus and physics — the formula d/dx sin(x) = cos(x) only works in radians; in degrees you would need a 180/π conversion factor every time you differentiated. All Taylor series, all derivative formulas, all wave equations assume radians.
To convert between degrees and radians, use these two formulas:
- From degrees to radians:
radians = degrees × π180 - From radians to degrees:
degrees = radians × 180π
Frequently Asked Questions
From the 30-60-90 special right triangle, one of two triangles whose side ratios are exact and worth memorizing. Drop a perpendicular from one vertex of an equilateral triangle of side 2 — this bisects the base into two equal halves of length 1 and creates two congruent 30-60-90 right triangles. In one of those right triangles, the hypotenuse is 2, the shorter leg (opposite the 30° angle) is 1, and the longer leg (opposite the 60° angle) is the missing height. By the Pythagorean theorem, height² + 1² = 2², so height = √3. Now cos(30°) = adjacent/hypotenuse = √3/2 ≈ 0.866. The same triangle gives cos(60°) = 1/2 (the short leg over the hypotenuse). The other special triangle, the 45-45-90 isosceles right triangle, gives cos(45°) = √2/2 ≈ 0.707. These three values — 1/2, √2/2, √3/2 — appear at 30°, 45°, 60° and at every reflection/rotation of them around the unit circle. Memorizing them gives you 16 exact cosine values across the full 360°.
cos(x) is a function that takes an angle and produces a number; arccos(x) (also written cos⁻¹(x)) is its inverse, taking a number between −1 and 1 and returning an angle. But cosine is not one-to-one — cos(60°) = cos(300°) = cos(−60°) = ½, so a literal inverse would have to return multiple values. To make arccos a proper function, mathematicians restrict its output range to [0°, 180°] (or [0, π] in radians). So arccos(0.5) = 60°, not 300° or −60°. The principal-value convention is universal, but it means you sometimes have to add 2π or reflect to find all solutions to cos(x) = c. For example, all solutions to cos(x) = 0.5 are x = ±60° + 360°k for integer k. This is the same logic that restricts arcsin to [−90°, 90°] and arctan to (−90°, 90°). The input range of arccos is [−1, 1] because cosine outputs only those values — entering 1.5 or −2.3 gives "undefined" or NaN.
The Law of Cosines: for any triangle with sides a, b, c and the angle C opposite side c, c² = a² + b² − 2ab cos(C). This is the universal triangle-side-length formula, replacing the Pythagorean theorem (which is the special case C = 90°, where cos(90°) = 0, leaving c² = a² + b²). For any other angle, the −2ab cos(C) term adjusts: if C < 90° (acute), cos(C) > 0 and c is shorter than √(a²+b²); if C > 90° (obtuse), cos(C) < 0 and c is longer. The Law of Cosines lets you solve any triangle when you know two sides and the included angle (SAS) or all three sides (SSS) — the two cases the simpler Law of Sines cannot handle alone. It dates back to Euclid (Elements, c. 300 BCE, Propositions II.12 and II.13, stated geometrically without trig), with the modern trigonometric form due to medieval Islamic mathematicians around 1000 CE. The formula appears constantly in surveying, navigation, GPS triangulation, and structural engineering.
Because of where 180° lands on the unit circle. Start at the point (1, 0) and rotate counterclockwise by 180° (a half turn). You arrive at the point (−1, 0). Cosine, by definition, is the x-coordinate of the endpoint — and that x-coordinate is −1. The same logic gives every other key cosine value: at 0° you are at (1, 0), so cos(0°) = 1. At 90° you are at (0, 1), so cos(90°) = 0. At 270° you are at (0, −1), so cos(270°) = 0. At 360° you have completed a full rotation back to (1, 0), so cos(360°) = 1, identical to cos(0°). Negative cosine values occur in quadrants II (90°–180°) and III (180°–270°) where the x-coordinate is to the left of the y-axis. This unit-circle picture is the fastest mental model for the entire cosine table — once you can visualize the rotation, you never confuse the sign again.
Three steps. (1) Argument reduction: if x is in degrees, multiply by π/180 to convert to radians; then reduce modulo 2π so the input lands in [0, 2π); further reduce to [0, π/2] using cosine's symmetries (cos(π−x) = −cos(x), cos(π+x) = −cos(x), cos(2π−x) = cos(x)), tracking the sign separately. (2) Polynomial approximation: in the reduced interval [0, π/4], evaluate a short polynomial of degree 6–10 (typically derived from the Taylor series cos(x) = 1 − x²/2 + x⁴/24 − x⁶/720 + ... or a more efficient Chebyshev-optimal variant). Six terms give 15 significant digits, which is the precision of an IEEE-754 double. (3) Apply the saved sign and return. The Taylor series converges fast because the factorial denominators grow much faster than x^n in the numerator — by term 10, the contribution is below 10^-15 for any |x| ≤ π/2. The CORDIC algorithm is an even older alternative used in pocket calculators of the 1970s, computing sin and cos simultaneously using only shifts and adds; it remains in use in FPGAs and embedded systems where multiplication is expensive.
Almost anything that oscillates or rotates. (1) AC electricity: voltage in a power outlet is V(t) = V₀ cos(2πft + φ), where f = 50 or 60 Hz and φ is the phase. Every AC analysis textbook is built on cosine. (2) Sound: pure tones are pressure cos(2πft) where f is frequency; complex sounds are sums of cosines (Fourier decomposition). MP3 and AAC compression literally store the cosine coefficients (DCT). (3) Light and EM waves: electric field E(x, t) = E₀ cos(kx − ωt) for a plane wave — the foundation of optics, radio, and quantum mechanics. (4) Planetary orbits: positions are sin/cos of orbital angle; Kepler's equations live or die by trig. (5) Mechanical vibration: spring-mass oscillator x(t) = A cos(ωt + φ); pendulum motion (for small angles) is cosine. (6) 3D graphics: every rotation matrix has cos/sin entries; every smooth animation involves trig. (7) GPS: trilateration uses Law of Cosines on a sphere (spherical trig). (8) Power calculations: real power = V × I × cos(φ) where φ is the phase angle between voltage and current — this is the famous "power factor" in electrical engineering.
sin²(x) + cos²(x) = 1 for every real number x. The identity is literally the Pythagorean theorem applied to the unit circle: every point on a circle of radius 1 has coordinates (cos(x), sin(x)), and the distance from that point to the origin is √(cos²(x) + sin²(x)). But the point is on the unit circle, so its distance is exactly 1, giving cos²(x) + sin²(x) = 1. The identity holds for any angle x — positive, negative, irrational, complex — and is the foundation for the entire web of trig identities: divide both sides by cos²(x) to get 1 + tan²(x) = sec²(x); divide by sin²(x) to get 1 + cot²(x) = csc²(x); use it to express sin in terms of cos (sin(x) = ±√(1 − cos²(x))) when you know one and need the other. In calculus, this identity simplifies most integrals involving √(1 − x²) via the substitution x = sin(θ). In physics, the conservation of probability in quantum mechanics is a Pythagorean identity in disguise. Three thousand years of geometry distilled into one tiny equation.
Yes, but it requires care because of floating-point precision. The naive approach — convert 10⁶ radians to a value in [0, 2π) by computing 10⁶ mod (2π) — fails because 2π is irrational, and standard double-precision math gives only about 15-16 significant digits. When you reduce 10⁶ by subtracting ~159,154 full rotations of 2π, the result is only accurate to about 10 digits of precision in the radian fraction — which leaks into the cosine answer. For cos(10⁶) the leak is small (~10⁻⁷ error), but for cos(10²⁰) it overwhelms the answer entirely. High-precision libraries (Payne-Hanek argument reduction, used in glibc, MSVC, and Apple's math libraries) store π to thousands of bits of precision and do reduction in extended precision specifically to keep large-argument cosines accurate. JavaScript's Math.cos uses double precision throughout and is reliable to about 15 digits for arguments up to ~10¹⁵; beyond that, you should reduce the argument by hand first or use a multi-precision library. For physics simulations, the safest practice is to keep angles modulo 2π in the first place and never let them grow large.
Table of common cosine values
| Angle (°) | Angle (Radians) | cos(angle) | cos(angle) |
|---|
| 0° | 0 | 1 | 1 |
| 30° | π/6 | √3/2 | 0.8660 |
| 45° | π/4 | √2/2 | 0.7071 |
| 60° | π/3 | 1/2 | 0.5 |
| 90° | π/2 | 0 | 0 |
| 120° | 2π/3 | -1/2 | -0.5 |
| 135° | 3π/4 | -√2/2 | -0.7071 |
| 150° | 5π/6 | -√3/2 | -0.866 |
| 180° | π | -1 | -1 |
| 210° | 7π/6 | -√3/2 | -0.866 |
| 225° | 5π/4 | -√2/2 | -0.7071 |
| 240° | 4π/3 | -1/2 | -0.5 |
| 270° | 3π/2 | 0 | 0 |
| 300° | 5π/3 | 1/2 | 0.5 |
| 315° | 7π/4 | √2/2 | 0.7071 |
| 330° | 11π/6 | √3/2 | 0.866 |
| 360° | 2π | 1 | 1 |