Put a right triangle inside a circle of radius 1 and the cosine and sine become the coordinates of a point. That gives every angle a sine and a cosine, with signs, proves that their squares add to 1, and lets any point be named by a distance and a direction.
Define the cosine and sine of any angle as the coordinates of the point at that angle on the unit circle, and show that this agrees with the triangle ratios between 0° and 90°.
Give the signs of the cosine and the sine in each quarter of the plane, and their values at 0°, 90°, 180° and 270°.
Derive from the distance formula that the squares of the cosine and the sine of any angle add up to 1.
Convert a point between (x, y) and polar coordinates (r, θ), using atan2 to keep the right quarter.
In review. The maths and code on this page are checked by automated tests on every change, but an independent reader has not signed it off yet. Spot a mistake or a confusing step? Tell us.
The question
The arrow \({(3, 4)}\) of M01.2.4 points at \(53.13^\circ\). The arrow \({(-3, 4)}\) points up and to the left. Ask for the angle whose tangent is its slope, \({4 / (-3)}\), and a calculator answers \({-53.13^\circ}\): an arrow pointing down and to the right. Something was lost on the way. And the triangle ratios of the last lesson stop at \(90^\circ\), so what could \(\sin 126.87^\circ\) even mean?
From the last lesson
1. Define \(\sin\theta\), \(\cos\theta\) and \(\tan\theta\) for an angle of a right triangle.
Show answer
\(\sin\theta\) is the opposite side over the hypotenuse, \(\cos\theta\) the adjacent side over the hypotenuse, and \(\tan\theta\) the opposite side over the adjacent side.
2. What are \(\sin 30^\circ\) and \(\cos 30^\circ\) exactly?
Show answer
\(\sin 30^\circ\) is \(\tfrac12\) and \(\cos 30^\circ\) is \(\tfrac{\sqrt{3}}{2}\), about \(0.8660\), read off half an equilateral triangle of side 2.
Intuition
Draw a circle of radius 1 around the origin: the unit circle. Start at the point \({(1, 0)}\) and turn anticlockwise about the origin through an angle \(\theta\). Then drop a line from where you land straight down to the \(x\)-axis.
You have built a right triangle with the angle \(\theta\) at the origin and a hypotenuse of length 1, the radius. So its sides are easy: the side across from \(\theta\) is \(\sin\theta\) times 1, and the side next to \(\theta\) is \(\cos\theta\) times 1. But those two sides are exactly how far the point is up and how far it is across. The point you landed on is \({(\cos\theta, \sin\theta)}\).
M01.5.2-F1
The point at angle \(\theta\) on the unit circle is \({(\cos\theta, \sin\theta)}\). In the second quarter the horizontal side points left, so the cosine is negative.
Now keep turning. Past \(90^\circ\) the triangle of the last lesson stops making sense, but the point on the circle is still there. So we let the point be the definition: for any angle at all, the cosine is how far across the point is, and the sine is how far up, signs included.
Build it up
Step 1. The first quarter agrees with the triangles. For an angle between \(0^\circ\) and \(90^\circ\), the triangle under the point has hypotenuse 1, so its opposite side is \(\sin\theta\) and its adjacent side is \(\cos\theta\), the ratios of M01.5.1 with nothing divided. At the angle of the 3-4-5 triangle, about \(53.13^\circ\), the point is \({(0.6, 0.8)}\): that triangle shrunk by a factor of 5.
Step 2. The other quarters give signs. Turn to \({180^\circ - 53.13^\circ}\), which is \(126.87^\circ\). The radius now makes the same angle, \(53.13^\circ\), with the negative \(x\)-axis as the old one made with the positive \(x\)-axis, so the new point is the mirror image of the old one in the vertical axis: just as high, but on the left. So the new point is \({(-0.6, 0.8)}\): \({\cos 126.87^\circ \approx -0.6}\) while \({\sin 126.87^\circ \approx 0.8}\). Below the horizontal axis the sine is negative in the same way.
M01.5.2-F2
Four mirror-image points. Their coordinates have the same sizes, and the quarter decides the signs.
Step 3. The quarter turns. Turning a quarter at a time lands on the axes, so the values there can be read straight off the picture:
\(\theta\)
\(\cos\theta\)
\(\sin\theta\)
\(0^\circ\)
\(1\)
\(0\)
\(90^\circ\)
\(0\)
\(1\)
\(180^\circ\)
\({-1}\)
\(0\)
\(270^\circ\)
\(0\)
\({-1}\)
Step 4. More than a full turn, and turning backwards. Turning by \(360^\circ\) brings the point back to where it started, so \(\theta\) and \({\theta + 360^\circ}\) give the same point, the same cosine and the same sine. A negative angle turns clockwise: \({-90^\circ}\) lands on \({(0, -1)}\), the same point as \(270^\circ\).
Step 5. The tangent is a slope. For any angle, \(\tan\theta\) is still \(\sin\theta\) divided by \(\cos\theta\). On the picture that is the rise over the run of the radius, its slope (M01.3.2). At \(90^\circ\) and \(270^\circ\) the radius stands upright, the cosine is 0, and the tangent does not exist.
The formal statement
NoteDefinition: cosine and sine of any angle
Turn the point \({(1, 0)}\) about the origin through the angle \(\theta\), anticlockwise if \(\theta\) is positive and clockwise if it is negative. The point reached on the unit circle is
Where \(\cos\theta\) is not 0, the tangent is \({\tan\theta = \sin\theta / \cos\theta}\).
The squares add to 1. Write \(\cos^2\theta\) for \((\cos\theta)^2\), as everyone does. The point \({(\cos\theta, \sin\theta)}\) lies on the unit circle, so its distance from the origin \({(0, 0)}\) is 1. The distance formula (M01.2.3) says
In the first quarter this is Pythagoras in the triangle with hypotenuse 1. In the other quarters the coordinates may be negative, but squaring removes the signs, so it holds for every angle. Check at \(126.87^\circ\): \({(-0.6)^2}\) is \(0.36\), \(0.8^2\) is \(0.64\), and they add to 1.
Polar coordinates. A point at distance \(r\) from the origin in the direction \(\theta\) lies on the circle of radius \(r\). Its triangle is the unit-circle triangle enlarged by the factor \(r\) (scaled copies again, M01.5.1), so
\[
\begin{aligned}
x &= r\cos\theta, \\
y &= r\sin\theta .
\end{aligned}
\]
The pair \({(r, \theta)}\) is the point’s polar coordinates: a distance and a direction instead of an across and an up.
The way back. Given \({(x, y)}\), the distance comes from the distance formula:
\[
r = \sqrt{x^2 + y^2} .
\]
The direction is harder. Its tangent is the slope \({y/x}\), but \({(-3, 4)}\) and \({(3, -4)}\) have the same slope, \({-4/3}\), and point in opposite directions. The function \(\operatorname{atan}\) cannot tell them apart: it always answers between \({-90^\circ}\) and \(90^\circ\), in the right half of the plane. The function atan2 takes \(y\) and \(x\) separately, sees both signs, and returns the angle between \({-180^\circ}\) and \(180^\circ\) that points at \({(x, y)}\).
Go deeper: how atan2 picks the quarter
It starts from \({\operatorname{atan}(y/x)}\) and corrects it by looking at the signs.
If \({x > 0}\), the point is in the right half, and \({\operatorname{atan}(y/x)}\) is already right.
If \({x < 0}\) and \({y \ge 0}\), the point is in the upper left, and the answer is \({\operatorname{atan}(y/x) + 180^\circ}\).
If \({x < 0}\) and \({y < 0}\), the point is in the lower left, and the answer is \({\operatorname{atan}(y/x) - 180^\circ}\).
If \({x = 0}\), the point is on the vertical axis: \(90^\circ\) when \({y > 0}\) and \({-90^\circ}\) when \({y < 0}\).
For \({(-3, 4)}\): \({\operatorname{atan}(-4/3)}\) is \({-53.13^\circ}\), and adding \(180^\circ\) gives \(126.87^\circ\). The correction is a half turn because a half turn is exactly what turns \({(3, -4)}\) into \({(-3, 4)}\).
Worked example
Write the arrows \({(3, 4)}\) and \({(-3, 4)}\) in polar coordinates, and convert back.
M01.5.2-F3
Both points are 5 from the origin. Their directions differ: \(53.13^\circ\) and \(126.87^\circ\).
The arrow \({(3, 4)}\). Its distance is \({\sqrt{9 + 16}}\), which is \({\sqrt{25} = 5}\). It lies in the first quarter, where the slope gives the right answer: \({\operatorname{atan}(4/3)}\) is about \(53.13^\circ\). So in polar coordinates it is \({(5, 53.13^\circ)}\). Back again:
The arrow \({(-3, 4)}\). Its distance is 5 as well. The slope is \({-4/3}\), and \({\operatorname{atan}(-4/3)}\) is \({-53.13^\circ}\), which points into the fourth quarter, at \({(3, -4)}\). The point is in the second quarter, so add a half turn: \({\operatorname{atan2}(4, -3)}\) is \(126.87^\circ\). Back again, using the signs of Step 2:
Both conversions from scratch. Python’s math.cos and math.sin expect the angle in radians (the next lesson explains them), so the functions convert at the door and work in degrees everywhere else.
import mathdef to_xy(r, degrees):"""From polar coordinates (distance r, angle in degrees) to (x, y).""" theta = math.radians(degrees) # math.cos and math.sin expect radiansreturn r * math.cos(theta), r * math.sin(theta)def to_polar(x, y):"""From (x, y) to polar coordinates (distance, angle in degrees).""" r = math.sqrt(x **2+ y **2) # the distance formula, measured from the origin theta = math.atan2(y, x) # y first, then x; the answer is in radiansreturn r, math.degrees(theta)for point in [(3, 4), (-3, 4), (-3, -4), (3, -4)]: r, angle = to_polar(point[0], point[1])print(point, "-> r =", r, " angle =", round(angle, 2))print("atan of the slope of (-3, 4):", round(math.degrees(math.atan(4/-3)), 2))x, y = to_xy(5, 126.87)print("back from r = 5 at 126.87 degrees:", round(x, 4), round(y, 4))
(3, 4) -> r = 5.0 angle = 53.13
(-3, 4) -> r = 5.0 angle = 126.87
(-3, -4) -> r = 5.0 angle = -126.87
(3, -4) -> r = 5.0 angle = -53.13
atan of the slope of (-3, 4): -53.13
back from r = 5 at 126.87 degrees: -3.0 4.0
The output shows the whole story of the hook: atan2 places all four points in their own quarters, while the slope alone gives \({-53.13^\circ}\) for \({(-3, 4)}\). Notice that atan2 reports \({(-3, -4)}\) as \({-126.87^\circ}\), a clockwise turn. That is the same direction as \(233.13^\circ\), since the two differ by a full turn.
Next the quarter turns, and the identity at every multiple of \(45^\circ\):
for angle in [0, 90, 180, 270, 360]: x, y = to_xy(1, angle)print(angle, round(x, 4) +0.0, round(y, 4) +0.0) # adding 0.0 turns -0.0 into 0.0print("cos 90 degrees before rounding:", math.cos(math.radians(90)))for angle inrange(0, 361, 45): c, s = math.cos(math.radians(angle)), math.sin(math.radians(angle))print(angle, "cos^2 + sin^2 =", round(c **2+ s **2, 12))
The unrounded cosine of \(90^\circ\) comes out as a tiny number, about \({6 \times 10^{-17}}\), rather than 0. It is a rounding error: the computer cannot store the exact radian value of \(90^\circ\), so it computes the cosine of an angle a hair away from it. Compare with care, never with ==.
The library has the distance built in as math.hypot, and NumPy does both jobs for a whole array of points at once, which is how a data set of points is converted in one line:
import numpy as npprint(math.hypot(-3, 4))xs = np.array([3, -3, -3, 3])ys = np.array([4, 4, -4, -4])print(np.hypot(xs, ys)) # four distancesprint(np.round(np.degrees(np.arctan2(ys, xs)), 2)) # four angles: y first, then x
5.0
[5. 5. 5. 5.]
[ 53.13 126.87 -126.87 -53.13]
In machine learning, polar coordinates are how a direction is separated from a size. A gradient step (ML01.5) and a word embedding are arrows; their length says how big and their direction says which way, and cosine similarity (M02.3.3) compares two directions by the cosine of the angle between them.
Explore
M01.5-X1
Unit-circle explorer
Drag the blue point round the circle, or move the slider. The horizontal side is \(\cos\theta\) and the vertical side is \(\sin\theta\); the read-out gives both, their signs and the sum of their squares. Press Play to turn the point steadily, or Step to move \(15^\circ\) at a time. The wave beside the circle (below it on a phone) is the next lesson’s subject.
Turn the point into each quarter and say the two signs before you read them. Then stop at \(126^\circ\): the horizontal side points left and the read-out shows a negative cosine, about \({-0.59}\).
Pitfalls
M01.5.2-F4
Wrong beside right. The slope of \({(-3, 4)}\) is the same as the slope of \({(3, -4)}\), so \(\operatorname{atan}\) of the slope points the wrong way. atan2 sees both signs.
“The angle of \({(x, y)}\) is \({\operatorname{atan}(y / x)}\).”
Only in the right half of the plane. For \({(-3, 4)}\) it gives \({-53.13^\circ}\), the direction of \({(3, -4)}\), off by a half turn; for a point on the vertical axis it divides by zero. Use atan2(y, x), which keeps the two signs apart. In NumPy it is np.arctan2(y, x).
“math.atan2(x, y), in the order of the coordinates.”
The order is \(y\) first, then \(x\), because the function is named after \({\operatorname{atan}(y/x)}\). With the order swapped, math.atan2(-3, 4) returns the angle of the point \({(4, -3)}\), about \({-36.87^\circ}\), instead of the \(126.87^\circ\) of \({(-3, 4)}\). Both Python and NumPy put \(y\) first.
“\(\cos^2\theta\) means the cosine of \(\theta^2\).”
It means the square of the cosine, \((\cos\theta)^2\). The habit of writing the power after the name saves brackets. At \(60^\circ\), \(\cos^2 60^\circ\) is \((\tfrac12)^2\), which is \(\tfrac14\).
Check yourself
Recall
1. What are the coordinates of the point at angle \(\theta\) on the unit circle?
Show answer
\({(\cos\theta, \sin\theta)}\): the cosine is how far across, the sine how far up.
2. In which quarter are the cosine and the sine both negative?
Show answer
The third quarter, between \(180^\circ\) and \(270^\circ\), where the point is to the left of and below the origin.
3. What are \(\cos 180^\circ\) and \(\sin 270^\circ\)?
Show answer
Both are \({-1}\): the point at \(180^\circ\) is \({(-1, 0)}\) and the point at \(270^\circ\) is \({(0, -1)}\).
4. Why do \(\cos^2\theta\) and \(\sin^2\theta\) add to 1 for every angle?
Show answer
The point \({(\cos\theta, \sin\theta)}\) is on the unit circle, 1 from the origin, and the distance formula squared says the two squares add to \(1^2\).
5. What are the polar coordinates of the point \({(0, -2)}\)?
Show answer
Distance 2 and angle \({-90^\circ}\) (or, turning the other way, \(270^\circ\)). This is what atan2(-2, 0) returns, in radians.
Exercises
1.★ Give the exact coordinates of the point at \(150^\circ\) on the unit circle, and of the point at distance 4 in the same direction.
Show solution
The point at \(150^\circ\) is the mirror image in the vertical axis of the point at \(30^\circ\), which is \({(\tfrac{\sqrt{3}}{2}, \tfrac12)}\). So
At distance 4, multiply both coordinates by 4: \({(-2\sqrt{3}, 2)}\), about \({(-3.4641, 2)}\).
2.★★ Write the point \({(-5, -12)}\) in polar coordinates. What would the slope alone have suggested?
Show solution
The distance is
\[
r = \sqrt{25 + 144} = \sqrt{169} = 13 .
\]
The slope is \({-12 / (-5)}\), which is \(2.4\), and \(\operatorname{atan}(2.4)\) is about \(67.38^\circ\): a direction in the first quarter, towards \({(5, 12)}\). But the point is in the third quarter, so take off a half turn: \({67.38^\circ - 180^\circ}\) gives about \({-112.62^\circ}\), which is what atan2(-12, -5) returns (in radians). Turning the other way, the same direction is \(247.38^\circ\). Check: \({13\cos(-112.62^\circ)}\) is about \({-5}\) and \({13\sin(-112.62^\circ)}\) is about \({-12}\).
3.★★★ An angle \(\theta\) in the second quarter has \({\sin\theta = 0.6}\). Find \(\cos\theta\), \(\tan\theta\) and \(\theta\) itself.
Show solution
The squares add to 1, so
\[
\cos^2\theta = 1 - 0.36 = 0.64 ,
\]
and \(\cos\theta\) is \(0.8\) or \({-0.8}\). In the second quarter the cosine is negative, so \({\cos\theta = -0.8}\). Then \(\tan\theta\) is \(0.6\) divided by \({-0.8}\), which is \({-0.75}\). For the angle: the first-quarter angle with sine \(0.6\) is \(\operatorname{asin}(0.6)\), about \(36.87^\circ\), and its mirror image in the vertical axis is \({180^\circ - 36.87^\circ}\), which is \(143.13^\circ\).
Summary card
The cosine and the sine are the coordinates of a point on the unit circle.
M01.5.2-F1
The point at angle \(\theta\) is \({(\cos\theta, \sin\theta)}\).
The point at angle \(\theta\) is \({(\cos\theta, \sin\theta)}\), for every angle; the quarter decides the signs.
\({\cos^2\theta + \sin^2\theta = 1}\), from the distance formula.
Polar to ordinary: \({x = r\cos\theta}\) and \({y = r\sin\theta}\).
Ordinary to polar: \({r = \sqrt{x^2 + y^2}}\), and \(\theta\) is atan2(y, x), never the atan of the slope.
Sources and next steps
Sources. Each was opened and checked against this lesson on 12 November 2026.
Jay Abramson and others, Algebra and Trigonometry 2e, Section 7.3 Unit Circle, OpenStax. Defines the cosine and sine as the \(x\)- and \(y\)-values of the point on the unit circle (\({x = \cos t}\), \({y = \sin t}\)), states the Pythagorean identity for any real number, gives the signs by the signs of \(x\) and \(y\) in each quadrant, and the reference angle.
Jay Abramson and others, Algebra and Trigonometry 2e, Section 10.3 Polar Coordinates, OpenStax. The conversions \({x = r\cos\theta}\), \({y = r\sin\theta}\), \({r^2 = x^2 + y^2}\) and \({\tan\theta = y/x}\), with the reminder to consider the quadrant of the point.
Python Software Foundation, math — Mathematical functions, Python 3.12 documentation. math.atan2(y, x) returns a result between \({-\pi}\) and \(\pi\) and “can compute the correct quadrant for the angle”, because the signs of both inputs are known to it; math.hypot returns the length of the vector from the origin to the point.
NumPy reference, numpy.arctan2 and numpy.hypot. arctan2 chooses the quadrant correctly and takes the \(y\)-coordinates first; its example turns the points \({(\pm 1, \pm 1)}\) into \({-135^\circ}\), \({-45^\circ}\), \(45^\circ\) and \(135^\circ\). hypot returns the hypotenuse from the two legs, element by element.
Next.M01.5.3 Radians and sine waves measures the angle by the distance walked round the circle, and unrolls the circle into a wave.