trigonometry25 min

Angles and Radians

Understanding angle measurement in degrees and radians, and converting between them

0/9Not Started

Why This Matters

Angles are one of the most fundamental ideas in mathematics and computing. Every rotation on a screen, every turn in a game, every arc drawn on a canvas relies on angle measurement. If you have ever rotated an image, steered a character, or drawn a pie chart in code, you have worked with angles — even if you did not realize it.

Most people learn angles in degrees, where a full circle is 360. But nearly every programming language and math library measures angles in radians, where a full circle is 2 times pi (approximately 6.2832). Radians are not just a convention — they simplify formulas across calculus, physics, and computer graphics. If you call Math.sin(90) expecting the sine of 90 degrees, you will get the wrong answer because the function expects radians. Understanding radians and how to convert between the two systems is essential for writing correct trigonometric code.

Define Terms

Visual Model

DegreesFull circle = 360
RadiansFull circle = 2 pi
ConversionMultiply by pi/180
ReverseMultiply by 180/pi
90 deg = pi/2
180 deg = pi
360 deg = 2 pi

The full process at a glance. Click Start tour to walk through each step.

Degrees and radians are two ways to measure the same angle. Multiply by pi/180 to go from degrees to radians.

Code Example

Code
// Converting degrees to radians
function degreesToRadians(degrees) {
  return degrees * (Math.PI / 180);
}

// Converting radians to degrees
function radiansToDegrees(radians) {
  return radians * (180 / Math.PI);
}

// Common angles
console.log("90 deg in rad:", degreesToRadians(90).toFixed(4));   // 1.5708 (pi/2)
console.log("180 deg in rad:", degreesToRadians(180).toFixed(4)); // 3.1416 (pi)
console.log("360 deg in rad:", degreesToRadians(360).toFixed(4)); // 6.2832 (2*pi)

// Going back
console.log("pi/2 in deg:", radiansToDegrees(Math.PI / 2)); // 90
console.log("pi in deg:", radiansToDegrees(Math.PI));       // 180

// Why radians matter: Math.sin expects radians
console.log("sin(90 degrees) WRONG:", Math.sin(90).toFixed(4));                  // 0.8940
console.log("sin(90 degrees) RIGHT:", Math.sin(degreesToRadians(90)).toFixed(4)); // 1.0000

// Full rotation check
const fullCircle = degreesToRadians(360);
console.log("Full circle:", fullCircle.toFixed(4), "= 2*pi:", (2 * Math.PI).toFixed(4));

Interactive Experiment

Try these exercises:

  • Convert 45, 60, 120, 270, and 720 degrees to radians. Which ones are multiples of pi?
  • What happens if you pass a negative angle to the conversion function? What does a negative angle mean geometrically?
  • Call Math.sin(90) and Math.sin(Math.PI / 2). Compare the results. Why are they different?
  • Convert 1 radian to degrees. Is it closer to 57 or 58 degrees? Why is this number important?
  • What is 2 pi radians in degrees? What about 4 pi? How do angles beyond a full circle work?

Quick Quiz

Coding Challenge

Degree-Radian Converter

Write two functions: `degreesToRadians(degrees)` that converts degrees to radians, and `radiansToDegrees(radians)` that converts radians to degrees. Use the formulas: radians = degrees * (pi / 180) and degrees = radians * (180 / pi). Round your output to 4 decimal places using `.toFixed(4)` for consistent test output.

Loading editor...

Real-World Usage

Angles and radians appear everywhere in computing:

  • Computer graphics: Every rotation, from spinning a 3D model to rotating a CSS element, uses radians internally. GPU shaders process angles in radians.
  • Game development: Character facing direction, projectile trajectories, and camera rotation all depend on radian-based angle math.
  • Robotics: Joint angles for robot arms are calculated in radians. Servo motors receive radian-based position commands.
  • Signal processing: Audio and radio waves are described using angular frequency in radians per second. The formula is omega = 2 * pi * frequency.
  • Navigation and mapping: GPS coordinates use degrees, but distance and bearing calculations convert to radians for spherical trigonometry.

Connections