Lagrange multipliers, using tangency to solve constrained optimization

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ • 246

  • @Burneynator
    @Burneynator 7 років тому +486

    Somehow you've managed to compress a 1 hour long lecture into 9 minutes long video with better explanations than my lecturer, thanks a lot! :)

    • @BROWNKEY
      @BROWNKEY 4 роки тому +1

      8.42 minutes , not 9

    • @Burneynator
      @Burneynator 4 роки тому +10

      @@BROWNKEY Well, all the better

    • @rhn122
      @rhn122 4 роки тому

      Aye a 3 yo comment just got replied 2 days ago. Plus he's the man and the legend Grant 3Blue1Brown himself o7

    • @garyjia7703
      @garyjia7703 4 роки тому

      It is the case. Lecturer in my university explain these concepts for 3 hours but still leave us confused

    • @mintylemon66
      @mintylemon66 8 місяців тому

      @@BROWNKEY I'd say 8.7 minutes

  • @hoodarrock2453
    @hoodarrock2453 8 років тому +201

    the new guy for khan academy is so mathematical ... I love his explanations so much they are so deep instead of just giving a set of techniques and methods on how to solve exams he gets in the core of things... that's what we always for in Khan Academy

    • @themax1234521
      @themax1234521 8 років тому +40

      Hoodar Rock look for his own UA-cam channel, 3blue1brown. Amazing explanations and great videos.

    • @jipuragi6483
      @jipuragi6483 2 роки тому

      @@luffy5246 hii what is the name of that channel?

    • @astradrian
      @astradrian Рік тому +9

      @@jipuragi6483 3Blue1Brown.

    • @jipuragi6483
      @jipuragi6483 Рік тому +1

      @@astradrian thanks a ton

    • @bofa722
      @bofa722 Рік тому

      ​@@jipuragi6483 bruh

  • @jonaqpetla_
    @jonaqpetla_ 7 років тому +891

    Is that 3blue1brown? OMG!

    • @asadullahfarooqi254
      @asadullahfarooqi254 6 років тому +42

      yeah i think so because he have worked for sal khan (khan academy)..

    • @perfumedsea
      @perfumedsea 6 років тому +55

      Oh. I was thinking this voice is so not Khan and somehow very familiar. Then I saw this comment. Interesting to know ;)

    • @jinanlife
      @jinanlife 6 років тому +25

      his iconic voice

    • @muhammadjoshua7464
      @muhammadjoshua7464 6 років тому +3

      I was about to comment the same thing !

    • @BlackRose4MyDeath
      @BlackRose4MyDeath 5 років тому +3

      Lol, same thought. I was like, Grant?!?

  • @Cyrusislikeawsome
    @Cyrusislikeawsome 7 років тому +4

    This guy is just maths bae. Best maths channel on UA-cam and best Khan Academy videos for maths. what a beast.

  • @saahilnayyer6865
    @saahilnayyer6865 3 роки тому +2

    Khan Academy has really revolutionized learning. Today we have so many online learning platforms and all of these are in a way off-springs of Khan Academy. Topic wise learning makes the hour long lecture approach of colleges redundant. Most professors at universities are very knowledgable no doubt but not so great educators. To be able to impart the knowledge you hold is an art. Cheers to Khan Academy.

  • @hellelo.5840
    @hellelo.5840 6 років тому +17

    3blue1brown Congratulation, I love the fact you are working with Khan Academy, thats great...

  • @ednaT1991
    @ednaT1991 6 років тому +28

    With math it's always the same way: When you don't understand it, it's hell but when you got it, it's pretty cool. :)
    Thank you for such a nice explanation!

    • @missghani8646
      @missghani8646 4 роки тому +1

      thats what makes mathematics beautiful

  • @garronfish8227
    @garronfish8227 2 місяці тому

    I did this in University 2nd year Maths and basically came to the conclusion that it was magic. Now I'm starting to understand it thank you so much!

  • @miksaile
    @miksaile 3 роки тому +23

    this is divine. This just cleared my mind up 😭😭 your explanations are so clear and mathematical, yet intuitive! Thanks a lot 😊

  • @spencertaylor6910
    @spencertaylor6910 6 років тому +43

    Grant hits that yeet again. What a boss

  • @MrSkizzzy
    @MrSkizzzy 6 років тому +8

    This was so well explained that i'd call it a masterpiece.

  • @fjgozzi
    @fjgozzi 4 роки тому +2

    I´ve just contributed pt-br subtitles, please accept them so that this great material is available to a larger audience!

  • @maxbardelang6097
    @maxbardelang6097 2 роки тому +3

    4:27 Though his name may sound French, Lagrange was actually Italian. Actually he was born Italian, his birth name beeing Lagrangia, then migrated to France and changed his name.

  • @robertcohn8858
    @robertcohn8858 4 роки тому +2

    Very nicely done! I haven't done anything with math like this for 40+ years, and I was able to follow along very well. Thank you.

  • @franciscorivas4036
    @franciscorivas4036 4 роки тому +9

    Thank you very much!! this explanation is life-saving. I'm trying to understand Lagrange duality for support vector machines and I've watched many videos but I'm still stuck. Now I have a better taste of what it is about.

  • @mantacid1221
    @mantacid1221 7 місяців тому

    I am literally Watching this the day before my final, and this is way better than how my textbook went about this.

  • @tinayang7351
    @tinayang7351 7 років тому +1

    thank you for doing this. I liked that they are put into small pieces instead of a long lecture.

  • @charliethatcher404
    @charliethatcher404 6 років тому +1

    You legit just saved my test grade tomorrow. Cheers

  • @kylewolfe_
    @kylewolfe_ 2 роки тому

    Wow, was not expecting to get an explanation from Grant when I clicked on a Khan Academy video. Very cool!

  • @nevgongivuup
    @nevgongivuup Рік тому

    Thanks for saving my life, Grant. You are the best.❤

  • @poiuwnwang7109
    @poiuwnwang7109 4 роки тому +1

    f = lambda*g is super. I learned that in university, but his explanation is really insightful.

  • @gigglification
    @gigglification 6 років тому +1

    Thankyou!! It was tremendously helpful. You are saving lives here.

  • @real_john_doe
    @real_john_doe 4 роки тому

    This video's example makes sense. The problems that pop up on the test are a different story.

  • @matlabmalayalam3288
    @matlabmalayalam3288 3 роки тому +1

    World-class teaching...

  • @rfolks92
    @rfolks92 5 років тому +30

    Lagrange was Italian. I don't know why, but we know him by his French name "Joseph Louis Lagrange" rather than his Italian name: "Giuseppe Luigi Lagrangia".

    • @liammckenna1479
      @liammckenna1479 4 роки тому +7

      I thought you were joking but you're not lol, I just looked it up and it looks like he was naturalized French.

    • @joshuaflackua
      @joshuaflackua 3 роки тому +1

      It's complicated. Lagrange was born in Piedmont, Italy. However, he later moved to France, and in an unrelated series of events, Piedmont was annexed by France. As a result, he gained French citizenship and French and Italians both claimed him as their own.
      As for his parentage, he actually comes from a family that is both French AND Italian, and he spent more of his life in Paris than in Piedmont.
      On a plaque that was placed on the Eiffel Tower when it opened he was listed as a "prominent French scientist", but today his place of birth still lies in Italy.
      I think if you had asked him whether he was French or Italian he would have either expounded on his indifference to nationalism, or explained that citizenship is more complicated than one's place of birth.
      It certainly doesn't seem incorrect for Grant to refer to him as French though.

  • @turbopotato4575
    @turbopotato4575 7 років тому +2

    I havent watched the video yet and have no idea what Lagrange multipliers are, but here is how I'd do it:
    1=x^2 +y^2
    x=sqrt(1-y^2)
    f(x,y)=x^2y
    f(y)= (1-y^2)y= y - y^3
    f'(y)=1- 3y^2 = 0
    y = +-sqrt(1/3)
    x = +-sqrt(2/3)
    f(+ - sqrt(2/3),+ - sqrt(1/3))= + - 2*sqrt(1/3)/3

    • @turbopotato4575
      @turbopotato4575 7 років тому +1

      And I was right. But I understand the need for a more general method to solve these since its not always this easy to express one variable explicitly from another. But this method can serve as a great shortcut.

  • @nahblue
    @nahblue 3 роки тому +1

    While the lagrange method with lambda is great to learn, it is actually a lot less gruel in examples such as these to solve the equations without involving lambda. Take the requirement grad f || grad g and write it as a determinant, det(fx fy; gx gy) == 0 grad f and grad g are parallel; that's one equation and the constraint is another equation -> two equations and two unknowns. :)

    • @joshuaflackua
      @joshuaflackua 3 роки тому

      I noticed this, but my professor mentioned that there are some equations where lambda plays a role. I'm not sure what they could be though.

  • @goclbert
    @goclbert 2 роки тому

    I love how the visual makes it clear that Lagrange Multipliers are eigenvalues

  • @foadabodahood9509
    @foadabodahood9509 6 років тому +1

    Finally!! at 4:15 it all makes sense! THANK YOU

  • @diannebanal1650
    @diannebanal1650 8 років тому

    This video helped me visualize everything about lagrange multipliers! thank you for posting

  • @NicolasSchmidMusic
    @NicolasSchmidMusic 3 роки тому

    I feel so stupide for not having watched these videos when I was strugeling to understand multivariable calculus, but it still feels good to watch them in my free time :)

  • @giorgossartzetakis8771
    @giorgossartzetakis8771 4 роки тому +1

    OMG this guy is pure genious!

  • @learningindia6733
    @learningindia6733 2 роки тому +2

    Genius, real mathematics......

  • @ND-kl8lo
    @ND-kl8lo 10 місяців тому

    3Blue1Brown you are awesome bro, love it! Great teaching, and teaching voice, makes learning simpler, faster, more enjoyable, and the visuals help so much.

  • @leosin5767
    @leosin5767 Рік тому

    3blue1brown deserves a Nobel Prize in math education

    • @skrgrnd
      @skrgrnd Рік тому

      there's no nobel prize for math or education

  • @Johncowk
    @Johncowk 4 роки тому +1

    That was SO clear I cannot thank you enough.

  • @justadude8716
    @justadude8716 Рік тому

    If you are interested, this was found by Joseph-Louis Lagrange, author of Mécanique analytique matching Newton's Principia in comprehensiveness over mechanics. If you have taken physics and are familiar with Newtonian mechanics, then read "The Lazy Universe" by Jennifer Coopersmith, where she gives an introductory view into the Principle of Stationary Action and Lagrange was key in defining it. Remember: most beautiful and useful mathematics come from understanding nature, and this method you are learning does just that, it maximizes/minimizes some "thing" which is what nature loves to do.

  • @AngeloArrifano
    @AngeloArrifano 3 роки тому

    I recognize this voice ! I'm pretty sure it's Grant from the 3 Blue 1 Brown channel !!
    Excellent explanation, as always !

  • @ddos87
    @ddos87 5 років тому

    Khan crushing it as usual

  • @alias40anon
    @alias40anon 6 років тому +1

    Mate you nailed it, excellent explanation

  • @jadedjimmy
    @jadedjimmy 6 років тому +4

    6:26 pullin out that Sal impression

  • @guillermo._._
    @guillermo._._ 4 роки тому

    Excellent geometric intuition!

  • @GOPALS1967
    @GOPALS1967 4 роки тому +1

    Beautifully explained.

  • @benisbuff
    @benisbuff 8 років тому +37

    Literally have an exam on this in 4 hours :) cheeeers

    • @ibrahimalkhorsani2533
      @ibrahimalkhorsani2533 8 років тому +1

      Ben lol.
      hope you made it through bro.

    • @T33-q9c
      @T33-q9c 7 років тому

      How did it go??

    • @benisbuff
      @benisbuff 7 років тому +11

      I got 56% haha. P's get degrees right?

    • @FsimulatorX
      @FsimulatorX 7 років тому

      Where are you now?

  • @AAA-uv1ny
    @AAA-uv1ny Рік тому

    thank you! the animation and explanation are awesome, it helps a lot

  • @dennishuang3498
    @dennishuang3498 5 років тому

    Clear explanation ! Thanks for all your effort!

  • @christopherandrewmartin494
    @christopherandrewmartin494 2 роки тому

    Very helpful. Thanks for all your videos!

  • @danawen555
    @danawen555 3 роки тому

    thanks!!! very good and exhaustive explanation

  • @scoffer2150
    @scoffer2150 Рік тому

    Thank you so much for this epic! Worth watching.

  • @samuelvaldezgil
    @samuelvaldezgil 2 роки тому

    Im in love with this dude

  • @jigneshrathod3714
    @jigneshrathod3714 7 років тому +5

    Hi.. Nice video... Can anyone share which playlist it is part of.. I want to watch the whole course and somehow suggestions that youtube gives for next video is kind of random...

  • @annang.3176
    @annang.3176 5 місяців тому

    Beautiful explanation

  • @alecmac6975
    @alecmac6975 Рік тому

    You saved me for my Micro Econ test

  • @queenstrategy904
    @queenstrategy904 4 роки тому

    Gradient is a vector with the partial derivative for x and partial derivative for y

  • @mertbeser9837
    @mertbeser9837 3 роки тому +1

    The explanation is perfect. I wonder which program do you use to visualize it ? Or anyone know what program is this

  • @mermaid6380
    @mermaid6380 5 років тому

    Thank you! I don't understand my prof but I can understand this

  • @adrianpabloalvarez2523
    @adrianpabloalvarez2523 2 роки тому +3

    Thank you. I understood the concept quite easily but probably not as completely as I would like. What could happen if the two surfaces have more than a point with the gradients being proportional but not touching each other? it can't happen when using the constraint itself as an equation right? but could the equations touch each other in different points?

  • @ikhwanjeon7370
    @ikhwanjeon7370 4 роки тому +1

    Why do we assume that the gradients of f and g at a point would have exactly same direction?
    I think even though they touch each other at the point, there is no way that the direction of gradient would exactly same??
    And never have found the answer yet..

  • @ruralmetropolitan
    @ruralmetropolitan 8 років тому +166

    "Lagrange one of those famous french mathematicians...".... Italians getting triggered! :D

    • @GreyEyedAthena
      @GreyEyedAthena 7 років тому +8

      Quasnt Hered naturalized French , so French.

    • @ihbarddx
      @ihbarddx 6 років тому +2

      I know I did! :-)
      Other than that, nice explanation!

    • @philippelaferriere2661
      @philippelaferriere2661 5 років тому

      He did end up finishing his life in France ;)

    • @OfficialAnarchyz
      @OfficialAnarchyz 5 років тому +6

      Huh maybe some nerds are getting triggered. As an Italian, I feel like we have enough mathematicians and scientists to claim already B-)

    • @Labroidas
      @Labroidas 4 роки тому

      @@OfficialAnarchyz Yeah you have enough! Give some to us Austrians xD

  • @Revetice
    @Revetice 7 років тому

    very well explained and nice quality. thanks!

  • @DennyMapleSyrup
    @DennyMapleSyrup 8 років тому +4

    If only this was posted 2 weeks ago when we had our test on it :(

    • @randomdude135
      @randomdude135 8 років тому

      math1052??

    • @DennyMapleSyrup
      @DennyMapleSyrup 8 років тому

      randomdude135 No I'm in high school :(

    • @randomdude135
      @randomdude135 8 років тому +2

      Daveed 78 dammn. You're doing this in hs??? I'm doing this in university hahaha

    • @DennyMapleSyrup
      @DennyMapleSyrup 8 років тому +1

      randomdude135 I lucked out,my high school does a dual credit with a local college

    • @amidg4x4
      @amidg4x4 8 років тому +2

      doing on the 2nd year of university... Lagrange multipliers... MATH251

  • @speedracer1702
    @speedracer1702 3 роки тому

    Amazing explanation!

  • @jeatig
    @jeatig 6 років тому

    (A problem in an Earl W. Swokowski calculus book) "Find the points on the graph of 1/x + 2/y + 3/z = 1 which are closest to the origin." Answer: (a, 2^(1/3)a, 3^(1/3)a), as a = 1 + 2^(2/3) + 3^(2/3), approx. (4.667, 5.881, 6.732). The shortest distance is approx. 10.084. Why is this so; as x=1, y=-2, z=3 is used; which makes the equation equal to 1; and the distance from the origin is sqrt (1^2 + (-2)^2 + 3^2) = sqrt (14) which is approx. 3.742; which is less than 10.084?? Is this problem restricted only to the octant where x, y, and z are all positive??

  • @ambresipahimalani4198
    @ambresipahimalani4198 3 місяці тому

    but what if the maximum is "in the circle", like a montain that would have its summit above the center of the circle, the two curves would'nt be tangent, would they ?

  • @luciafresnopm
    @luciafresnopm 4 роки тому +4

    i couldn't find "the next video" . could you please link it somewhere here? thank you :)

    • @ahmednesartahsinchoudhury2628
      @ahmednesartahsinchoudhury2628 7 місяців тому

      for future viewers: there is a playlist called "multivariable calculus" that contains all these lectures. you can find the playlist from the description!

  • @tsrevo1
    @tsrevo1 7 років тому

    Wow. excellent explanation.

  • @Wayk123
    @Wayk123 5 років тому +4

    Fun fact lagrange developed this method when he was 19 years old

    • @firefoxyouth
      @firefoxyouth 5 років тому +7

      Fun fact two: I played with Lego back then

    • @anonymousreviewer3816
      @anonymousreviewer3816 3 роки тому

      Ofcourse he did, why wouldn't he!
      (-_-) _Talk about setting frigging high expectations_

  • @aashsyed1277
    @aashsyed1277 3 роки тому +7

    3 blue 1 brown?????

  • @doctorb9264
    @doctorb9264 4 роки тому

    excellent presentation.

  • @williamcaldbeck
    @williamcaldbeck 5 років тому

    This is fantastic. Thank you

  • @arpitbahety5643
    @arpitbahety5643 3 роки тому +1

    Question: Consider we have a continuously decreasing function i.e. the value of the function decreases as we move away from the origin in the x-y plane. In such a case, the point that maximizes the function whilst satisfying the constraint won't be at the tanget, right (in the words of the video - where the two curves just kiss each other)?

    • @bendaniels7346
      @bendaniels7346 3 роки тому

      I believe it will, but only on one side

  • @sarfarazmemon2429
    @sarfarazmemon2429 7 років тому +7

    "shot ourselves in the foot by giving ourselves a new variable to deal with" :-)

  • @studyselection2881
    @studyselection2881 2 роки тому

    Why can we set the function to a constant and it is still a function? It should be a single point right?
    For example:
    x^2 + y = 10
    => x = some value
    and y is some value

  • @bfedkjwerfegregfrerg
    @bfedkjwerfegregfrerg 2 роки тому

    Little non-mathematical correction: Joseph-Louis Lagrange was Italian. Born in the Italian city of Turin with the name of Giuseppe Luigi Lagrangia and later naturalized as Fench.

  • @yavarjn2055
    @yavarjn2055 4 роки тому +1

    What tool do you use to have an interactive 3d graphics in the presentation?

  • @Lets_MakeItSimple
    @Lets_MakeItSimple 3 роки тому +1

    This lecture is created by our own Strand from 2 blue 1 brown

  • @andreasstolten9179
    @andreasstolten9179 Рік тому

    Often time the light modifier is in the frame or the background is uneven. I wonder how the finela pictures turn out.

  • @swarnavasinharoy7023
    @swarnavasinharoy7023 2 роки тому

    I almost forgot. 3B1B used to work for Khan Academy

  • @ericbischoff9444
    @ericbischoff9444 6 років тому

    I'm wondering hard why use a lambda constant to express proportionality, one could have used a determinant. Is it because of simpler computations ? because lambda has a meaning ? or is it purely historical that this approach has been preferred ?

  • @arslanhojiyev5996
    @arslanhojiyev5996 4 роки тому

    If it doesn't ask to maximize (or minimize), how can we know that it indeed maximizes (or minimizes) the given expression?

  • @AmitDotAcademy
    @AmitDotAcademy 8 місяців тому

    Nice video. Which tool do you use to generate the graph from equation ?

  • @YashPatel-vt8or
    @YashPatel-vt8or 2 роки тому

    Big Fan Grant Sanderson !!

  • @laraeldabet6299
    @laraeldabet6299 3 роки тому

    Thats nice, but how would we visualize it graphically if it was a minimization problem? So for maximization, it's when both graphs are tangent, what about minimization?

  • @praneelmadhuvanesh3770
    @praneelmadhuvanesh3770 Рік тому

    What if f got bigger as the contour lines got closer though? Then wouldn't the tangent point be where it is at its minimum?

  • @Shadowfax2
    @Shadowfax2 5 років тому

    Hi. If we imagine f(x,y) to be such that the contour lines of f(x,y) are lines parallel to the y-axis such that the contour line corresponding to the max f(x,y) is x=0. In that case, would this method apply all the same? g(x,y) and the constraint g(x,y) = 1 is assumed to be the same. Thanks!

    • @apoorvmishra6992
      @apoorvmishra6992 2 роки тому

      Did you get an answer?
      I'm struggling with the same question.

  • @blopotchok
    @blopotchok 5 років тому

    But here we are lucky because the two curve are tangent, what if it is
    not the case? I do not understand how we can generalize this for all
    constrained optimizations, though I know it is possible. For instance what if we want to optimize f on
    the set x²+(y-1)²=1? Then there are no tangency of the curves f(x,y)=c and
    x²+(y-1)²=1but still the langrangian method works. Some argument is missing
    here...

  • @carlossal04
    @carlossal04 3 роки тому

    What program are you using for those graphs????

  • @محمدالشهري-ظ2ك
    @محمدالشهري-ظ2ك 2 роки тому

    I am wandering why the direction of the gradient in the half below of the plan goes in the opposite direction? when you draw the vector gradient for g(x,y)=x^2+y^2 all the directions for the vectors of the gradient were going outward vector? why is that?

    • @carultch
      @carultch 2 роки тому

      Because the function has a local minimum at the origin on the x-y plane. All paths of steepest ascent lead away from this point. Thus, the gradient diverges at this point. The gradient diverges at every point on this particular function of g(x)=x^2+y^2 .

  • @pacchutubu
    @pacchutubu 3 роки тому

    if we eliminate y in f(x,y), using the circle equation, and then differentiate f(x,y(x)), won't that work?

  • @safooraranjbaran1466
    @safooraranjbaran1466 3 роки тому

    How can I find the first video of this series, please?

  • @richardfredlund3802
    @richardfredlund3802 3 роки тому

    i can see why Lagrange Multipliers works here because of tangency. What about if f(x,y)=3-y^2 ... then we know the maximum is on the line y=0 but this contour is NOT tangent to the constraint. (although you do still get the right answer if you apply the method). Why is this? Are there some functions this method won't work for? If so what is the condition?

  • @张梓良-f5e
    @张梓良-f5e Рік тому

    Great explanation, thanks for the efforts. For the interpretation(insight) on ∇f(x)=λ∇g(x) where x=[x1,x2,...,xn] is the solution for the extreme, is it because that such extreme only exist when the pulling force of the gradients are proportional to each other because they have the same tangent line? for example, if we expand the size of the circle g(x) in the original example, the original f(x) overlaps with g(x) at points where they have different tangent lines, which implies gradients on different directions on f and g correspondingly, which means that there is a space for improvement for f(x)? Can anyone help?

  • @ravipratapmishra7013
    @ravipratapmishra7013 4 місяці тому

    I don't get the part where two gradients are proportional, i do understand that they will be in same direction, but why they should be proportional to each other.

  • @focker0000
    @focker0000 5 років тому +1

    wow your voice is so familiar to me, and i just realize that it's you 3blue1brown!!!!

  • @karthik-ex4dm
    @karthik-ex4dm 6 років тому

    awesome video!

  • @ahnafinqiyadarko6841
    @ahnafinqiyadarko6841 3 роки тому

    Which playlist this video is part of?

  • @chandreshmaurya8102
    @chandreshmaurya8102 3 роки тому

    Anyone knows which software is used to draw the counter and gradients?

  • @jacobhm7429
    @jacobhm7429 5 років тому

    Is it possible to use f(x, y) = 1 as the third equation instead of the constraint, x² + y² = 1?
    edit: would this not give you 1/lambda?

    • @valeriuok
      @valeriuok 4 роки тому

      No. The contour line of f tangent to the unit circle is not of value 1. You may be tricked by the fact that the clip shows the contour lines of f extending in the same XY plane as the circle, but in fact they are extending upwards, in the Z direction. What you see are projections in the XY plane.

  • @Majestic469
    @Majestic469 5 років тому +1

    What happens if you have more than one constraint equation?

    • @ilyakulakov6484
      @ilyakulakov6484 5 років тому

      You have fewer possible points to consider for being a maxima.

  • @devkunjadia3792
    @devkunjadia3792 Рік тому

    awesome video