#PhysicsFactlet (342) Lagrange multipliers
Strictly speaking Lagrange multipliers are not "Physics", but they are so useful to solve so many Physical problems, that it is definitively worth looking at them.
1/
Before we even introduce them, let's solve a super-simple problem, which will form the basis for our motivation to look into Lagrange multipliers:
Find the minimum of the function f=x²+y².

Yes, I can hear you shouting x=y=0, but let's still do the calculation.
2/
The way you find the minimum of a function is to check the points where all the partial derivatives are zero (in this case we have 2 variables, so we will look at the partial derivatives with respect to x and y): df/dx=2 x, df/dy=2y --> 2x=0, 2y=0 --> x=y=0.
3/
Obviously this doesn't tell you whether what we found is a minimum or a maximum. For that we need the second derivatives (spoiler: we found a minimum 🙃).

What if we had a constrained minimization problem? E.g. find the minimum of the function f=x²+y² such that x²+y=1.
4/
This particular problem is simple enough that we could just brute-force it (substitute y=1-x² into f=x²+y², differentiate with respect to x and equal it to zero). But it is useful to find a simpler way to solve this, so we can use it when the problem gets uglier.
5/
Let's make a "contour plot" of our surface, where the lines represent constant values of the function, and plot the constraint on top of it.
We are looking for the "smallest" contour line that just touches the constraint (if there is a smallest one, we are not on our minimum).
6/ Image
At the point where the contour lines touch the constraint, the two curves are tangent to each other, i.e. their gradients are parallel. Calling λ the proportionality coefficient, we can write the relation between the gradients.
7/ Image
Together with the constraint equation this gives us a system of 3 equations in 3 variables, which we can solve to find our solution(s).
8/ Image
Why is this useful?
The point is that we just saw that asking what is the minimum of the function f, subject to the constraint g=c, is the same as writing the equality ∇ f = λ ∇ g, which is the same as ∇ (f +λ g)=0, which is the same as minimizing f +λ g.
9/
Where λ is called a "Lagrange multiplier".

This method is very powerful, as it allows us to transform a constrained minimization into an unconstrained minimization, which is usually much easier to solve.
10/
Let's look at a more complicated problem, which will highlight both the power and the limitations of this method. Say we have a point (x₁,y₁,z₁), what is the closest point on the torus [√(x² + y²) − 5]² + z² = 4?
11/
To avoid a lot of square roots, we will minimize the distance squared instead of the distance, so the function we want to minimize is
(x-x₁)²+(y-y₁)²+(z-z₁)²+λ [(√(x² + y²) − 5)² + z²].
12/
We have a functional to be minimized, we have a constraint, we put them together (with one Lagrange multiplier per constraint), and now we have a function to minimize without having to bother with the constraint anymore! Easy!
13/
Obviously the problem is that the system of equations we get when we make the partial derivatives with respect to x, y, and z (plus the constraint equation) is not linear, so unless we are very lucky we need to solve it numerically.
That said, the recipe works!
14/
And beside just working, the system you have to solve is simpler than what you would have obtained if you brute-force substituted the constraint inside the functional!
15/15

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Jacopo Bertolotti

Jacopo Bertolotti Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @j_bertolotti

Sep 11
#PersonalOpinionOnOldishGame
You can't really finish #MonsterHunterWorld, but I have played as much as I am going to (100+ hours), so here are a few thoughts about it.
TL;DR: it is a good game with some incomprehensible flaws.
1/
Monster Hunter: World is the Nth (with N being a large integer) game in the the Monster Hunter series, but it was the first one I ever played (the new one, Monster Hunter: Rise is only on Nintendo Switch).
2/
The story is non-existent, so let's ignore it. It is just a poor excuse for you to run around some well designed maps hunting and killing dinosaur-like monsters.
There are only 5 maps in the base game, but they are large enough not to be too repetitive.
3/
Read 11 tweets
Jul 18
#PhysicsFactlet (335)
Yesterday, at a small playground where my son was playing, I saw this Kugel fountain, so here comes a short thread about Kugel fountains and how they work.
🧵 1/

(Alt Text: a Kugel fountain slowly rotating in a sunny day.)
First of all, what is a Kugel fountain?
There are a few variations on the theme, but usually they are big stone spheres, sitting on a hemispherical hole, with water flowing from below. Despite their weight, they can spin with a small push, and keep spinning for a long time.
2/
How does it work?
It can't be buoyancy, as the stone sphere is a a LOT more dense than the water (we all have direct experience of stones sinking when you put them in water, and this one is not any different).
3/
Read 10 tweets
May 13
#PhysicsFactlet (331)
"Anderson localization" is a weird phenomenon that is not well known even among Physicists, but has the habit of popping up essentially everywhere.
An introductory thread 🧵
1/
The idea of "localization" originally came about as an explanation (by P.W. Anderson, hence the name) of why the spins in certain materials did not relax as fast as expected.
nobelprize.org/prizes/physics…
2/
What Anderson realized was that when you have a wave (in this case a quantum mechanical wavefunction) that propagates in a random system, interference can play a major role, and potentially impede propagation completely.
journals.aps.org/pr/abstract/10…
(Paywalled)
3/
Read 19 tweets
Mar 7
New paper on #ArXiv!
"Tracking moving objects through scattering media via speckle correlations"
With @YJaureguiS, and Harry Penketh.

Short(?) thread explaining what it is about.
1/
arxiv.org/abs/2202.10804
Scattering is a major problem for imaging, and it doesn't take very much of it before we can't see essentially anything of what it is happening.
Not surprisingly, imaging in the presence of scattering is a very active field of research.
2/
There isn't a single best way on how to deal with scattering, and the answer depends a LOT on how much scattering we are talking about and its properties.
As a rule of thumb, the most complicated situation is where all light is multiply scattered.
3/
Read 13 tweets
Jan 3
#TheLongRoadToLearnSomethingNew
I decided it is high time I learn something about machine learning. I couldn't care less about learning how to use Tensorflow or any other package that do machine learning for you. I "just" want a Physicist's intuition for how and why it works.
1/
A million years ago I asked here for advices on resources. Some were very good advices, some were not. But I am mow armed with a textbook, and will irregularly update here on my progresses.
2/
I am not very far on my path. I've read a few online resources and (so far) the first 30 pages of this book.
I am aware machine learning is a HUGE topic, so I will begin by concentrating on neural networks (and probably a sub-sub-class of neural networks).
3/ Image
Read 11 tweets
Dec 31, 2021
#PhysicsFactlet The ones I am most proud of from 2021 (in chronological order)
A visualization of what an eigenvector is (at least for 2x2 matrices)
Pulse chirping (keeping the pulse duration constant for ease of visualization, although in reality one usually keeps the bandwidth constant)
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(