Lagrange multipliers, using tangency to solve constrained optimization

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • Courses on Khan Academy are always 100% free. Start practicing-and saving your progress-now: www.khanacadem...
    The Lagrange multiplier technique is how we take advantage of the observation made in the last video, that the solution to a constrained optimization problem occurs when the contour lines of the function being maximized are tangent to the constraint curve.

Комментарии • 242

  • @Burneynator
    @Burneynator 7 лет назад +454

    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 3 года назад +1

      8.42 minutes , not 9

    • @Burneynator
      @Burneynator 3 года назад +9

      @@BROWNKEY Well, all the better

    • @rhn122
      @rhn122 3 года назад

      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 3 года назад

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

    • @mintylemon66
      @mintylemon66 4 месяца назад

      @@BROWNKEY I'd say 8.7 minutes

  • @hoodarrock2453
    @hoodarrock2453 7 лет назад +193

    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 7 лет назад +40

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

    • @jipuragi6483
      @jipuragi6483 Год назад

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

    • @astradrian
      @astradrian Год назад +8

      @@jipuragi6483 3Blue1Brown.

    • @jipuragi6483
      @jipuragi6483 Год назад +1

      @@astradrian thanks a ton

    • @bofa722
      @bofa722 Год назад

      ​@@jipuragi6483 bruh

  • @jonaqpetla_
    @jonaqpetla_ 7 лет назад +853

    Is that 3blue1brown? OMG!

    • @asadullahfarooqi254
      @asadullahfarooqi254 6 лет назад +40

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

    • @perfumedsea
      @perfumedsea 6 лет назад +53

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

    • @jinanlife
      @jinanlife 5 лет назад +24

      his iconic voice

    • @muhammadjoshua7464
      @muhammadjoshua7464 5 лет назад +3

      I was about to comment the same thing !

    • @BlackRose4MyDeath
      @BlackRose4MyDeath 5 лет назад +3

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

  • @eliasminkim
    @eliasminkim 2 года назад +22

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

  • @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.

  • @spencertaylor6910
    @spencertaylor6910 5 лет назад +41

    Grant hits that yeet again. What a boss

  • @saahilnayyer6865
    @saahilnayyer6865 3 года назад +1

    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 лет назад +14

    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 3 года назад +1

      thats what makes mathematics beautiful

  • @Cyrusislikeawsome
    @Cyrusislikeawsome 7 лет назад +2

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

  • @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!

  • @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.

  • @aashsyed1277
    @aashsyed1277 3 года назад +4

    3 blue 1 brown?????

  • @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.

  • @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 года назад +6

      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 2 года назад +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.

  • @tinayang7351
    @tinayang7351 6 лет назад +1

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

  • @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...

  • @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?

  • @mertbeser9837
    @mertbeser9837 2 года назад +1

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

  • @nahblue
    @nahblue 2 года назад +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 2 года назад

      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.

  • @mantacid1221
    @mantacid1221 3 месяца назад

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

  • @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.

  • @kylewolfe_
    @kylewolfe_ Год назад

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

  • @poiuwnwang7109
    @poiuwnwang7109 4 года назад +1

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

  • @gigglification
    @gigglification 5 лет назад +1

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

  • @ikhwanjeon7370
    @ikhwanjeon7370 3 года назад +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..

  • @luciafresnopm
    @luciafresnopm 3 года назад +4

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

    • @ahmednesartahsinchoudhury2628
      @ahmednesartahsinchoudhury2628 3 месяца назад

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

  • @jadedjimmy
    @jadedjimmy 5 лет назад +4

    6:26 pullin out that Sal impression

  • @learningindia6733
    @learningindia6733 Год назад +2

    Genius, real mathematics......

  • @wachulookingat
    @wachulookingat 9 месяцев назад

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

  • @Johncowk
    @Johncowk 4 года назад +1

    That was SO clear I cannot thank you enough.

  • @charliethatcher404
    @charliethatcher404 6 лет назад +1

    You legit just saved my test grade tomorrow. Cheers

  • @diannebanal1650
    @diannebanal1650 7 лет назад

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

  • @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??

  • @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.

  • @alias40anon
    @alias40anon 6 лет назад +1

    Mate you nailed it, excellent explanation

  • @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.

  • @ND-kl8lo
    @ND-kl8lo 6 месяцев назад

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

  • @AmitDotAcademy
    @AmitDotAcademy 4 месяца назад

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

  • @AAA-uv1ny
    @AAA-uv1ny Год назад

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

  • @GOPALS1967
    @GOPALS1967 4 года назад +1

    Beautifully explained.

  • @foadabodahood9509
    @foadabodahood9509 6 лет назад +1

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

  • @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!

  • @AngeloArrifano
    @AngeloArrifano 2 года назад

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

  • @guillermo._._
    @guillermo._._ 4 года назад

    Excellent geometric intuition!

  • @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 2 года назад

      I believe it will, but only on one side

  • @matlabmalayalam3288
    @matlabmalayalam3288 3 года назад +1

    World-class teaching...

  • @yavarjn2055
    @yavarjn2055 3 года назад +1

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

  • @queenstrategy904
    @queenstrategy904 4 года назад

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

  • @annang.3176
    @annang.3176 Месяц назад

    Beautiful explanation

  • @dennishuang3498
    @dennishuang3498 4 года назад

    Clear explanation ! Thanks for all your effort!

  • @samuelvaldezgil
    @samuelvaldezgil 2 года назад

    Im in love with this dude

  • @goclbert
    @goclbert 2 года назад

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

  • @christopherandrewmartin494
    @christopherandrewmartin494 2 года назад

    Very helpful. Thanks for all your videos!

  • @danawen555
    @danawen555 3 года назад

    thanks!!! very good and exhaustive explanation

  • @scoffer2150
    @scoffer2150 11 месяцев назад

    Thank you so much for this epic! Worth watching.

  • @leosin5767
    @leosin5767 Год назад

    3blue1brown deserves a Nobel Prize in math education

    • @skrgrnd
      @skrgrnd Год назад

      there's no nobel prize for math or education

  • @studyselection2881
    @studyselection2881 Год назад

    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

  • @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 ?

  • @ruralmetropolitan
    @ruralmetropolitan 7 лет назад +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 4 года назад

      He did end up finishing his life in France ;)

    • @OfficialAnarchyz
      @OfficialAnarchyz 4 года назад +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 3 года назад

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

  • @speedracer1702
    @speedracer1702 2 года назад

    Amazing explanation!

  • @Revetice
    @Revetice 7 лет назад

    very well explained and nice quality. thanks!

  • @benisbuff
    @benisbuff 7 лет назад +37

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

  • @ddos87
    @ddos87 4 года назад

    Khan crushing it as usual

  • @sarfarazmemon2429
    @sarfarazmemon2429 6 лет назад +7

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

  • @safooraranjbaran1466
    @safooraranjbaran1466 2 года назад

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

  • @williamcaldbeck
    @williamcaldbeck 4 года назад

    This is fantastic. Thank you

  • @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?

  • @tsrevo1
    @tsrevo1 7 лет назад

    Wow. excellent explanation.

  • @doctorb9264
    @doctorb9264 4 года назад

    excellent presentation.

  • @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?

  • @arslanhojiyev5996
    @arslanhojiyev5996 3 года назад

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

  • @gajrajsingh51
    @gajrajsingh51 3 года назад

    how are these videos made? like which software is used?

  • @thebullybuffalo
    @thebullybuffalo 5 лет назад

    Could you also do this but take the inner product of the gradient of f with g and setting it equal to zero?

    • @thebullybuffalo
      @thebullybuffalo 5 лет назад

      @Ar'Khan _ Khizarkhajul No. I think I'll post it on the math stack exchange. They usually answer quick. I'll post a link if they answer. I guess I could try it myself to see if I can get the same result but I'm too lazy

  • @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.

  • @ahnafinqiyadarko6841
    @ahnafinqiyadarko6841 3 года назад

    Which playlist this video is part of?

  • @carlossal04
    @carlossal04 3 года назад

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

  • @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?

  • @andreasstolten9179
    @andreasstolten9179 Год назад

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

  • @张梓良-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?

  • @blopotchok
    @blopotchok 4 года назад

    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...

  • @praneelmadhuvanesh3770
    @praneelmadhuvanesh3770 11 месяцев назад

    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?

  • @ravipratapmishra7013
    @ravipratapmishra7013 21 день назад

    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.

  • @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.

  • @queenstrategy904
    @queenstrategy904 4 года назад

    Lambda is the same thing as lagrange multiplier. Is lambda just a scalar for vectors?

    • @joshuaflackua
      @joshuaflackua 2 года назад

      I think it's just a tool to help us establish a relation in this case. However, you could definitely think about it as a vector multiplier if that makes more sense. After all, we do use the gradient vector to establish the relation.

  • @hadimulji
    @hadimulji 3 года назад

    Which software is that?

  • @mermaid6380
    @mermaid6380 5 лет назад

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

  • @AshutoshPatidarda24s006
    @AshutoshPatidarda24s006 18 дней назад

    is this Grand Sandorson?

  • @DennyMapleSyrup
    @DennyMapleSyrup 7 лет назад +4

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

    • @randomdude135
      @randomdude135 7 лет назад

      math1052??

    • @DennyMapleSyrup
      @DennyMapleSyrup 7 лет назад

      randomdude135 No I'm in high school :(

    • @randomdude135
      @randomdude135 7 лет назад +2

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

    • @DennyMapleSyrup
      @DennyMapleSyrup 7 лет назад +1

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

    • @amidg4x4
      @amidg4x4 7 лет назад +2

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

  • @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.

  • @alecmac6975
    @alecmac6975 Год назад

    You saved me for my Micro Econ test

  • @TheAryedemented
    @TheAryedemented 4 года назад

    Very helpful! Thank you! Do you have a video on least squares constrained by inequalities? I am struggling with it.

  • @Majestic469
    @Majestic469 5 лет назад +1

    What happens if you have more than one constraint equation?

    • @ilyakulakov6484
      @ilyakulakov6484 4 года назад

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

  • @shahabansari5201
    @shahabansari5201 3 года назад

    Simply beautiful...

  • @user-iv9sz8dx1g
    @user-iv9sz8dx1g 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 Год назад

      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 .

  • @karthik-ex4dm
    @karthik-ex4dm 5 лет назад

    awesome video!

  • @randomforrest9251
    @randomforrest9251 4 года назад

    Isn't g(x,y)=x²+y²-1 (which will Lead to the same gradient)

  • @swarnavasinharoy7023
    @swarnavasinharoy7023 2 года назад

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