The Circle – Taking a Walk

In this post we will take a walk on the unit circle. The unit circle is a circle with a radius of 1 arbitrary unit. Exploration of circles is usually done on the unit circle because it simplifies all sorts of math.

To begin with let us define precisely what a circle is: It is the set of all points which are the same distance from a point called the center. The area within a circle is called a disc. Traditionally we describe the unit circle as existing in R2 space so each point has the coordinates (x,y).

Let’s attempt the simple task of drawing a circle.

The unit circle has a radius of 1.
r = 1

The normal unit circle is centered at the point (0,0) called the origin. If it is centered elsewhere we write it as (a,b).
a = 0 \\ b = 0

According to the definition of a circle that is sufficient information so lets take a look at the origin point, the radius, and the circle itself. I’ll draw it quickly and then we can try to study it.

UnitCircle

Now let’s see what we can figure out immediately about this shape.

Obviously . . .
\text{when}\ x = 0\ \text{then}\ y = 1
. . . and . . .
\text{when}\ x = 1\ \text{then}\ y = 0

That is sufficient to draw four points, two on each axis.

UnitCirclePoints

There are an infinite number of points, though, so we will have to pick up the pace considerably if we ever want to finish this thing. Let’s try to evaluate the point x=0.5 and see what we can learn. Since the circle is described by the radius the position of (x=0.5,y=?) is the point where the tip of the radius line touches x=0.5.

UnitCircTriang

That looks like a right triangle to me! We know two of the sides, the radius is the hypotenuse and the short side is 0.5 because we decided it would be. The old Pythagorean theorem tells us how to solve this

a^2 + b^2 = c^2 \\ x^2 + y^2 = r^2
. . . thus . . .
0.5^2 + y^2 = 1^2
. . . thus . . .
.25 + y^2 = 1
. . . thus . . .
y^2 = 0.75
. . . thus . . .
y = \sqrt{0.75} = 0.866

And since every point is related to the center in the same way, by the definition of the circle, we can now solve for every point.

\displaystyle y = \sqrt{r^2 - x^2} \\ x = \sqrt{r^2 - y^2}

In R we can write this as:

## The radius
r <- 1
## Sequence of x-values
x <- seq(-1,1,.01)
## The equation that defines y
y <- sqrt(r^2 - x^2)

## Since we need the positive and negative
## values of y at each x we do a little more.
x <- c(x,x)
y <- c(y,-y)

# Plot it.
plot(y~x, asp = 1)

UnitCircDraw

You can see that the point’s we’ve plotted aren’t evenly spaced but they do describe a circle.

The fact that the unit circle, and thus any circle, is “solved” by the Pythagorean theorem, which we normally associate with triangles, is critically important. Much of our basic knowledge of these two shapes comes from their relationship.

The simplest way to draw a circle is to use Euler’s identity. The function only asks us for the angle associated with each point. We’ll come back to this function later on when we look at Euler’s identity. For now feel free to try it out and see that it works.

circ <- function(th = 2*pi, shift = 0, scale = 1, n = 99,
			xlim = c(-1,1), ylim = c(-1,1), lwd = 2,
			xlab = 'x', ylab = 'y', main = '', draw = TRUE){
	th <- seq(0,th,len=(n+1))+shift
	z <- exp(1i*th) * scale
	x <- Re(z)
	y <- Im(z)
	out <- data.frame(x,y)

	if(draw == TRUE) {
	plot(z, type = 'l', 
		lwd = lwd, asp = 1,
		xlab = xlab, ylab = ylab,
		xlim = xlim, ylim = ylim,
		main = main)
	}
	invisible(out)
}

## The drawings from this post.
circ(main = 'The Unit Circle')

circ(main = 'The Unit Circle \n With Points')
points(c(0,-1,0,1), c(1,0,-1,0), cex = 1.5, pch = 16)

circ(main = 'The Unit Circle \n With One Point')
segments(0,0,.5,.866)
segments(.5,.866,.5,0)
segments(0,0,.5,0)
text(.75,.9,label = '(x=0.5,y=??)')

Leave a comment