Skip to main content

Law of Cosines and the Legendre Polynomials

This is so cool!!!

A few days ago I extolled the virtues of the law of cosines, taught in high schools the world over, and claimed that it turned up in all kinds of problems that you run into later in physics.  I gave one example of an electrostatics problem I was working on, but I had a nagging feeling in the back of my head that there were even cooler examples I'd forgotten about.  It turns out that there is a way cooler example of the importance of the law of cosines!  The law of cosines can be used to calculate the Legendre polynomials!!!

OK, so what are the Legendre polynomials?  They turn up repeatedly in graduate physics classes.  First of all, they're used to solve electrostatics problems[4].  The most noticeable place I saw them was in quantum mechanics, where they were derived as a special case of spherical harmonics.  Spherical harmonics are used to describe the wavefunction of an electron in a hydrogen atom, and ultimately to come up with graphs of the wave functions like the one shown below from Wikipedia[1]:

Now that we've got the gratuitously pretty pictures out of the way, here's a graph of the first few Legendre polynomials, also from Wikipedia[2].

The really cool part is that although these functions have been the bane of physics grad students forever, (depending on who you ask), they can be derived using two high school math tools... the law of cosines of course, and the binomial expansion.

So, what brought all this on, and what does it have to do with the law of cosines anyway, you ask?  This week, I remembered a passing, and, at the time, seemingly obscure statement made during math methods lecture last semester:

The generator of the Legendre polynomials is

If you look at the denominator, it resembles the law of cosines from last weeks post a bit.

I wasn't intuitive enough to put it all together, but fortunately for me, George Arfkin described the relationship  between the two quite nicely in "Mathematical Methods for Physicists".  If you perform the following manipulations you arrive at an equation that exactly matches the denominator of the "generator" function above

We'll throw out the a in front for now, we can always multiply it back in later when we're done.

Then, we'll just rename a few things

And finally, using our new names we get:

The law of cosines is the generator of the Legendre polynomials!!!

OK, OK, that's great, but how do we get from the law of cosines to the actual Legendre polynomials and what is a generator anyway?  A generator used in this context is just a formula that can be expanded/manipulated to calculate a set of other mathematical expressions like the Legendre polynomials.  Here's a list of the first few Legendre polynomials so we can see where we're headed.

Starting with our generator, we re-write it a few times and then re-group it

All I've really done is rewrite one over the square root as the guts of the square root raised to the one-half power.  Then, I put it in the form using b so that it was easier to see that we're about to use the second high school math trick, the binomial expansion.

The binomial expansion is, for our purposes, just a formula that allows us to rewrite the one plus b to the negative one half formula above as a sum of terms in powers of b.  Put concisely it says:

I found an excellent reference on the binomial expansion earlier today[3].  By excellent, I mean it doesn't get into too much detail, yet gives lots of concrete examples.  Using n equal negative one half for our problem gives the first few terms of

Then, substituting back in for b gives

If you look back at the list of Legendre functions, you'll see that we have the first three.  We can get more of them just by calculating more terms of the series.

For What It's Worth, Legendre Polynomials and Graduate Education
With the +American Physical Society 2nd annual conference in education starting tomorrow, I thought I'd throw in a few thoughts on my experience with how Legendre polynomials are introduced.  I've seen them introduced in several classes in the same general way that went like this, (in contrast to Arfkin's more historically based explanation):

1.  Show how to solve a differential equation, (say the hydrogen atom for example) by splitting it into simpler differential equations by the separation of variables.
2.  Say that one of the resulting equations has a solution involving Legendre polynomials
3.  Spend a significant amount of time on Rodrigues' formula and other recurrence formulas to calculate lists of Legendre polynomials.
4.  Write down the law of cosines expression from above and offhandedly mention that it's the 'generator' of the Legendre polynomials

I may be speaking for the lower tier of graduate students, but the above method always left me with a general feeling of mystery about the Legendre polynomials.  I certainly didn't feel as though I owned them, and basically repeated the entire learning process with little retention each time I encountered them.

Here are some pointers that would have helped me to own the subject:
1.  Clarify the use of the term 'generator'.  After a few years in a physics program, most students have also heard the word generator used in an offhanded way to refer to group theory.  The meaning is different here, it simply means an expression that can be manually expanded to calculate, (generate), the Legendre polynomials.  I fell victim to this one myself on the first draft of this article.  I completely omitted the definition of what a generator is.

2.  If time allows, show how the generator comes from the law of cosines, ala Arfkin, with the following additional suggestions.

3.  From the number of students I've seen diligently working through trigonometry, I don't think I"m alone on this.  By the time we're in grad school, it's very possible we've forgotten we learned the law of cosines in high school.  Re-introduce it briefly just to get everyone feeling comfortable that they've known this since they were 16.  A simple diagram and a few words ought to do the trick.

4.  The same thing goes for the binomial expansion.  Also, keep it simple by avoiding the 'choose' notation for calculating the terms of the binomial expansion.  The notation looks cool, but when shooting for making folks feel comfortable that they've known something all along, introducing another notation, (that admittedly they should also know from high school), doesn't help.

5.  Force us to memorize the law of cosines and the binomial expansion with a quiz or with several quizzes.  The two topics come up repeatedly in all our classes.  Having them internalized is a huge help.

6.  Emphasize the fact that the Legendre polynomials can be constructed using high school math tools.



3.  binomial expansion reference

4.  deriving the Legendre polynomials to solve electrostatics problems

Picture of the Day:

From 1/30/13


Popular posts from this blog

Cool Math Tricks: Deriving the Divergence, (Del or Nabla) into New (Cylindrical) Coordinate Systems

Now available as a Kindle ebook for 99 cents! Get a spiffy ebook, and fund more physics
The following is a pretty lengthy procedure, but converting the divergence, (nabla, del) operator between coordinate systems comes up pretty often. While there are tables for converting between common coordinate systems, there seem to be fewer explanations of the procedure for deriving the conversion, so here goes!

What do we actually want?

To convert the Cartesian nabla

to the nabla for another coordinate system, say… cylindrical coordinates.

What we’ll need:

1. The Cartesian Nabla:

2. A set of equations relating the Cartesian coordinates to cylindrical coordinates:

3. A set of equations relating the Cartesian basis vectors to the basis vectors of the new coordinate system:

How to do it:

Use the chain rule for differentiation to convert the derivatives with respect to the Cartesian variables to derivatives with respect to the cylindrical variables.

The chain rule can be used to convert a differe…

Division: Distributing the Work

Our unschooling math comes in bits and pieces.  The oldest kid here, seven year-old No. 1 loves math problems, so math moves along pretty fast for her.  Here’s how she arrived at the distributive property recently.  Tldr; it came about only because she needed it.
“Give me a math problem!” No. 1 asked Mom-person.

“OK, what’s 18 divided by 2?  But, you’re going to have to do it as you walk.  You and Dad need to head out.”

And so, No. 1 and I found ourselves headed out on our mini-adventure with a new math problem to discuss.

One looked at the ceiling of the library lost in thought as we walked.  She glanced down at her fingers for a moment.  “Is it six?”

“I don’t know, let’s see,” I hedged.  “What’s two times six?  Is it eighteen?”

One looked at me hopefully heading back into her mental math.

I needed to visit the restroom before we left, so I hurried her calculation along.  “What’s two times five?”

I got a grin, and another look indicating she was thinking about that one.

I flashed eac…

The Javascript Google URL Shortener Client API

I was working with the Google API Javascript Client this week to shorten the URLs of Google static maps generated by my ham radio QSL mapper. The client interface provided by Google is very useful. It took me a while to work through some of the less clear documentation, so I thought I'd add a few notes that would have helped me here. First, you only need to authenticate your application to the url shortener application if you want to track statistics on your shortened urls. If you just want the shortened URL, you don't need to worry about this. The worst part for me was that the smaple code only showed how to get a long url from an already shortened rul. If you follow the doucmentaiotn on the insert method, (the method for getting a shortened url from a long one), there is a reference to a rather nebulous Url resource required argument. It's not at all clear how to create one of these in Javascript. The following example code shows how:
var request = gapi.clie…