Generating Approximate Pythagorean Angles (IV) – Derivation and Proof of The Method

In the previous post is a table of values.

Suppose you wish to find the simplest primitive Pythagorean triangle (a,b,c) where one of the angles is θ° to within some (small) error bound Δθ°.

Here’s the derivation of the method which was given in an earlier post.

(Throughout, I use τ = 2π.)

It is well known that all primitive Pythagorean triads (a,b,c) may be generated by pairs (u,v) where:

u, v ∈ ℕ₀ — i.e. u and v are non-negative integers,
u < v,
u ⊥ v — i.e. u and v are coprime, i.e. have no common factors, and
u + v ≡ 1 (mod 2) — i.e. u and v have different parity, i.e. one is even, and the other odd

and then

a = v² − u²,
b = 2uv, and
c = u² + v²

In this case:

a is odd
b is even
c is odd

[ref.: Euclid’s Formula for Generating Pythagorean Triples and Primitive Pythagorean Triples on Wikipedia.]

That is essentially step (5).

It is additionally required to show that if

u, v ∈ ℕ₀,
u < v,
u ⊥ v, and
u, v ≡ 1 (mod 2) — i.e. u and v are both odd

and then

a = (v² − u²) / 2,
b = uv, and
c = (u² + v²) / 2

then a, b and c are natural numbers, and (a,b,c) is again primitive.

In this case:

a is even,
b is odd, and
c is odd

Proof of the parities:

u, v ≡ 1 (mod 2)

so

uv ≡ 1 (mod 2)
u, v ≡ 1 or 3 (mod 4)

so

u², v² ≡ 1 (mod 4)

so

v² − u² ≡ 0 (mod 4)
v² + u² ≡ 2 (mod 4)

so

(v² − u²) / 2 ≡ 0 (mod 2),
(v² + u²) / 2 ≡ 1 (mod 2)

QED ■

Proof of the primitiveness:

We already have that

2 | a but
2 ∤ b, c

Now consider a prime p > 2

Suppose

p | a, c

then

p | (v² − u²)/2, (v² + u²)/2
p | u², v²

but p is prime, so

p | u, v

which is a contradiction.

Now suppose

p | b

then

p | u, v

but p is prime so

either p | u or p | v
but not both since u ⊥ v,

so

p | u  xor  p | v (where xor means “or, but not both”)

so

p | u²  xor  p | v²

so

p ∤ v² − u²  and  p ∤ v² + u²

so

p ∤ 2a  and  p ∤ 2c

so

p ∤ a  and  p ∤ c

QED ■

The cosine of the angle opposite arm b is:

cos θ = a / c

Notice that for 0° ≤ θ° ≤ 90°, we have 0 ≤ cos θ° ≤ 1,

Notice also that 0 ≤ u/v ≤ 1.

Since

\dfrac{a}{c} = \dfrac{v^2 - u^2}{v^2 + u^2} = \dfrac{v^2/v^2 - u^2/v^2}{v^2/v^2 + u^2/v^2} = \dfrac{1 - (u/v)^2}{1 + (u/v)^2}

then the cosine, x = cos θ, is a simple function of the ratio y = u/v:

x = g(y) = \dfrac{1 - y^2}{1 + y^2}

and so, inverting the function, the ratio is a function of the cosine:

y = h(x) = g^{-1}(x) = \sqrt{\dfrac{1 - x}{1 + x}}

The functions g and h are both considered as functions on the range [0,1], i.e. functions from [0,1] to [0,1].
They are monotonic (decreasing) over that range, which allows the inverses to be meaningful.

The function h is used in step (3) of the method.

(3) Calculate the Farey ratio approximant …

R = \sqrt{\dfrac{1-C}{1+C}}

When considering an error (magnitude) in x, we make use of the approximation

Δy ≈ |df(x)/dx| · Δx

This is required for steps (2) and (3):

C = cos θ

so

ΔC = | d cos θ / dθ | · Δθ = | −sin θ | · Δθ = sin θ · Δθ
(for 0° ≤ θ° ≤ 90°)

Similarly:

R = h(C) = \sqrt{\dfrac{1-C}{1+C}}

so

\Delta R = \left| \dfrac{{\rm d} h(C)}{{\rm d}C} \right| \cdot \Delta C = \dfrac{\Delta C}{(1+C^2) \sqrt{\dfrac{1-C}{1+C}}}

Thus all that’s left to do is to find a fraction u/v such that

| R − u/v | ≤ ΔR

That’s step (4), which makes use of Farey sequences and mediants.

If:

\dfrac{u_0}{v_0} < \dfrac{u_2}{v_2}
u₀ ⊥ v₀
u₂ ⊥ v₂
u₂·v₀ − u₀·v₂ = 1

And:

u₁ = u₀ + u₂
v₁ = v₀ + v₂

Then:

\dfrac{u_0}{v_0} < \dfrac{u_0 + u_2}{v_0 + v_2} < \dfrac{u_2}{v_2}

i.e.

\dfrac{u_0}{v_0} < \dfrac{u_1}{v_1} < \dfrac{u_2}{v_2}

u₁ ⊥ v₁
u₁·v₀ − u₀·v₁ = 1
u₂·v₁ − u₁·v₂ = 1

[ref.: Farey Neighbours on Wikipedia.]
[ref.: Properties of the Mediant on Wikipedia.]

In the previous post is a table of values.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: