I frequent math.stackexchange these days (if you haven’t heard of it, you should go check it out), and every once in a while I get stunned by a solution or a thoughtful question. As I took my Numerical Analysis Class my last semester as an undergrad (last semester, woo hoo!), I remember coming up against Gaussian Quadrature estimates for integration. It’s a very cool thing, but the system of equations to solve seems very challenging – in fact, it feels like one must use a numerical approximation method to solve them. While I don’t have any big qualms with numerical solutions, I much prefer exact solutions. Here is the best method I’ve seen in solving these (this is for 3 points, but we see how it could be used for 1,2, and 4 points as well), and all credit must be given to the user Aryabhatta at Math SE, from this post.

The task is easy to state: solve the following system:

We are to solve for x, y, z, a, b, and c; the m are given. This is unfortunately nonlinear. And when I first came across such a nonlinear system, I barely recognized the fact that it would be so annoying to solve. It would seem that for too many years, the solutions the most of the questions that I’ve had to come across were too pretty to demand such ‘vulgar’ attempts to solve them. Anyhow, one could use iterative methods to arrive at a solution. Or one could use the Golub-Welsch Algorithm (which I also discovered at Math SE). One could use resultants, which I did in my class. Or one could be witty.

Let’s introduce three new variables. Let x, y, and z be the roots of . Then we have

Multiply equation (1) by , equation (2) by , and equation (3) by and add. Then we get

Multiply equation (1) by , equation (2) by , and equation (3) by and add. Then we get

Finally (you might have guessed it) multiply equation (1) by , equation (2) by , and equation (3) by and add. Then we get

Now (4),(5), (6) is just a set of 3 linear equations in terms of the variables p, q, r. Solving them yields our cubic. We can then solve the cubic (perhaps using Cardano’s formula, etc.) for x, y, and z. And once we know x, y, and z we have only a linear system to solve to find the weights a, b, and c. That’s way cool!