Measure an angle by the length of arc it cuts from the unit circle and a full turn becomes 2π. Unroll the circle and the sine becomes a wave that repeats every 2π; then stretch it, slow it and slide it with an amplitude, a period and a phase.
Define the radian as arc length on the unit circle, and convert between degrees and radians with the factor π/180.
Explain how plotting the height of a turning point against the distance it has travelled draws the sine wave, and why the wave repeats every 2π.
Show that the cosine wave is the sine wave moved a quarter turn earlier.
Read the amplitude, period, frequency and phase of y = A sin(2πt/T + φ) off a graph, and predict what changing each one alone does.
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
Ask Python for math.sin(90) and it answers about \(0.894\). But the point at \(90^\circ\) on the unit circle is \({(0, 1)}\), so the sine of a right angle is 1. Python is not wrong: it measures angles in a different unit, the one that the formulas of machine learning use, from the seasonal patterns of a sales forecast to the position codes of a language model. What is that unit, and why does it turn a circle into a wave?
From the last lesson
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. What does math.atan2(4, -3) return, in degrees, and why not \({-53.13^\circ}\)?
Show answer
About \(126.87^\circ\), once converted with math.degrees. It sees that \(x\) is negative and \(y\) positive, so it answers in the second quarter; \({-53.13^\circ}\) would point at \({(3, -4)}\).
Intuition
So far an angle has been measured in degrees, a full turn cut into 360 equal parts, a number chosen long ago. There is a way to measure an angle that needs no chosen number at all: walk round the unit circle and measure how far you have walked.
M01.5.3-F1
Left: the angle that cuts an arc of length 1 from the unit circle is one radian, about \(57.30^\circ\). Right: roll the unit circle once along a line and it covers its whole circumference, \(2\pi\), about \(6.28\).
The angle whose arc is exactly as long as the radius is called one radian. A full turn walks the whole circumference. Every circle’s circumference is \(\pi\) times its diameter, where \(\pi\) is about \(3.14159\), and the unit circle has diameter 2, so a full turn is \(2\pi\) radians, about \(6.28\). A half turn is \(\pi\) and a quarter turn is \({\pi/2}\).
Then a picture follows almost by itself. Walk round the circle at a steady pace and, at every moment, plot how high you are against how far you have walked. The height rises, falls, dips below zero and comes back: the circle unrolls into a wave.
Build it up
Step 1. Converting. A full turn is both \(360^\circ\) and \(2\pi\) radians, so one degree is \({2\pi/360}\) of a radian, which simplifies to \({\pi/180}\). To turn degrees into radians, multiply by \({\pi/180}\); to go back, multiply by \({180/\pi}\). One radian is \({180/\pi}\) degrees, about \(57.30^\circ\).
Degrees
Radians
As a decimal
\(30^\circ\)
\({\pi/6}\)
\(0.5236\)
\(45^\circ\)
\({\pi/4}\)
\(0.7854\)
\(60^\circ\)
\({\pi/3}\)
\(1.0472\)
\(90^\circ\)
\({\pi/2}\)
\(1.5708\)
\(180^\circ\)
\(\pi\)
\(3.1416\)
\(360^\circ\)
\(2\pi\)
\(6.2832\)
From here on, an angle with no degree sign is in radians. That is the habit of mathematics and machine-learning texts, and the reason math.sin expects radians.
Step 2. Arcs on bigger circles. On a circle of radius \(r\) every length is \(r\) times the length on the unit circle (scaled copies again), so an angle of \(\theta\) radians cuts an arc of length \(r\theta\).
Step 3. Unroll the circle. Plot \(\sin\theta\), the height of the point, against \(\theta\), the distance walked. Because the angle is measured in radians, one unit along the graph is one unit walked round the circle.
M01.5.3-F2
Every \(30^\circ\), which is \({\pi/6}\), the height of the point is carried across to the graph. The sine wave is the circle unrolled.
Step 4. The wave repeats. After a walk of \(2\pi\) the point is back where it started, so the heights start again: \({\sin(\theta + 2\pi) = \sin\theta}\) for every \(\theta\). A function that repeats like this is called periodic, and \(2\pi\) is the period of the sine.
Step 5. The cosine is the same wave, a quarter turn earlier. Take the right triangle under the point at angle \(\theta\), with \(\cos\theta\) across and \(\sin\theta\) up. Turn the whole triangle a further quarter turn about the origin. Its across side now points straight up, and its up side now points left. So the point at \({\theta + \pi/2}\) is \({(-\sin\theta, \cos\theta)}\), and its height is the old width:
The signs of the sides travel with them, so this holds in every quarter. Check at \(30^\circ\): the point at \(120^\circ\) has height \(\sin 120^\circ\), about \(0.8660\), which is \(\cos 30^\circ\).
M01.5.3-F3
A quarter turn makes the old width the new height, so the cosine wave is the sine wave moved \({\pi/2}\) earlier.
The formal statement
NoteDefinitions: radian and wave
The radian measure of an angle is the length of the arc it cuts from the unit circle. A full turn is \(2\pi\) radians, and \(\theta\) degrees is \({\theta \times \pi/180}\) radians.
A sine wave in time \(t\) is
\[
y = \cparam{A}\sin\!\left(\frac{2\pi t}{\cparam{T}} + \cparam{\phi}\right),
\]
with amplitude\({\cparam{A} > 0}\), period\({\cparam{T} > 0}\) and phase\(\cparam{\phi}\) (a Greek phi, in radians). Its frequency is \({1/\cparam{T}}\), the number of repeats per unit of time.
The formula has a picture behind it. A point goes round a circle of radius \(A\) at a steady pace, once every \(T\) units of time, starting at the angle \(\phi\). By time \(t\) it has made \({t/T}\) of a turn, which is \({2\pi t/T}\) radians, so its angle is \({2\pi t/T + \phi}\) and its height is \(y\). Each of the three numbers changes one thing.
M01.5.3-F4
Each parameter changed alone, against the dashed wave with \({A = 1}\), \({T = 4}\) and \({\phi = 0}\).
The amplitude sets the height. The sine is always between \({-1}\) and \(1\), so \(y\) is always between \({-A}\) and \(A\). The peaks are \(A\) above the middle line and the troughs \(A\) below it.
The period sets the repeat. Move \(t\) on by \(T\) and look at the angle inside the sine. Multiplying out the bracket,
That is the angle at time \(t\) plus exactly \(2\pi\), one full turn, and by Step 4 a full turn changes no sine. So \(y\) at time \({t + T}\) equals \(y\) at time \(t\): the wave repeats every \(T\), and a larger \(T\) means a slower wave.
The phase slides the wave. Write the shift as a time \(d\), with \({\phi = 2\pi d / T}\). Then the angle inside the sine is
the angle that the plain wave, with no phase, reaches at time \({t + d}\). So at time \(t\) the wave already has the value that the plain wave reaches at time \({t + d}\): a positive phase moves the whole wave earlier, to the left on a graph, by
\[
d = \frac{\phi\, T}{2\pi} .
\]
Go deeper: why formulas use radians, not degrees
Radians are not just another choice like degrees. Because a radian is a length on the circle, a small angle and the height it produces are almost the same number: a short arc is nearly a straight line standing up from the axis, and the arc’s length is the angle. For an angle of \(0.01\) radians the sine is about \(0.0099998\). In degrees the same angle is \(0.573^\circ\), and nothing that simple holds. This is why calculus (M04) finds the slope of \(\sin\theta\) at \(0\) to be exactly 1 when \(\theta\) is in radians, and why libraries measure angles in them.
Worked example
Read the amplitude, period, frequency and phase off the graph below, and write the wave.
M01.5.3-F5
A wave read off its graph: \({A = 2}\), \({T = 4}\) and a peak that comes 1 unit early.
Amplitude. The wave runs from \({-2}\) up to \(2\), so its peaks are 2 above the middle line: \({A = 2}\).
Period and frequency. Peaks come at \({t = 0}\), \({t = 4}\) and \({t = 8}\), so the wave repeats every 4: \({T = 4}\). The frequency is \({1/4}\), which is \(0.25\) repeats per unit of time.
Phase. The plain wave \({2\sin(2\pi t/4)}\), dashed, starts at 0 and has its first peak a quarter of a period in, at \({t = 1}\). This wave peaks at \({t = 0}\), which is 1 earlier. So \({d = 1}\), and
The wave is \({y = 2\sin(2\pi t/4 + \pi/2)}\). Check it at the five dots:
\(t\)
angle in radians
\(y\)
\(0\)
\({\pi/2}\)
\(2\)
\(1\)
\(\pi\)
\(0\)
\(2\)
\({3\pi/2}\)
\({-2}\)
\(3\)
\(2\pi\)
\(0\)
\(4\)
\({5\pi/2}\)
\(2\)
At \({t = 4}\) the angle is \({5\pi/2}\), which is \({2\pi + \pi/2}\): one full turn past \({\pi/2}\), so the values start again. By Step 5, this wave is also \({2\cos(2\pi t / 4)}\).
Code
A converter from scratch, then the hook’s puzzle solved:
Ninety radians is \(5156.62^\circ\), which is 14 full turns (\(5040^\circ\)) and \(116.62^\circ\) more, and the sine of \(116.62^\circ\) is about \(0.8940\). Python answered exactly the question it was asked.
Next the wave of the worked example, sampled in a loop, with a check that it repeats after one period:
A, T, phi =2, 4, math.pi /2def wave(t):return A * math.sin(2* math.pi * t / T + phi)for t inrange(9):print("t =", t, " y =", round(wave(t), 4) +0.0) # adding 0.0 turns -0.0 into 0.0repeats =Truefor k inrange(100): t = k *0.13# many times, not only whole numbersifnot math.isclose(wave(t + T), wave(t), abs_tol=1e-12): repeats =Falseprint("repeats after one period:", repeats)
t = 0 y = 2.0
t = 1 y = 0.0
t = 2 y = -2.0
t = 3 y = 0.0
t = 4 y = 2.0
t = 5 y = 0.0
t = 6 y = -2.0
t = 7 y = 0.0
t = 8 y = 2.0
repeats after one period: True
Finally NumPy, which applies np.sin to a whole array of angles at once. np.linspace(0, 2 * np.pi, 9) makes nine evenly spaced angles from \(0\) to \(2\pi\), every \(45^\circ\):
import numpy as nptheta = np.linspace(0, 2* np.pi, 9)print(np.round(np.sin(theta), 4) +0.0)print("repeats after 2 pi:", np.allclose(np.sin(theta +2* np.pi), np.sin(theta)))print("cos is sin a quarter turn on:", np.allclose(np.cos(theta), np.sin(theta + np.pi /2)))
[ 0. 0.7071 1. 0.7071 0. -0.7071 -1. -0.7071 0. ]
repeats after 2 pi: True
cos is sin a quarter turn on: True
Waves like these are everywhere in machine learning. A forecast of monthly sales can describe the yearly pattern with terms such as \({\sin(2\pi t / 12)}\) and \({\cos(2\pi t / 12)}\) (time series, S07); sound is a sum of waves (A05); and the original transformer marks the position of each word with sines and cosines of many periods, so that a model can tell the first word from the fifth (DL05).
Explore
Go back to the unit-circle explorer in the previous lesson and press Play. The wave beside the circle (below it on a phone) is drawn against \(\theta\) in radians, marked at \(\pi\), \(2\pi\), \(3\pi\) and \(4\pi\). Watch the point pass \(360^\circ\), which is \(2\pi\): the wave starts again exactly as before. Press Trace cos θ too to see the second wave run a quarter turn ahead.
Pitfalls
M01.5.3-F6
Wrong beside right. Without the conversion, Python turns 90 radians, more than 14 full turns.
“math.sin(90) is the sine of a right angle.”
Python’s math module and NumPy read every angle in radians. math.sin(90) turns 90 radians and returns about \(0.8940\). Convert first: math.sin(math.radians(90)) is \(1.0\), and so is math.sin(math.pi / 2). When a result looks strange, check the unit before anything else.
“A bigger number inside the sine means a longer period.”
It depends where the number sits. In \({\sin(2\pi t / T)}\) the period \(T\) divides, so a bigger \(T\) means a slower wave. But in \(\sin(2t)\) the 2 multiplies: the angle grows twice as fast, and the period is \(\pi\), half of \(2\pi\). Ask how long \(t\) takes to push the angle through \(2\pi\).
“A phase of \(\phi\) moves the wave by \(\phi\).”
The phase is an angle, and the shift is a time, \({\phi T / (2\pi)}\). They agree only when the period is \(2\pi\). In the worked example \(\phi\) is \({\pi/2}\), about \(1.57\), but the wave moves by 1, a quarter of its period of 4. A positive phase also moves the wave earlier, to the left.
Check yourself
Recall
1. What is one radian, and about how many degrees is it?
Show answer
The angle that cuts an arc of length 1 from the unit circle, an arc as long as the radius. It is \({180/\pi}\) degrees, about \(57.30^\circ\).
2. Convert \(45^\circ\) to radians and \({3\pi/2}\) radians to degrees.
Show answer
\(45^\circ\) is \({45 \times \pi/180}\), which is \({\pi/4}\), about \(0.7854\). And \({3\pi/2}\) is \({3\pi/2 \times 180/\pi}\), which is \(270^\circ\).
3. Why does \(\sin\theta\) repeat every \(2\pi\)?
Show answer
A walk of \(2\pi\) is one full turn of the unit circle, which brings the point back to where it started, so its height starts again.
4. In \({y = A\sin(2\pi t / T + \phi)}\), what do \(A\) and \(T\) measure on a graph?
Show answer
\(A\) is the height of a peak above the middle line; \(T\) is the time from one peak to the next.
5. How is the cosine wave related to the sine wave?
Show answer
It is the same wave moved a quarter turn, \({\pi/2}\), earlier: \({\cos\theta = \sin(\theta + \pi/2)}\).
Exercises
1.★ Convert \(120^\circ\) and \(225^\circ\) to radians, exactly and to four decimal places, and convert \(2.5\) radians to degrees.
2.★★ Monthly sales swing 20 above and 20 below their average, the pattern repeats every 12 months, and it is at its highest at \({t = 0}\). Write the swing in the form \({A\sin(2\pi t / T + \phi)}\), give its frequency, and say when it is lowest.
Show solution
The swing is 20 either way, so \({A = 20}\), and it repeats every 12 months, so \({T = 12}\); the frequency is \({1/12}\) of a repeat per month, about \(0.0833\). A sine is highest when its angle is \({\pi/2}\), so at \({t = 0}\) the angle \(\phi\) must be \({\pi/2}\):
\[
y = 20\sin\!\left(\frac{2\pi t}{12} + \frac{\pi}{2}\right).
\]
It is lowest when the angle is \({3\pi/2}\), half a turn later, which takes half a period: \({t = 6}\).
3.★★★ Use a half turn to show that \({\sin(\theta + \pi) = -\sin\theta}\) for every \(\theta\). What does a phase of \({\phi = \pi}\) do to a wave?
Show solution
A half turn is two quarter turns. By Step 5 one quarter turn takes a point \({(x, y)}\) to \({(-y, x)}\), and a second one takes \({(-y, x)}\) to \({(-x, -y)}\). So the point at \({\theta + \pi}\) is \({(-\cos\theta, -\sin\theta)}\), and its height is \({\sin(\theta + \pi) = -\sin\theta}\). Therefore
\({y = A\sin(2\pi t/T + \phi)}\): amplitude \(A\), period \(T\) (frequency \({1/T}\)), and a phase \(\phi\) that moves the wave \({\phi T/(2\pi)}\) earlier.
Code: math.sin takes radians. Use math.radians first, or np.sin on an array of radians.
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.1 Angles, OpenStax. One radian is the central angle whose arc is as long as the radius; a full revolution of \(360^\circ\) is \(2\pi\) radians; degrees are to 180 as radians are to \(\pi\); an arc cut by an angle of \(\theta\) radians on a circle of radius \(r\) has length \(r\theta\).
Jay Abramson and others, Algebra and Trigonometry 2e, Section 8.1 Graphs of the Sine and Cosine Functions, OpenStax. Sine and cosine are periodic with period \(2\pi\); the amplitude is the greatest distance from rest; for \({y = A\sin(Bx - C) + D}\) the period is \({2\pi/\abs{B}}\) and the phase shift is \({C/B}\). In this lesson’s form \(B\) is \({2\pi/T}\) and \(C\) is \({-\phi}\), so the shift is \({-\phi T/(2\pi)}\): the same wave moved \({\phi T/(2\pi)}\) to the left.
Python Software Foundation, math — Mathematical functions, Python 3.12 documentation: math.sin(x) returns “the sine of x radians”, and math.radians and math.degrees convert. NumPy reference, numpy.sin: the input is an angle in radians (“\(2\pi\) rad equals 360 degrees”), applied element by element.
Rob J. Hyndman and George Athanasopoulos, Forecasting: Principles and Practice, 3rd edition, Section 7.4 Some useful predictors. For a seasonal period \(m\), the first Fourier terms are \({\sin(2\pi t/m)}\) and \({\cos(2\pi t/m)}\) and their multiples, and sine and cosine terms of the right frequencies can approximate any periodic function.
Ashish Vaswani and others, Attention Is All You Need, 2017, Section 3.5 Positional Encoding. Positions are encoded with sines and cosines of different frequencies, whose wavelengths form a geometric progression from \(2\pi\) to \({10000 \times 2\pi}\).