The Coin Problem for two denominations

January 12, 2012

The Coin Problem for two denominations is a linear diophantine equation

a_{1}x_{1}+a_{2}x_{2}=b

where a1, a2 and b are positive and a1 and a2 are unequal and have a gcd of one.  The solutions are required to be non-negative integers.

It is called a coin problem because it can be likened to the problem ‘in how many ways can change of b dollars be made in coins of denomination a1 and a2 dollars?’

The largest b for which there is no solution is called the Frobenius number, and for the two denomination case the Frobenius number is a1a2 – a1 – a2. This result is attributed to James Joseph Sylvester and a proof follows.

The equation a1x + a2y = b has an integer solution if and only if the line representing it passes through a point in the real plane whose coordinates are integers. We call such a point an integer point. If p, q is any integer point it is obvious that since a1p + a2q is an integer that every integer point lies on a line of the form a1p + a2q = b, where b is some integer. It is not hard to show using analytical geometry that the lines for which b > 0 lie above and to the right of the line a1x + a2y = 0, with a line with greater b lying above and to the right of a line with lesser b. The solutions to the Frobenius equation are integer points lying in (or on the boundaries of) the upper right hand quadrant (see figure).

Since (a1, a2) = 1 then we know from the general solution of the binary linear diophantine equation (see previous post) that if x1, y1 is some integer point on a1x + a2y = b, then so is x2 = x1 + a2t, y2 = y1 – a1t, for any integer t. The distance between these points is = t√(a12 + a22), so the distance between two adjacent integer points on the line is √(a12 + a22), and if x1 y1 is some point on the line, then x1 + a2, y1 – a1 is the point immediately to its right.

Now consider the line a1x + a2y = a1a2 – a1 – a2. The points (-1, a1-1) and (a2 – 1, -1) are adjacent integer points on this line, and since they lie outside the upper right hand quadrant there is no solution when b = a1a2 – a1 – a2, and the Frobenius number is greater than or equal to a1a2 – a1 – a2.

Now (0, a1) and (a2, 0) are adjacent integer points, and lie on the line a1x + a2y = a1a2. This line, and any line above and to the right of it has a segment of  length at least √(a12 + a22) lying in or on the boundaries of the upper right hand quadrant, and therefore must contain at least one integer point lying in or on this quadrant. Thus the Frobenius number is less than a1a2.

Finally, consider lines for which a1a2 – a1 – a2 < b < a1a2. Each such line intersects the parallelogram defined by the points (0, a1), (-1, a1-1), (a2 – 1, -1) and (a2, 0).  It has a segment of length √(a12 + a22) lying in, or on the edges of, the parallelogram and thus contain at least one integer point. However this integer point cannot be in or on the triangular segment of the parallelogram lying to the left of the y-axis (it may be on the y-axis), since the x-coordinates of all such points are greater than -1 and less than 0. Similarly it has no integer point in the triangular segment below the x-axis (but may have one on the x-axis). Thus the integer points must lie in or on the upper right hand quadrant, and thus each of the Frobenius equations for which a1a2 – a1 – a2 < b < a1a2 has a solution. Thus the Frobenius number is a1a2 – a1 – a2.

Binary Linear Diophantine Equations

January 4, 2012

Euclid’s Algorithm (previous post) provides a means of finding solutions, if solutions exist, of the binary linear diophantine equation

a_{1}x_{1} + a_{2}x_{2} = a_{0}

where the ak are unequal integers (if they are equal we are essentially dealing with an equation in one variable) and solutions in integers are sought.

We begin by showing that if n1 > n2 > 0 are integers we can construct integers a1 and a2 such that

a_{1}n_{1}+a_{2}n_{2}=(n_{1}, n_{2})

where (n1, n2) is the greatest common divisor of n1 and n2.  We perform the Euclidean algorithm (as described in the previous post) on n1 and n2.  If the algorithm has only k = 1 step we have

n_{1} = q_{1}n_{2} (q1 an integer) so n_{1} + (1-q_{1})n_{2} = n_{2} = (n_{1}, n_{2})

If the algorithm has k = 2 steps then

n_{1}-q_{1}n_{2}=(n_{1},n_{2})

More generally it is easy to show by induction that if the algorithm completes in k ≥ 2 steps then

a_{1}=c_{k-1}   and  a_{2} = d_{k-1} where

c_{1}=1   ;  d_{1}=-q_{1}   ;  c_{2} = -q_{2}   ;  d_{2}=1+q_{1}q_{2} and

c_{i}=c_{i-2}-q_{i-2}c_{i-1}   ;  d_{i}=d_{i-2}-q_{i-2}d_{i-1} for i ≥ 3

Proof:  The proposition is true for k = 2 and is easily shown to be true for k = 3.  Let Pi be the proposition that

n_{i+2} = c_{i+2}n_{1}+d_{i+2}n_{2}

with ci and di defined as in the proposition, and for 1 ≤ i ≤ k-1.

It is easily seen that P1 is true. Suppose the proposition is true for all values of i up to some fixed value i ≤ k – 2.  Then

n_{i+3}=n_{i+1}-q_{i+1}n_{i+2}=(c_{i+1}-q_{i+1}c_{i+2})n_{1}+(d_{i+1}-q_{i+1}d_{i+2})n_{2}

So Pi+1 is true. Consequently Pk-1 is true and nk+1 = (n1, n2) can be expressed in the form proposed.

The construction can be easily extended to all (unequal) non-zero integers n1 and n2. We simply find integers a’1 and a’2 such that a’1|n1| + a’2|n2| = (n1, n2) then set a’1=(n1/|n1|)a1 and a’2=(n2/|n2|)a2.

The following is an obvious corollary:

Let p, m, n be non-zero integers. If p divides mn and (p, m) = 1 then p divides n.  (There are integers x, y such that xp + my = (p, m) = 1.  Hence xpn + mny = n.  Since p divides the left hand side it must divide n.)

We can now state a criterion for determining whether a solution to the diophantine equation exists and, if it does, provide a method of constructing a solution:

The linear diophantine equation a1x1 + a2x2 = a0 (with a1 and a2 non-zero and unequal) has a solution only if (a1, a2) divides a0.  If x’1 and x’2 are integers such that a1x’1 + a2x’2 = (a1, a2) then

\displaystyle x_{1} = \frac {a_{0}x'_{1}}{(a_{1},a_{2})}   ;   \displaystyle x_{2} = \frac {a_{0}x'_{2}}{(a_{1},a_{2})}   is a solution.

Proof:  if there is a solution then since (a1, a2) divides a1x1 + a2x2 it must divide a0. The rest is clear on substituting.

Knowing one solution, we can now identify all solutions:

If x10, x20 is a solution of a1x1 + a2x2 = a0 (with a1 and a2 non-zero and unequal) then x1, x2 is a solution if and only if

\displaystyle x_{1}=x_{1}^{0}+ \frac {a_{2}t} {(a_{1},a_{2})}   ;   \displaystyle x_{2}=x_{2}^{0}- \frac {a_{1}t} {(a_{1},a_{2})}    where t is any integer

Proof:  the if part is easily seen by substitution.  For the converse, consider first the case a0 = 0, noting that x1 = 0, x2 = 0 is a solution. Then

\displaystyle x_{1}= \frac {-a_{2}x_{2}} {a_{1}} = \frac {-a'_{2}x_{2}} {a'_{1}}   where a1 = a’1(a1, a2) ; a2 = a’2(a1, a2)

Since (a’1, a’2) = 1 (if this were not so and there were a common divisor k > 1 then k(a1, a2) would divide a1 and a2, a contradiction) then a’1 divides x2 so

\displaystyle x_{2} = \frac {-a_{1}t} {(a_{1}, a_{2})} where t is some integer and \displaystyle x_{1} = \frac {a_{2}t} {(a_{1}, a_{2})}

The general case follows easily from the special case on noting that if x10, x20 and x1, x2 are solutions then a1(x10 -x1) + a2( x20 – x2) = 0

Euclid’s Algorithm

December 30, 2011

Suppose that a and b are integers with b non-zero.  If there is an integer q such that a = qb, then we say that b divides a.

We can visualise the real numbers as lying in increasing order from left to right along a line.  If b is some non-zero integer, then the integers qb, where q runs through all the integers, divide the number line into segments of length |b| and all real numbers other than the qb lie inside one of these segments. Thus we can regard the following as self-evident:

Proposition (The Division Identity): If s is some real number and b is a non-zero integer, then either s = qb for some integer q (b divides s) or there is a unique integer q such that qb < s < qb + |b|.

Any integer that divides each of the integers m and n is called a common divisor or common factor of m and n. If m,n are not both zero we can assume that the set of all common divisors of m and n has a greatest member which is unique and call it the greatest common divisor of m and n and denote it as (m,n) or gcd(m,n). It is clear from the definition that: (m,n) = (|m|, |n|).

An algorithm for finding the gcd of two positive integers was given in Euclid’s Elements around 300 BC. Suppose the integers are n1, n2 with n1 > n2. It is easy to see as a consequence of the Division Identity that either n1 = q1n2 and consequently n2 = (n1, n2), or n1 = q1n2 + n3 with n2 > n3 > 0. We iterate this process to obtain a set of relations

ni = qini+1 + ni+2 (1 < i< k)

nk=qknk+1

The process must terminate because the ni form a descending, finite sequence of positive numbers and if it has not terminated beforehand, the condition ni+2 = 1 forces it to terminate at the next step.

Now nk+1 = (nk, nk+1) and if nk+1 = (ni, ni+1) then nk+1 = (ni-1, ni) (i > 1) because certainly nk+1 divides both these latter numbers and if there were a larger number that divided both of them it would also be a common divisor of ni and ni+1, generating a contradiction.   Thus nk+1 = (n1, n2).

We can obtain a measure of the efficiency of the Euclidean algorithm. Suppose there are k ≥ 3 steps, and that i < k. If ni+1 ≤ ni/2 then since ni+2 < ni+1 then ni+2 ≤ ni/2. If ni+1 > ni/2 then since 1 = ni+2/ni +qini+1/ni we must have qi = 1 and ni+2 ≤ ni/2 also. Hence when 2j + 1 < k we have

\displaystyle \frac {n_{2j+1}}{n_{1}}=\frac {n_{2j+1}}{n_{2j-1}} ... \frac{n_3}{n_1} < \left( \frac{1}{2} \right)^j

Set 2j + 1 = k – s where s = 1 or 2 depending whether k is even or odd. Then

\displaystyle k = s + 1 + \frac {2}{\ln 2} \left( \ln n_{1} - \ln n_{k-s} \right) < 2 \frac{\ln n_{1}} { \ln 2} + 3

Forms of Proof

December 27, 2011

Ideally, mathematical proofs would start with statements that are known, or assumed to be, true and proceed through a series of steps to a final theorem. At each step a new statement would be shown to be true as a consequence of previous statements. However, in number theory in particular, it is often necessary to resort to less direct methods of proof.

Suppose P and Q are certain statements. If the truth of P implies that Q is true, we cannot assume the converse, that is, that Q implies that P is true. For example x = 1 implies that x2 = 1, but if x2 = 1, x is not necessarily 1. If the converse does happen to be true, we say that “P is true if and only if Q is true”, or that the statements P and Q are logically equivalent. For example, as can be easily shown, n is odd if and only if n2 is odd for all integers n.

Although the statement “If P is true then Q is true” does not imply its converse, it does imply the contrapositive, namely “If Q is false then P is false”. For example if x2 ≠ 1 then x ≠ 1. In number theory, propositions are often proved by proving the contrapositive.

If the truth of P implies Q is true, then the truth of Q is a necessary condition for P to be true, that is, P cannot be true unless Q is true, and it is not possible for P to be true if Q is false. If the truth of Q implies P is true, then Q is a sufficient condition for P to be true. That is, instances of Q being true can provide us with instances of P being true, but not necessarily all such instances. If Q is both necessary and sufficient then it is the logical equivalent of P. P is true on precisely those occasions when Q is true.

Reductio ad absurdum is a variant of the contrapositive. Suppose P is a proposition that it is desired to prove true. This method of proof starts with the proposition that P is false and shows that this leads to a conclusion that is either known to be false, or contradicts the proposition that P is false. This is considered to negate the proposition that P is false and hence prove that P is true.

As an example of its use (and also the use of the contrapositive), we prove that √2 is irrational. Start by assuming the contrary, that is, that √2 = p/q for some positive integers p, q . Because a number can be represented as a fraction in infinitely many ways, assume that it is possible to cancel out common multiples of 2 from p and q until at least one of p and q is odd (it is not necessary to assume that this process results in p and q being unique). p2 = 2q2 so p2 is even. But if p is odd p2 is odd so p must be even. Thus p2 = 4k2 for some positive integer k. Thus q2 is even, so q is even, a contradiction. Therefore our starting proposition must be false.

Infinite descent is a specific form of reductio ad absurdum. It was used by Pierre de Fermat around 1640 to prove that there are no non-zero integer solutions to the equation x4 + y4 = z4 where z,y,z are positive integers, and has been widely used in other problems. It assumes the negative of the proposition, that is that there is a solution for some z, and shows that the existence of a solution for any value of z implies the existence of a solution for a smaller value of z, which is impossible because there is a least value of z (i.e. 1) beyond which no further solutions can exist.

Suppose that there is a (finite or infinite) sequence of propositions P1, P2, and so on. The Principle of Induction states that if P1 is true and if we can demonstrate that if Pk were true for any given k then Pk+1 would be true, then all of P1, P2, … are true.

It is sometimes more practical to use the following corollary. If P1 is true and if we can demonstrate that if for any given k, Pi were true for all 1 ≤ i ≤ k, then Pk+1 would be true, then all of P1, P2, … are true.

For let P’k be the proposition that Pi is true for all 1 ≤ i ≤ k. If P1 is true then P’1 = P1 is true. If the truth of P’k implies the truth of Pk+1 then it implies the truth of P’k+1. Therefore by induction all the P’ are true and so all the P are true.

Walter Ledermann – Encounters of a Mathematician

December 8, 2011

For about 20 years from the 1940s the Edinburgh publisher Oliver and Boyd published a series of very high standard pocket-sized texts in mathematics and mathematical physics entitled ‘University Mathematical Texts.’

Among my favourites, purchased as an undergraduate and still referred to forty years later, was ‘Finite Groups’ by Walter Ledermann.

For years Ledermann remained a name on a bookcover for me, until, through the magic of the internet, I chanced upon his reminisces, which begin here, full of warmth and humour.

Ledermann was a German Jew who was lucky enough to emigrate to Britain in the early 1930s, and to be able to follow his chosen career as a mathematician until he was well into his eighties.  The account of his PhD student from Afghanistan is particularly humorous and touching.

Zeta function for even positive integers

December 7, 2011

In 1735 Euler showed that

\displaystyle \zeta (2) = \sum_{n=1}^{\infty} \frac{1}{n^2}=\frac{\pi^2}{6}

and later that

\displaystyle \zeta(2k)=\sum_{n=1}^{\infty}\frac{1}{n^{2k}}=(-1)^{k+1}(2\pi)^{2k}\frac{B_{2k}}{2(2k)!}     when k > 0

By definition (see earlier post)

\displaystyle \frac{x}{e^{x}-1}+ \frac{x}{2}=1+\sum_{k=1}^{\infty}\frac{x^{2k}B_{2k}}{(2k)!}   at least when |x| < 2π

Also

\displaystyle \frac{x}{e^{x}-1}+\frac{x}{2}=\frac{x}{2}\frac{e^{x/2}+e^{-x/2}}{e^{x/2}-e^{-x/2}}=\frac{x}{2} coth \frac{x}{2}

Now (see pdf here for explanation)

\displaystyle y \coth y = 1 + 2y^{2} \sum_{j=1}^{\infty}\frac{1}{y^{2}+(j\pi)^{2}}

When |y| < π we can write

\displaystyle y \coth y = 1+2y^{2} \sum_{j=1}^{\infty}\frac{1}{(j\pi)^{2}}\sum_{k=0}^{\infty}\frac{(-1)^{k}y^{2k}}{(j\pi)^{2k}}

Because the series is absolutely convergent we can change the order of summation

\displaystyle y \coth y = 1+2 \sum_{k=1}^{\infty}\frac{(-1)^{k+1}\zeta(2k)y^{2k}}{\pi^{2k}}

The result follows on putting y = x/2 and equating the coefficients of powers of x.

Generating function for the Bernoulli Polynomials

November 22, 2011

A generating function is a power series whose coefficients are a sequence of interest.   The Bernoulli Polynomials have the generating function

\displaystyle \frac{te^{xt}}{e^{t}-1}=\sum ^{\infty}_{n=0}B_{n}(x) \frac{t^n}{n!}

at least when |t| < 2π

The derivation of this result is shown here.

A generating function often enables properties of the sequence to be easily exposed.  Here the generating function enables us to show simply that the odd Bernoulli numbers B2k+1 are zero (k > 0). This is necessarily the case if

\displaystyle \frac{t}{e^{t}-1}-B_{1}t=1+\sum ^{\infty}_{n=2}B_{n} \frac{t^n}{n!}

is an even function of t. This is so since

\displaystyle \frac{t}{e^{t}-1}+\frac{t}{2}=\frac{t(e^{t}+1)}{2(e^{t}-1)}=\frac{-t(e^{-t}+1)}{2(e^{-t}-1)}=\frac{-t}{e^{-t}-1}-\frac{t}{2}

Even and odd Bernoulli numbers

November 18, 2011

The first few Bernoulli numbers are B0 = 1, B1 = 1/2 and then 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0, 5/66, 0 -691/2730 and so on. This suggests that the odd-indexed Bernoulli numbers other than B1 are zero. In the pdf here we show that this is so and also derive the following efficient formula for calculating B2k

\displaystyle (2k+1)B_{2k}=-\sum_{j=1}^{[k/2]}\frac{2k-2j+1}{2j+1}\binom{k}{2j}B_{2k-2j} (k > 1)

where [k/2] is the largest integer less than or equal to k/2.

The method is taken from the chapter ‘Summation of Series’ of Barnard and Child (see Books page for a brief description of and link to this text).

Bernoulli numbers and sums of positive powers of integers

November 10, 2011

Let

\displaystyle s_{1}(n)=1+2+ ... +(n-1)+n

\displaystyle s_{2}(n)=1^2+2^2+ ... + (n-1)^2+n^2

and in general

\displaystyle s_{k} (n) = \sum_{j=1}^{n} j^k

We define the Bernoulli Numbers Bk as

\displaystyle B_{0}=1 ; \displaystyle (k+1)B_{k}=-\sum_{i=0}^{k-1} \binom {k+1}{i} B_{i}   (k > 0)

so B1 = -1/2 ; B2 = 1/6; B3 = 0 and so on. We define the Bernoulli Polynomials Bk(x) as

B_{k}(x)=\sum_{i=0}^k \binom {k}{i}B_{i}x^{k-i}

Then

\displaystyle s_{k}(n)= \frac{1}{k+1} \left[B_{k+1}(n+1)-B_{k+1}(0) \right]

The derivation of this result is shown in the pdf here.

Prime powers in integers, least common multiples, factorials and binomial coefficients

October 15, 2011

The following theorems are usually considered so elementary by professional mathematicians that they are stated without proof.  For hobbyists like me, to whom they may not be so transparent, proofs are provided in the attached pdf.  In what follows (1) indpn represents the index of the prime p in the prime composition of n – for example ind2 24 = 3, ind3 24 = 1, ind5 24 = 0  (2) [n] is the largest integer less than or equal to n and (3) Ln is the least positive integer divisible by each of 1, 2, … , n.

Theorem \: 1: \: ind_{p} \:n \le \ln n / \ln p

\displaystyle Theorem \: 2: \: ind_{p}\: L_{n} =\left[\frac{\ln n}{\ln p} \right]

\displaystyle Theorem \: 3: \: ind_{p} \: n!=\sum_{m \geq 1} \left[\frac{n}{p^m} \right]

\displaystyle Theorem \:4: \: ind_{p} \: \binom {n}{k} \leq \left[ \frac {\ln n}{\ln p} \right] - ind_{p} \: k


Follow

Get every new post delivered to your Inbox.