# The tutor tackles an age-old proof in a new (to him, anyway) manner.

A famous theorem of number theory goes like this:

For the integers a and b, there exists a solution with integers x and y to

ax+by=1

if and only if a and b are relatively prime.

Another way to state the same theorem:

ax+by=1 has integer solutions x, y iff gcd(a,b)=1 (a,b,x,y all integers).

gcd(a,b) means the greatest common divisor of a and b; if it’s 1, a and b must be relatively prime (and vice versa). iff means “if and only if.”

Looking at the forward implication first, we have

ax+by=1→gcd(a,b)=1

Proof: Suppose not; that is, suppose that ax + by=1 but gcd(a,b)=k≠1.

Then a=km, b=kn for integers n, m:

kmx+kny=1→k(mx+ny)=1→k is a factor of 1→k=1.

Now, let’s look the other way:

gcd(a,b)=1→ax+by=1 for some integers x,y.

Proof: Suppose not; that is, suppose gcd(a,b)=1, but ax+by≥d for some integer d>1

Then there can’t be a solution for aw+dz=d+1, for, if so, then

aw+dz-(ax+by)=1, and we have a linear combination of a and b summing to 1. It follows that any linear combination of a and b is a multiple of d:

ap+bq=md

Therefore, let p=1, q=d:

a+bd=fd

Then

a=fd-bd=d(f-b)→d is a factor of a.

Next, consider

Then

b=hd-ad=d(h-a)→d is a factor of b.

By our original assumption, d≥1. Also from our original assumption, gcd(a,b)=1. However, d is a factor of both a and b. The contradiction proves that when gcd(a,b)=1, there is an integer solution to ax+by=1.

I’ll be talking more about number theory:)

Source:

Dudley, Underwood. Elementary Number Theory. New York:
W H Freeman and Company, 1978.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor shows that yesterday’s formulas to generate Pythagorean triples are valid.

In yesterday’s post I showed a way to generate Pythagorean triples x, y, z from an odd number n:

 x n y (n²-1)/2 z (n²+1)/2

Let’s make sure that, generated as above, x²+y²=z²

n^2 +((n^2 -1)/2)^2 = n^2 + (n^4-2n^2+1)/4

which leads to, after getting a common denominator,

4n^2/4 + (n^4-2n^2+1)/4 = (n^4+2n^2+1)/4

Note also that

((n^2+1)/2)^2 = (n^4+2n^2+1)/4

Therefore

n^2 +((n^2 -1)/2)^2 = ((n^2+1)/2)^2

so the generating formula for pythagorean triples is proven.

Source:

Dudley, Underwood. Elementary Number Theory. New York:
W H Freeman and Company, 1978.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor continues his discussion about Pythagorean triples.

Back in my January 7, 2016 post I brought up Pythagorean triples, which are all-integer solutions to

x² + y² = z²

The equation above is based on the familiar

a² + b² = c²

An interesting fact is that Pythagorean triples can be generated from the following formulas, with n odd:

 x n y (n²-1)/2 z (n²+1)/2

Take, for instance, n as 3. Then we have

x=3

y=(3²-1)/2=(9-1)/2=8/2=4 3(2)/2 + 2/2=4

z=(3²+1)/2=(9+1)/2=10/2=5

which is the familiar 3,4,5 triple.

With n=11, we have

x=11

y=(11²-1)/2=(120)/2=60

z=(11²+1)/2=(122)/2=61

11²+60²=61²

Squaring, we get

121+3600=3721✓

I’ll be giving more coverage to Pythagorean triples in coming posts:)

Source:

Dudley, Underwood. Elementary Number Theory. New York:
W H Freeman and Company, 1978.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor discusses the existence of an Euler circuit in a graph.

An Euler circuit is a route through a graph that travels every edge exactly once, then ends where it started. If a graph is connected, with every vertex of even degree, then it has an Euler circuit. Following is a proof by induction:

First of all, consider the graph below. Each vertex has degree two; clearly A → B → C → D → A is an Euler circuit.

Adding vertex E, we might end up with the graph

To connect to point E, vertices B and D now have odd degree (3). Therefore, they need to be increased to degree 4. The simplest way is to join them by segment BD, seen in the next graph.

Now, the original Euler circuit A → B → C → D → A can be interrupted in the middle as follows: A → B → E → D → B → C → D → A. The result is an Euler circuit on the graph with an added vertex.

On a graph of n vertices, each with degree 2, an Euler circuit is apparent. When a vertex is added outside that circuit, adding other edges as well to bring the vertices back to even, the graph can be eventually reduced to one or more situations like the one(s) above.

I’ll be discussing more graph theory ideas:)

Source:

Grimaldi, Ralph P. Discrete and Combinatorial Mathematics. Don Mills:

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor brings up a useful command for Windows.

The 2015-2016 academic year over, I’m looking into the Windows 10 upgrade. Today I began gathering information: For example, when was Windows 7 installed on this computer?

Searching the internet, a method was suggested: the user can open the Command Prompt (some might call it the terminal) from Start→All Programs→Accessories. Then, the command

systeminfo

will yield, among many other infos, a line Original Install Date. It reveals, for this computer, Dec 6, 2012, 11:30am.

I’ll be talking more about computer statistics and the Windows 10 upgrade in coming posts:)

Source:

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor looks into a simple layout technique.

In web design, vertical centering is often desirable. Here’s a quick example:

Hello! This text is vertically centered. See the code below.

<div style=”height:11em;
display:table-cell;vertical-align:middle;
background-color:LightGreen;color:white;
font-size:150%”><div>

I’ll mention other web design techniques in future posts:)

Source:

w3.org

w3schools

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor shows a way to add a style sheet to a WordPress site.

There are several ways to add a style sheet to WordPress. Herein, I’ll show how I’ve done so.

Let’s imagine the div below is meant to be styled from an external style sheet:

This div should have pink hair!

Assuming the div above is class=”hair”, the following style sheet could be added as /blog/styles/hairstyle.css

.hair{
display:block;
margin:auto;
font-size:200%;
color:white;
background-color:pink;
text-align:center;
width:50%;
}

Next, the following code, added inside the WordPress Theme Functions file, includes the style sheet as the page is rendered:

function hairstyle(){
wp_register_style(‘hairstyle’,’/styles/hairstyle.css’);
wp_enqueue_style(‘hairstyle’);
}

This method takes concentration to apply. I normally use inline styles, but sometimes an external style sheet makes more sense.

I’ll be talking more about WordPress in future posts:)

Source:

developer.wordpress.org

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor offers a way to view your history when it’s not showing.

I love Firefox; it’s the browser I use with my Linux (Ubuntu) computers.

Yesterday I clicked, at the top, History. A drop-down menu appeared, showing websites I had recently visited. “But are those all of them?” I wondered. From the drop-down, I chose the Show All History option. A window opened titled Library, but the page list was blank.

I repeated the exercise several times: after all, I thought, the Show All History option should show at least as much as the History drop-down. I even went online to research the situation: apparently, I wasn’t the only one facing it.

Eventually, I tried the search box in the Library window. By putting characters into it, I could cause pages to appear in the list. I decided the forward slash / to be best, since every page I’d been to had that in its address.

So, with Firefox, if pages aren’t showing up in the Show All History view, perhaps a solution is to type the forward slash into the search box there. I think, then, you’ll see the pages you’ve been to:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor shares a solution to a problem from Grimaldi’s Discrete and Combinatorial Mathematics.

Last night I encountered the problem (p. 481) that paraphrases as follows:

Imagine a car takes two spaces, a motorbike one. Find a recursive function that determines the number of ways to fill n parking slots with motorbikes and cars (assuming no empty slots).

I played around with the problem for a while, then tried this approach:

 Number of slots Ways to fill them 0 1 (no parking at all) 1 1 (one motorbike) 2 2 (2 mbs or 1 car) 3 3 (3 mbs or 1 car, 1 mb (two ways)) 4 5 (4 mbs or 1 car, 2mbs (three ways) or 2 cars)

The right column in the table above is the Fibonacci (F) sequence: an+2=an+1+an. However, it’s advanced by 1: Typically, F(0)=0, while for this case, F(0)=1. Fibonacci takes the previous number in the sequence, then adds it to the one before that, to give the current one.

In a coming post I’ll discuss the general solution to the sequence above:)

Source:

Grimaldi, Ralph P. Discrete and Combinatorial Mathematics. Don Mills: Addison-Wesley, 1994.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

# The tutor shows another jQuery function: css()

This text and background will both change color.

The jQuery code that changes the text from ordinary to white on red:

\$(“#p_jun_20_2016”).css({“color”:”rgb(255,255,255)”,”background-color”:”rgb(150,10,10)”});

I’ll be giving more coverage on jQuery in future posts:)

Source:

w3schools

Pollock, John. jQuery: A Beginner’s Guide. New York: McGraw-Hill, 1994.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.