Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Jupyter notebook Project 2 Report.ipynb

25 views
Kernel: SageMath 6.10

Project 2: Cyclic Difference Sets

Introduction

The goal of this project is to explore cyclic difference sets using modular arithmetic. For an integer mm, a cyclic difference set modulo mm is a subset of the set of integers modulo mm such that the differences between every element of the cyclic difference set generates every element of the integers modulo mm the same number of times. Specifically, this project explores numerically a method of generating cyclic difference sets by using the squares of integer sets. Various conjectures are made and proven with respect to this method.

Theory

Modulo

We define two numbers aa and bb to be congruent modulo mm as aba \equiv b (mod mm). Consequentially, aba - b is divisible by mm. For a positive integer mm, we define Z/mZ\mathbb{Z}/m\mathbb{Z} as the set of integers modulo mm. Z/mZ\mathbb{Z}/m\mathbb{Z} contains all nonnegative proper remainders upon division by mm. In other words, Z/mZ={0,1,2,,m1}\mathbb{Z}/m\mathbb{Z} = \{0, 1, 2, \dots, m-1\}. It is important to note that Z/mZ\mathbb{Z}/m\mathbb{Z} is closed under addition and multiplication, meaning that any arithmetic operations on the elements of Z/mZ\mathbb{Z}/m\mathbb{Z} result in an integer in the set Z/mZZ/mZ.

Example: mm = 7

We demonstrate some calculations modulo 77 here in order to set the stage for more complicated calculations in later sections.

For m=7m=7, Z/7Z={0,1,2,3,4,5,6}Z/7Z = \{0, 1, 2, 3, 4, 5, 6\}. Since 8/7=18 / 7 = 1 remainder 11, 818 \equiv 1 (mod 77). 6+6=1256 + 6 = 12 \equiv 5 (mod 77).

Inverses

Although we state that Z/mZ\mathbb{Z}/m\mathbb{Z} is closed under addition and multiplication, we have not shown until this section specifically how Z/mZ\mathbb{Z}/m\mathbb{Z} is closed under subtraction. The additive inverse of an integer xx in Z/mZ\mathbb{Z}/m\mathbb{Z}, denoted by x-x, is the integer such that xx=0x - x = 0. For example, for m=7m = 7, the additive inverse of 33 is 44 since 3+4=703 + 4 = 7 \equiv 0 (mod 77). Below we will raise some conjectures and provide reasoning for their proofs.

Conjecture 1: If xx is in Z/mZ\mathbb{Z}/m\mathbb{Z} and y=xy = -x, then x2y2x^2 \equiv y^2 (mod) mm.

Since y=xy = -x, y2=(x)2=x2y^2 = (-x)^2 = x^2. Thus, it is true that y2x2y^2 \equiv x^2 (mod) mm.

Conjecture 2: If mm is even and xm2x \not = \frac{m}{2}, then xx is its additive inverse modulo mm.

When mm is even, the number of elements in Z/mZ\mathbb{Z}/m\mathbb{Z} is odd, so when x=m2x = \frac{m}{2}, x is its additive inverse modulo mm.

Conjecture 3: The maximum number of distinct nonzero squares modulo mm when mm is odd is m12\frac{m-1}{2}. The maximum number of distinct nonzero squares modulo mm when mm is even is m2\frac{m}{2}.

Conjecture 3 follows from Conjectures 1 and 2. There are m1m-1 distinct nonzero elements in Z/mZ\mathbb{Z}/m\mathbb{Z}. When the elements of Z/mZ\mathbb{Z}/m\mathbb{Z} are squared, it is true from Conjecture 1 that the squares of integers in Z/mZ\mathbb{Z}/m\mathbb{Z} and their additive inverses are equal. This repitition of squares results in m12\frac{m-1}{2} distinct squares.

Squares¶

To create our cyclic set, we need to approach this in steps. Our first step is to create, as this section implies, a set of squares. Given a modulus mm, our set will consist the square of every element modulo mm between 1 and m1m - 1. We can calculate this by hand rather quickly when dealing with a small modulus like m=7m = 7, but when dealing with numbers like m=101m = 101, we need a program. We will show m=7m = 7 as an example in our program.

#Squares m = 7 sqdct = dict() for i in range(1, m): value = (i * i) % m sqdct[i] = value for i in range(1, m): print i, sqdct[i]

This program creates an array and stores the square of each natural number as an element, labeled with that natural number's index.

Let's look at this set of squares. 121(mod7)1^2 \equiv 1(\bmod 7), 224(mod7)2^2 \equiv 4 (\bmod 7), 322(mod7)3^2 \equiv 2(\bmod 7), 422(mod7)4^2 \equiv 2(\bmod 7), 524(mod7)5^2 \equiv 4(\bmod 7), and 621(mod7)6^2 \equiv 1(\bmod 7). We have 3 distinct answers: 1, 2, and 4. Similarly, if we run this program with these select modulo, we get the following results:

Modulo71115192327
Occurrence of all squares (k)35791113

From here, we start to note a definite pattern summed up in this formula: For our distinct number of elements k in our cyclic set D, k=m12k = \frac{m - 1}{2}. However, just like m, k must also be a natural number, as we cannot have a decimal answer for an exact number of elements. Let's factor the formula.

k=m12k = \frac{m - 1}{2}

2k=m12k = m - 1

m=2k+1m = 2k + 1

By definition of odd terms, m is an odd number. Therefore, m must be odd in context of this problem.

Now we'll prove something interesting. Let's assume, for some integer aZa \in \mathbb{Z}, that our modular m=a2m = a^2. If we know that m is odd, then therefore a must also be odd. But we also know that for this case, k<m12k < \frac{m - 1}{2}. This is distinctly different that what we stated just above. We will explore this further in our proof section.

Differences

Now let us get into the meat of a cyclic difference set: the differences. From here, let us clarify the conditions that makes our differences cyclic. Firstly, if we have a set of modulo m, then the differences of the distinct nonzero squares must include every natural number from 1 to m - 1. Otherwise, our set is not cyclic. Secondly, these differences must appear the exact same number of times. We will call this number of occurences lamda. Similarly to differences, calculating this by hand is not difficult, but simply tedious. We will instead look at code highlighting this. We will once again use m = 7.

m = 7 print 'm: ', m listall = list() sq = list() sqlst = list() difflst = list() # initialize the lists with m elements for i in range(1, m + 1): listall.append(0) sq.append(0) sqlst.append(0) difflst.append(0) # count the number of times a square mod m appears # sqlst contains the counts for i in range(1, m): value = (i * i) % m sqlst[value] = sqlst[value] + 1 # sq contains the squares mod m in order numSQ = 0 for v in range(1, m): if sqlst[v] > 0: print 'member of D: ', v numSQ = numSQ + 1 sq[numSQ] = v sqlst[v] = 0 # numSQ is the number of squares mod m print 'k: ', numSQ # difflst is the differences of all of the squares for i in range(1, numSQ + 1): for j in range(1, numSQ + 1): value = (sq[i] - sq[j]) % m difflst[value] = difflst[value] + 1 # numdiff is the number of times a difference is repeated numdiff = 0 for v in range(1, m): if difflst[v] > 0: numdiff = numdiff + 1 print 'v: ', v, 'lambda: ', difflst[v] print 'numdiff: ', numdiff

Recall from Squares that we have 3 distinct squares: 1, 2, and 4. In modulo 7, they form every difference between 1 and (7 - 1). But also, for our lambda (λ\lambda), we have a value of 1 for every distinct difference. We have the same value of λ\lambda for every equation. Thus, when m = 7, we have a cyclic differences set. Let's look at a table of more modulos that work.

Modulo (m)711192331
Occurrence of all distinct differences (λ\lambda)12457

From here, we start to notice a distinct pattern. λ=m34\lambda = \frac{m - 3}{4}. This formula works for all legitimate value of m. We will prove this formula in a later section, as well as what defines a legitimate value of m. Before that, let's factor m=2k+1m = 2k + 1 into the equation.

λ=2k+134\lambda = \frac{2k + 1 - 3}{4}

λ=2k24\lambda = \frac{2k - 2}{4}

λ=k12\lambda = \frac{k - 1}{2}.

As we can see her, our formula for λ\lambda in terms of k matches our formula for k in terms of m. This entails that we can rewrite our equation as such:

k=2λ+1k = 2 \lambda + 1.

Our number of distinct squares k is therefore also absolutely an odd number when our modular m is an odd number.

Proof

Formula for kk

To find a formula for k k in terms of m m , we first found different m m values that produce cyclic difference sets and checked what the k k value for each one was. Through this method, we conjure that k=m12 k = \dfrac{m-1}{2} for all m m that produce a cyclic difference set. In order to prove our conjecture, we have to logically explain it. k k is defined as the number of elements in D D . Since D D only contains nonzero elements, the total possible elements in D D is m1 m-1 . However, the squares of additive inverses are congruent modulo m m and D D does not contain any repeats of its elements. So, by Conjecture 3 in Inverses, the number of elements in D D when D D is a cyclic difference set is m12 \dfrac{m-1}{2} . Thus, k=m12 k = \dfrac{m-1}{2} .

Formula for λ\lambda

To find a formula for λ \lambda in terms of m m , we used the same method we did for k k . Through this method, we conjecture that λ=m34 \lambda = \dfrac{m-3}{4} for all m m that produce a cyclic difference set. We will prove this conjecture by logically explaining it. λ \lambda is defined as the number of pairs of elements of D D giving each nonzero difference modulo m m . We know that there are k k elements in D D by the definition of k k , we use these elements to set up a chart. The top and leftmost lines are the elements of D D in the same order. The rest of the chart is the differences of every element of D D found by taking the top number and subtracting the leftmost number, modulo m m . If the difference is a negative number, then it is replaced with its additive inverse modulo m m . These differences should represent all of the nonzero elements of Z/mZ \mathbb{Z} / m\mathbb{Z} an equal number of times. For example, we will do the chart for m=7 m=7 .

-\+124
1013
2602
4450

We will use the chart to prove our conjecture that λ=m34 \lambda = \dfrac{m-3}{4} . There are k2 k^2 differences in the chart, but we only want the nonzero elements. The zeros will only appear on the diagonal from top-left to bottom-right, which includes k k zeros, so we're only looking at k2k k^2 - k differences. This gives us the amount of nonzero differences in the chart, but we want the number of times each one shows up. Since there are m1 m-1 nonzero elements of Z/mZ \mathbb{Z} / m\mathbb{Z} , we now have λ=k2km1 \lambda = \dfrac{k^2 - k}{m-1} . Since we want λ \lambda in terms of m m , we will substitute k=m12 k = \dfrac{m-1}{2} . The new equation is λ=(m1)222m12m1=m1412=m34 \lambda = \dfrac{\dfrac{(m-1)^2}{2^2} - \dfrac{m-1}{2}}{m-1} = \dfrac{m-1}{4} - \dfrac{1}{2} = \dfrac{m-3}{4} . Thus, λ=m34 \lambda = \dfrac{m-3}{4} .

Conclusion

Finding a General Form for mm

We're trying to prove the claim that if D D is a cyclic difference set, then m m has a particular form. We will start by letting D D be a cyclic difference set. Since D D is a cyclic difference set, we know k=m12 k = \dfrac{m-1}{2} and λ=m34 \lambda = \dfrac{m-3}{4} . If we solve both of these equations for m m , we have m=2k+1 m = 2k + 1 and m=4λ+3 m = 4\lambda + 3 . To find just one equation for m m , we will sum both equations. This leads us to 2m=2k+4λ+4 2m = 2k + 4\lambda + 4 , which can be simplified to m=k+2(λ+1) m = k + 2(\lambda + 1) . Therefore, if D D is a cyclic difference set, then m=k+2(λ+1) m = k + 2(\lambda + 1) .