Archives for mathematics

Bitwise Operators and Negative Numbers

When representing integers using a fixed number of bits, negative numbers are typically represented using two’s complement. If using n bit numbers, the two’s complement of a number x with 0 ≤ x < 2n is (-x) mod 2n = 2n – x. But what do you do if you want to work with unbounded/multiple-precision [...]

Arithmetic by Geometry

Today real numbers are most often represented by applying (elementary) functions to (decimal) integers. Throughout history, though, arithmetic and propositions involving (positive) real numbers were often considered from a purely geometrical point of view. Real numbers were identified by the length of some line segment and, e.g., the product of two numbers was identified by [...]

Line-line Intersection in the Plane

How do you calculate the point where two lines in the plane intersect? It is not very hard to do, but the formula can look quite complicated, depending on how you write it up. This article is a reminder that it can be expressed in a simple manner.

Visualizing the Pythagorean Theorem

Most people are familiar with the Pythagorean theorem: In a right-angled triangle the square of the hypotenuse is equal to the sum of the squares of the other two sides. As the name of the theorem implies, it is attributed to Pythagoras, a Greek mathematician who lived around 500 B.C. The theorem is also included [...]

Fractions and Circles

Fractions produced by mediants have some very interesting properties. We saw some of them in connection with the Stern-Brocot tree. This articles explores a more curious property, relating fractions to circles in the plane. It was discovered in 1938 by Lester R. Ford and is also mentioned in Conway and Guy’s The Book of Numbers.

The Stern-Brocot Tree of Fractions

Consider two fractions \frac{m_1}{n_1} and \frac{m_2}{n_2} with positive numerators and denominators. The fraction \frac{m_1+m_2}{n_1+n_2} is called the mediant of \frac{m_1}{n_1} and \frac{m_2}{n_2}. It is straightforward to show that the mediant is placed numerically between the original fractions,

\frac{m_1}{n_1} < \frac{m_2}{n_2} \quad \Rightarrow \quad \frac{m_1}{n_1} < \frac{m_1+m_2}{n_1+n_2} < \frac{m_2}{n_2}.

Consider now the following simple procedure [...]

Continued Fractions and Continuants

We will be considering continued fractions of the form

a_0 + \displaystyle\frac{1}{a_1 + \displaystyle\frac{1}{\ddots + \displaystyle\frac{1}{a_{n-1} + \displaystyle\frac{1}{a_n}}}}

where the a_k‘s are real numbers called the partial quotients [...]

Remembering Trigonometric Addition Formulas

The addition formulas for sine and cosine look like this:

\begin{aligned}
\cos(\alpha + \beta) &= \cos \alpha \cos \beta – \sin \alpha \sin \beta, \\
\sin(\alpha + \beta) &= \cos \alpha \sin \beta + \sin \alpha \cos \beta. \\
\end{aligned}

I can never remember them [...]

Useful Properties of the Floor and Ceil Functions

This articles explores some basic properties of the integer functions commonly known as floor and ceil. Most of the statements may seem trivial or obvious, but I, for one, have a tendency to forget just how exact you can be when it comes to expressions/equations where floor or ceil functions appear.

On the Divergence of a Geometric Progression Sum

Let us revisit the geometric progression sum considered in an earlier article,

s_r = \sum_{k=0}^\infty r^k = 1 + r + r^2 + r^3 + \ldots,

where r here is a complex number. For what values of r does this infinite sum make sense? Can we find a closed-form expression for s_r in such cases?