Skip to content

A least-squares demo

Dan Goldstein set up this demo you can show to your students to understand least squares. It’s pretty cool, although there’s something about those square boxes that I find disconcerting. I don’t usually think of the squaring in least squares as actual sizes of physical squares. So I’m thinking that, for some students, the square boxes will be a help; for others, a distraction. I’d also like to see more than 4 points, and I’d like to drag and manipulate the points and the line themselves, rather than simply clicking on buttons to move the line around. But now that this has been set up, presumably it won’t be hard to add these improvements if appropriate.


  1. Brian says:

    Thanks for the link! I just linked to Dan Goldstein's demo with a hattip back to you. I used to be a mechanical engineer and am currently working on my PhD in Economics at George Mason University. I'm definitely a visual thinker and can see this as being a great tool to teach people with a similar mindset how this works. You can see my post here.