Pythagorean Triples

I recently began writing some lectures for an online course — I’ll talk more about the nature of the course in next week’s post.  The broad topic is geometry, of course a favorite — and the specific topic for this unit is Triangles.

You can’t talk about triangles without talking about the Pythagorean Theorem.  Part of my job is also to compose problems for the lectures as well as for quizzes and exams, and to my surprise, I came up with a few interesting ones.  So I thought I’d share them with you.  I am always a fan of sharing mathematics as it happens!

The questions I wrote are based on the following parameterization of Pythagorean Triples:  Given positive integers p and q, then


is a Pythagorean Triple.  This parameterization generates all primitive Pythagorean Triples — that is, triples whose sides share no common factor.  But it is not possible to get (9,12,15), for example, using this parameterization.  Of course (9,12,15) is just three times the triple (3,4,5); therefore, if you can generate all primitive Pythagorean Triples, you can take multiples of them to generate all Pythagorean Triples.

I thought of my first problem walking down the sidewalk going to lunch the other day.  The simplest Pythagorean Triple, (3,4,5), has side lengths which are in arithmetic progression.  What other Pythagorean Triples have this property?

The simplest way to approach this is to parameterize such a triple by (a,a+d,a+2d), where a>0 is the smallest integer in the arithmetic progression and d>0 is the common difference.  Since the triangle is a right triangle, we must have


which we may rewrite as


Now this factors:


resulting in solutions a=-d or a=3d.  We did assume that d>0, so we eliminate the solution a=-d.  Note that this would generate the triple (a,0,-a), and in fact a^2+0^2=(-a)^2. But one side length is zero and another is negative, so no triangle is possible with these side lengths.

What about the solution a=3d?  Here, we get


which you can observe is just a multiple d of the primitive Pythagorean Triple (3,4,5).

The conclusion?  The only Pythagorean Triples possible whose side lengths are in arithmetic progression are multiples of the (3,4,5) right triangle.

I really didn’t know the answer would come out so nicely — but since the algebra involved was fairly straightforward, I thought I could include this as a non-routine example of an application of the Pythagorean Theorem at the high school level.

The previous problem was part of a lecture.  The next problem was written as a possible exam question for teachers; once I realized I had more than one interesting problem, I thought there would be enough for a blog post….

I was just looking for interesting patterns in Pythagorean Triples, and noticed that with the (6,8,10) triangle, the area and perimeter were both 24.  A coincidence?  Were there other triangles with this property?

Of course there had to be finitely many — as the side lengths get larger, the area gets larger faster than the perimeter, as the area is essentially a quadratic function, while the perimeter is essentially a linear function.  So how many others are there?  Make a mental note of your guess before reading further….

We begin by parameterizing by


the factor of k is necessary since the two-variable version generates all primitive Pythagorean Triples, but not necessarily all Pythagorean Triples.

Setting the perimeter and area equal to each other results in


Cancelling out factors of k, q, and p+q results in


This equation clearly has just three solutions, since one of the factors must be 2 and the other two factors must be 1.

None is particular difficult; let’s take them one at a time.  When k=2, then p=q-p=1, so that q=2.  Substituting back into the parameterization, we obtain the Pythagorean Triple 2(3,4,5), which is the triple (6,8,10).

When p=2, then  k=q-p=1, so that q=3. This generates a new Pythagorean Triple, (5,12,13).

Finally, when q-p=2, then k=p=1 and q=3, so that the Pythagorean Triple (8,6,10) is generated.  Of course this is just a duplicate of the first solution.

Surprised that there was just one more solution?  I was!  It was such a nice, straightforward solution, that I couldn’t help but include it.

There was a third problem which I liked, but the algebra was a little too intense — there was a nice geometrical solution, but it required ideas learned later on in the course.  So here it is if you want a challenge:  suppose you are given two right triangles, and you know that their perimeters and areas are the same.  Prove that they are congruent.

I think you might enjoy solving this purely algebraically.  I did like it so much, though, that I included a simpler version in one of my lectures:  suppose you are given two right triangles, and you know that their hypotenuses are both of length 8 and that their perimeters are equal.  Prove that the triangles are congruent.

To be honest, I never knew I’d find problem solving with the Pythagorean Theorem so interesting.  It’s nice to know that there is always more geometry to learn!  Even with something as apparently simple as the venerable Pythagorean Theorem….

Calculus: Hyperbolic Trigonometry, IV

Of course, there is always more to say about hyperbolic trigonometry….  Next, we’ll look at what is usually called the logistic curve, which is the solution to the differential equation

\dfrac{dP}{dt}=kP(C-P),\quad P(0)\ \text{given}.

The logistic curve comes up in the usual chapter on differential equations, and is an example of population growth.  Without going into too many details (since the emphasis is on hyperbolic trigonometry), k is a constant which influences how fast the population grows, and C is called the carrying capacity of the environment.

Note that when P is very small, C-P\approx C, and so the population growth is almost exponential.  But when P(t) gets very close to C, then dP/dT\approx0, and so population growth slows down.  And of course when P(t)=C, growth stops — hence calling C the carrying capacity of the environment.  It represents the largest population the environment can sustain.

Here is an example of such a curve where C=500, k=0.02, and P(0)=50.


Notice the S shape, obtained from a curve rapidly growing when the population is small. It happens that the population grows fastest at half the carrying capacity, and then growth slows to zero as the carrying capacity is reached.

Skipping the details (simple separation of variables), the solution to this differential equation is given by

P(t)=\dfrac{C}{1+Ae^{-kCt}},\qquad A=\dfrac{C-P(0)}{P(0)}.

I will digress for a moment, however, to mention partial fractions (as I step on my calculus soapbox).  I have mentioned elsewhere that incomprehensible chapter in calculus textbooks:  Techniques of Integration.  Pedagogically a disaster for so many reasons.

The first time I address partial fractions is when summing telescoping series, such as


It really is necessary.  But I only go so far as to be able to sum such series.  (Note:  I do series as the middle third of Calculus II, rather than the end.  A colleague suggested that students are more tired near the end of the course, which is better for a more technique-oriented discussion of the solution to differential equations, which typically comes before series.)

You also need partial fractions to solve the differential equation for the logistic curve, which is when I revisit the topic.  After finding the logistic curve, we talk about partial fractions in more detail.  The point is that students see some motivation for the method of partial fractions — which they decidedly don’t in a chapter on techniques of integration.

OK, time to step off the soapbox and talk about hyperbolic trigonometry….  The punch line is that the logistic curve is actually a scaled and shifted hyperbolic tangent curve!  Of course it looks like a hyperbolic tangent, but let’s take a moment to see why.

We first use the definitions of \sinh u and \cosh u to write

\tanh u=\dfrac{\sinh h}{\cosh u}=1-\dfrac2{1+e^{2u}}.

This results in

\dfrac2{1+e^{2u}}=1-\tanh u.

You can see the form of the equation of the logistic curve starting to take shape.  Since the hyperbolic tangent has horizontal tangents at y=-1 and y=1, we need to scale by a factor of C/2 so that the asymptotes of the logistic curve are C units apart:

\dfrac C{1+e^{2u}}=\dfrac{C}2\left(1-\tanh u\right).

Note that this puts the horizontal asymptotes of the function at y=0 and y=C.

To take into account the initial population, we need a horizontal shift, since otherwise the initial population would be C/2. We can accomplish this be replacing \tanh u with \tanh(u+\varphi):

\dfrac C{1+e^{2\varphi} e^{2u}}=\dfrac C2(1-\tanh(u+\varphi)).

We’re almost done at this point:  we simply need

e^{2\varphi}=A,\qquad 2u=-kCt.

Solving and substituting back results in

P(t)=\dfrac C2\left(1-\tanh\left(\dfrac{-kCt+\ln A}2\right)\right),

which, since \tanh is an odd function, becomes

P(t)=\dfrac C2\left(1+\tanh\left(\dfrac{kCt-\ln A}2\right)\right).

And there it is!  The logistic curve as a scaled, shifted hyperbolic tangent.

Now what does showing this accomplish?  I can’t give you a definite answer from the point of view of the students.  But for me, it is a way to tie two seemingly unrelated concepts — hyperbolic trigonometry and solution of differential equations by separation of variables — together in a way that is not entirely contrived (as so many calculus textbook problems are).

I would love to perform the following experiment:  work out the solution to the differential equation together as a guided discussion, and then prompt students to suggest functions this curve “looks like.”  Of course the \arctan might be suggested, but how would we relate this to the exponential function?

Eventually we’d tease out the hyperbolic tangent, since this function actually does involve the exponential function.  Then I’d move into an inquiry-based lesson:  give the students the equation of a logistic curve, and have them work out the conversion to the hyperbolic tangent.

And as is typical in such an approach, I would put students into groups, and go around the classroom and nudge them along.  See what happens.

I say that yes, calculus students should be able to do this.  I recently sent an email about pedagogy in calculus which, among other things, addressed the question:  What do calculus students really need to know?

There is no room to adequately address that important question here, but in today’s context, I would say this:  I think it is more important for a student to be able to rewrite P(t) as a hyperbolic tangent than it is for them to know how to sketch the graph of P(t).

Why?  Because it is trivial to graph functions, now.  Type the formula into Desmos.  But how to interpret the graph?  Rewrite it?  Analyze it?  Draw conclusions from it?  We need to focus on what is no longer necessary, and what is now indispensable.  To my knowledge, no one has successfully done this.

I think it is about time for that to change….

Calculus: Hyperbolic Trigonometry, III

We continue where we left off on the last post about hyperbolic trigonometry.  Recall that we ended by finding an antiderivative for \sec(x) using the hyperbolic trigonometric substitution \sec(\theta)=\cosh(u).  Today, we’ll look at this substitution in more depth.

The functional relationship between \theta and u is described by the gudermannian function, defined by


This is not at all obvious, so we’ll look at the derivation of this rather surprising-looking formula.  It’s the only formula I’m aware of which involves both the arctangent and the exponential function.  We remark (as we did in the last post) that we restrict \theta to the interval (-\pi/2,\pi/2) so that this relationship is in fact invertible.

We use a technique similar to that used to derive a formula for the inverse hyperbolic cosine.  First, write

\sec\theta=\cosh u=\dfrac{e^u+e^{-u}}2,

and then multiply through by e^u to obtain the quadratic


This quadratic equation results in


Which sign should we choose?  We note that \theta and u increase together, so that because e^u is an increasing function of u, then \sec\theta\pm\tan\theta must be an increasing function of \theta. It is not difficult to see that we must choose “plus,” so that e^u=\sec\theta+\tan\theta, and consequently


We remark that no absolute values are required here; this point was discussed in the previous post.

Now to solve for \theta.  The trick is to use a lesser-known trigonometric identity:


There is such a nice geometrical proof of this identity, I can’t help but include it.  Start with the usual right triangle, and extend the segment of length \tan\theta by \sec\theta in order to form an isosceles triangle.  Thus,



To find \alpha, observe that \beta is supplementary to both 2\alpha and \pi/2-\theta, so that


which easily implies




which is precisely what we need to prove the identity.

Now we substitute back into the previous expression for u, which results in


This may be solved for \theta, giving


So let’s see how to use this to relate circular and hyperbolic trigonometric functions.  We have


which after using the usual circular trigonometric identities, becomes

\sec(\text{gd}\,u)=\dfrac{e^u+e^{-u}}2=\cosh u.

It is also an easy exercise to see that

\dfrac{d}{du}\,\text{gd}\,u=\text{sech}\, u.

So revisiting the integral


we may alternatively make the substitution \theta=\text{gd}\,u, giving

\displaystyle\int\sec\theta\,d\theta=\int\cosh u\,(\text{sech}\, u\,du)=\int du,

which is the same simple integral we saw in the previous post.

What about the other trigonometric functions?  Certainly we know that \cos(\text{gd}\,u)=\text{sech}\,u.  Again using the usual circular trigonometric identities, we can show that

\sin(\text{gd}\,u)=\tanh u.

Knowing these three relationships, the rest are easy to find: \tan(\text{gd}\,u)=\sinh u, \cot(\text{gd}\,u)=\text{csch}\,u, and \csc(\text{gd}\,u)=\text{coth}\,u.

I think that the gudermannian function should be more widely known.  On the face of it, circular and hyperbolic trigonometric functions are very different beasts — but they relate to each other in very interesting ways, in my opinion.

I will admit that I don’t teach students about the gudermannian function as part of a typical calculus course.  Again, there is the issue of time:  as you are well aware, students finishing one course in the calculus sequence must be adequately prepared for the next course in the sequence.

So what I do is this:  I put the exercises on the gudermannian function as extra challenge problems.  Then, if a student is already familiar with hyperbolic trigonometry, they can push a little further to learn about the gudermannian.

Not many students take on the challenge — but there are always one or two who will visit my office hours with questions.  Such a treat for a mathematics professor!  But I feel it is always necessary to give something to the very best students to chew on, so they’re not bored.  The gudermannian does the trick as far as hyperbolic trigonometry is concerned….

As a parting note, I’d like to leave you with a few more exercises which I include in my “challenge” question on the gudermannian.  I hope you enjoy working them out!

  1.  Show that \tanh\left(\dfrac x2\right)=\tan\left(\dfrac 12\text{gd}\,x\right).
  2. Show that e^x=\dfrac{1+\tan(\frac12\text{gd}\,x)}{1-\tan(\frac12\text{gd}\,x)}.
  3. Show that if h is the inverse of the gudermannian function, then h'(x)=\sec x.

Bay Area Mathematical Artists, VIII

Yesterday was our final meeting of the Bay Area Mathematical Artists for the academic year 2017–2018.  We were back at Santa Clara University to visit their virtual reality lab, the Imaginarium!  It was an amazing visit, coordinated by Frank Farris, Tom Banchoff (who is visiting Santa Clara University this semester), and Imaginarium director Max Sims.

Sculpture outside the Imaginarium.

While we were waiting for everyone to arrive, Tom generously provided donuts for us to snack on.  But not until we were given a short presentation on a very special property of donuts — the “two-piece” property, which Tom discussed in his doctoral thesis.

A perfectly smooth donut — this is important, since bumps or ridges are problematic — has the property that if you take a knife and make a planar cut, you always get exactly two pieces.

Of course any convex shape automatically has this property.  Donuts, however, are not convex, so they are special in this regard.  Tom remarked that discussing this makes good breakfast conversation, since smooth bagels also have the two-piece property.  But a sufficiently curved banana does not (think of the letter U and make a horizontal cut to get three pieces).

A different view of the same sculpture.

Once everyone arrived, Tom began with a presentation of his forays into computer graphics and animations.  The first video he showed was made in 1968 with computer scientist Charles Strauss, also at Brown, which showed a torus turning inside out.

What was fascinating was how the video was made.  Keep in mind this was long before platforms like Processing were available….  Even though each frame was black-and-white and consisted of line drawings of a torus in various different configurations, it still took about a minute to create each frame.

Then, each frame had to be photographed — using film, if you remember what that is.  Then another minute, another photograph.  Next, the film was sent on to Boston, where it was processed into a movie.  The movie was sent back — and hopefully, it was just what you wanted….

Fast-forward to 1978, where the subject of the video was rotating cubes and hypercubes. I won’t try to describe it in words, but you can actually see the video online here.

It looks like the graphics in this movie were color graphics!  But no, that wasn’t available yet.  You see color because each frame used four photographs — each taken with a different filter on.  These were overlaid to create a color graphic.  Very creative, and again, certainly much more work than it would take today.  Keep in mind that 1978 was forty years ago….

There were still three movies to go!  Next, Tom showed us his 1985 movie about the hypersphere.  We then got to see Tom’s animation of donut slicing, which was the virtual version of our initial demonstration.  Finally, the last video was from 1999, which was a rotation of the flat torus.

The movies and talk took us halfway through the afternoon.  Now it was time to try on the headsets and have our very own virtual reality experience!

We learned from Max Sims a little about the technical challenges of creating a good VR experience.  First, 90 frames per second is ideal — contrast that with 30 frames per second when creating movies with a platform like Processing.  And second, the response time of the headsets needs to be no longer than 11 milliseconds — that is, when you turn your head to look at something, the image has to change that fast — or else you’ll get motion sickness.


The way the lab was set up, everyone got their own computer (although it took me three tries to find one which had everything working properly).  You can see people with headsets on and controls in their hands.

It is very hard to describe what it feels like with the headset on without experiencing it for yourself.  But when you put on the goggles, you’re in a 360-degree visual environment.  That is, when you turn your head to the right, you are seeing what’s to the right of your visual range in the VR simulation.  You can even look down and see what’s underneath you!  It was a little dizzying to look down and see a stream running underneath you, since that meant you were suspended in midair….

The hand controls were different for every experience.  Some allowed you to move things, or select different types of building blocks to make 3D images, or select a different simulation.  It took a bit of getting used to, and I didn’t fully get the hang of it in the hour we had to play around.  But Max said we were welcome back to try out the lab again, and I do intend to take him up on his offer.

After our incredible experience, we went out for Thai — sixteen of us, this time!  We spent over two hours at dinner, which is typical.  These gatherings bring together a diverse group of people interested in all aspects of mathematics and art, and it seems we never run out of things to talk about.

Then the drive home.  I was driving Nick, and we were amazed by the cloud formations we saw all along the way.  Despite my rather dirty windshield, Nick snapped this gorgeous pic.


The clouds were like this for most of the drive home, and were a very fitting end to our last gathering of the semester.

Plans are underway to continue meeting throughout the summer, so stay tuned!