# The Shift Cipher

Cryptography is the study of cryptosystems, which are systems for encrypting data. Encrypting means taking data and changing it such that any unwanted person should not be able to read the data, but not changing it so much that the data is irretrievable. Specifically, the data should be able to be decrypted, which means changing the data back to its original, readable form. The data can be anything–passwords for your e-mail account or important personal information banks keep on their customers. The cryptosystems, that is the methods for encrypting, often strongly depends on the tools and theory of number theory.

In particular, when data is a message, the original message is often referred to as “plain text” while the encrypted text is referred to as the “cipher text”. There are many cryptosystems when working with messages. Among these are “classical cryptosystems”, which are systems no longer really used in modern times, but are still of interest, are instructive, and still have their uses.

One such classical system is the shift cipher. Before getting into that, there is some required knowledge of number theory, particular basic modular arithmetic. The following articles provide this:

After, the following article will give an introduction to the shift cipher:

### Exercise

See below for answers.

- Encrypt “exit” using the shift cipher , where the alphabet is number 0 through 25
- Decrypt “xvii” using the attack method of trying the reverse shift cipher for each integer in the range 0 through 25 until the original message comes out

Answers: (1) jcny, (2) tree.

# Multiple Asymptotes and Rational Functions

When sketching rational functions where and are polynomials) in MCV4U, there are many steps in the process when all is said and done. One of these steps is determining whether there are any asymptotes. There are a few different kinds:

- Vertical asymptotes (VA): The vertical line such that but
- Horizontal asymptotes (HA): The horizontal line such that either or
- Oblique asymptotes (OA): When the degree of is plus the degree of , the OA is the slanted line which is the quotient after dividing into via polynomial division

Once when I was teaching these concepts in a MCV4U class, the following very interesting question was asked: “Can a function have multiple asymptotes?” It turns out that the answer is pretty interesting and enlightening, and it is considered in this post.

For VAs the answer is a fairly straightforward “yes.” For example, simply add factors to the denominator and keep a constant numerator:

This function has VAs , , and . But, for HAs and OAs the answer is no longer so clear. Consider the following graph:

This function, as a fact, has two HAs: . Similarly, if one were to rotate the graph above while fixing the axis, a graph of a function would be created with two OAs.

With all this said, therefore it should be true that functions can have two HAs or OAs… right? In fact, despite this, it is not true for rational functions. That is, there are indeed functions that can satisfy this, but given any rational function in the world, there is not way it can have more than one HA or OA. Essentially, the reason for this is that the process in obtaining the asymptotes results in there only being one answer, so it is impossible for there to be anything more than that. Algebraically, the answer goes a bit beyond the curriculum, but not too far. These algebraic proofs is what follows.

## Rational functions have at most one HA

Let

where . Of course, we will assume that there actually is a HA. For this to occur, it must be that . This is because otherwise , so that when we do the usual process for finding HAs of

and take , we get everything in the denominator going to , contradicting there being a HA:

So, indeed, we must have that . Consequently, the process of finding a HA instead leads us to dividing by and obtaining

If , then the limit is (computed like above). Otherwise, so that the limit is . This means that the HA is either or , depending on and . However, the answer for the HA does not depend on whether the limit is or . Consequently, the HA is either one of these, but not both. This completes the proof

## Rational functions have at most one OA

Let . Since there can only be an OA if the degree of is more than that of , let the degree of be and that of be . Euclidean division of polynomials, a theorem of dividing polynomials, then says that for dividing by , there are unique polynomials (the quotient) and (the remainder) such that

where the degree of is less than the degree of , which is . (Unique here means that given and , the only quotient and remainder you can get by dividing by is and –nothing else.) By dividing the equation by we get the alternate expression

According to the procedure for finding an OA, the OA should therefore be . However, we need to know that is linear, i.e. it has degree . But, since has degree , has degree , and has degree less than , then according to the equation

it must be that has in fact degree . So, indeed is the OA. Moreover, it is the only answer because it is unique–that is, there cannot be any other OAs. This completes the proof.

# Cantor Set Construction through Ternary Expansions

Recall the Cantor (middle-third) set which is equal to

where and for is obtained by removing the middle-thirds of each of the disjoint closed intervals making up , i.e. each disjoint closed interval making up gets mapped to .

For example, to obtain , gets mapped to , and this latter set is . To obtain , gets mapped to , and gets mapped to , and is the union of these disjoint intervals.

The purpose of this post is to show that in fact

This set is the collection of all ternary expansions with coefficients and .

First, it is important to note that the elements of all coverge to real numbers. This is true because

the latter series being geometric.

Next, it will be shown that . Let . It is sufficient to construct a sequence corresponding to such that

By definition of , for all . First, . Second, . Since is the result of removing the middle-third of , therefore necessarily is in the left or right remaining third. If it was the left, define , and otherwise define . Now let . Since , therefore it is in one of the disjoint closed intervals making up . Since and has its left and right thirds mapped into , therefore necessarily is in the left third () or the right third ().

Inductively this defines a sequence corresponding to . Define the partial sums

To show (*) holds for our choice of , it is sufficient to show that , and are in one of the disjoint closed intervals making up with . This is sufficient because a property of is that the length of the , excluding , is (e.g. by an inductive argument), so as . This would imply

We proceed by induction. For , if , then by definition and . Otherwise in which case and . Hence the claim holds for .

Now suppose that and are both in one of the disjoint closed intervals making up and . Then is mapped to for . If is in the left interval, then , in which case . Otherwise is in the right interval in which case , so

This completes showing (*) so that indeed .

To show that as well, let . Then

and . The latter fact and an earlier argument show that the partial sums of are still a left endpoint of one of the disjoint closed intervals making up for all . Consequently . Since is (topologically) closed, it then follows that

is in . This completes the proof.

# Seki Takakazu and the theory of Resultants

Seki Takakazu was a Japanese mathematician during the Edo period, which ran from 1603 to 1868 and “was characterized by economic growth, arts and culture, and isolationism” [1, 2]. Takakazu actually was around the time of both Leibniz and Newton, but their work was independent [1].

Among many things in Takakazu’s mathematical career, he was known for work in Elimination theory: Algorithmic approaches to getting rid of variables between polynomials of several variables [1, 3]. In regards to the Ontario secondary mathematics curriculum, there are some relevant applications of Takakazu’s work to single variable polynomials.One particular instance is Takakazu’s work on what is known as resultants [1]. Recall (MHF4U, C3.1.1) that a polynomial of degree , a nonnegative integer, is an expression of the form

where for is a real number. In particular the above is a polynomial written as a function. For we have a linear function and for we have a quadratic function . Interestingly, the work of resultants requires two polynomials. So let’s introduce another polynomial of degree :

again for real numbers . In MHF4U a lot of work is done with polynomials of degree , including graphing and factoring in many different ways. As an extension to this, consider the following question:

“With two polynomials and , how do we know if they share a common factor?”

Recall (MHF4U, C3) that this question is asking if there is for some real number such that is a factor of and . There are a few ways to accomplish this using the tools from MHF4U:

- Completely factor both polynomials and see if any one factor appears in both
- Completely factor only one of the polynomials and use methods to see if these factors are also factors of the other (e.g. polynomial division, substitution)

However both of these methods require work that seems more complicated than what the question is asking. The area of resultants that Takakazu worked on in fact addresses this. Using a formula, the “resultant of and ” is a real number that can be calculated very fast by computers. Continuing, it turns out that the number is zero if and only if and have a common factor. That is, the answer to the question is:

“Yes, if and only if the resultant of and is .”

But how do we compute this? The command

resultant[, , ]

when given to WolframAlpha does exactly this. Let’s do an example. Suppose

and

Dealing with a degree polynomial makes it not so easy to answer the question about a common factor. But in telling WolframAlpha the command

resultant[x^3 – 4x^2 – 7x + 10, x^2 + 3x – 4, x]

the answer given back is . Recall that this means that there is indeed a common factor. This is a nice example of using technology in mathematics. Unfortunately, this method does not also tell us what the common factor actualy is, just that one exists.

If you are curious about what WolframAlpha is doing when it makes this computation, then read a little further on. Note though that even though it is related to the vectors content of MCV4U, it requires content typically first covered in a first-year undergraduate course on an area of math called linear algebra.

By definition, the resultant of arbitrary polynomials and is the determinant of their Sylvester matrix [4]. This matrix is a matrix (where and are the degrees of and resp.) where:

- The first row of the matrix is the coefficients of in decreasing order of subscripts, with entries on the right for any remaining entries
- The second row is the first row but shifted to the right by one entry, so the first entry is now a and there is one less entry on the right
- This rule continues for the following rows until there are no more zeros on the right
- The remaining rows are the same but done with instead

[5]. For an example, using the and from the earlier example, the Sylvester matrix is

The resultant of these particular and is then the determinant of this matrix. This can also be computed using WolframAlpha with the command

determinant {{1,-4,-7,10,0},{0,1,-4,-7,10},{1,3,-4,0,0},{0,1,3,-4,0},{0,0,1,3,-4}}

The Sylvester matrix is named after James Joseph Sylvester, an English mathematician in the 1800s [6].

## References

[1] https://en.wikipedia.org/wiki/Seki_Takakazu

[2] https://en.wikipedia.org/wiki/Edo_period

[3] https://en.wikipedia.org/wiki/Elimination_theory

[4] https://en.wikipedia.org/wiki/Resultant

[5] https://en.wikipedia.org/wiki/Sylvester_matrix

[6] https://en.wikipedia.org/wiki/James_Joseph_Sylvester

# Applications of Lebesgue integration to elementary analysis problems

In elementary analysis one might have come across the problem of showing

for . It turns out (Real and Complex Analysis, Rudin) that there is a more advanced proof using Lebesgue integration with respect to a counting measure!

Specifically, we can consider the counting measure where is the power set of , so that is the cardinality of if is finite, and otherwise it is (e.g. while ). Indeed the domain is so that in fact *all* functions are measurable.

It turns out that integration of such a function with respect to the counting measure is

That is, integrals with respect to the counting measure are just sums (if you are interested, see this document for a proof of this). A consequence (Real and Complex Analysis, Rudin) of Lebesgue’s Monotone Convergence Theorem is: *If* (*are measurable) and*

*then*

From what was noted earlier the integrals can be replaced with sums:

Consequently simply choosing , which is measurable because as noted earlier all functions are measurable with respect to the counting measure, does the trick! This completes the proof.

# Continuous derivative of the Fourier transform of a function

# Complex Fourier series calculations

Consider a function . Recall is periodic (with period ) iff , . For example, is periodic:

recalling that for . Assume is periodic and continuous. Define, for ,

The are called the Fourier coefficients of , while the Fourier series is

Let’s try an example. Take . Of course, this isn’t periodic. However implicity it is meant that , and is the periodic extension of this mapping, i.e. , , etc. For ,

Evaluating these (real) integrals individually, it is found that

Also . Hence the Fourier series of is

implicitly having the -th term to be , not . However, immediately this a bit difficult to deal with, say if pointwise convergence were in question!

To deal with this, we derive an equivalent representation of the Fourier series. Notice that in general,

Continuing, for , . Similarly,

The same work shows

It is then immediate that . Hence

recalling that , . Consequently the equivalent expression

for the partials sums is obtained, thereby obtaining the equivalent expression

for the Fourier series of . This is much easier to work with for calculations. For example the recently calculated Fourier series can now be written as

Since and are decreasing, for pointwise convergence it is sufficient to show that

are bounded. But this is true, and a common proof is due to Dirichlet (e.g. as explained in this post–easier to show is bounded and substitute ). But more than pointwise convergence is true: Uniform convergence of the Fourier series of is guaranteed, and in fact to . This by a theorem since is continuous, periodic, and piecewise continuously differentiable.