Least Squares Approximation

Поділитися
Вставка
  • Опубліковано 7 лют 2025
  • MIT 18.06SC Linear Algebra, Fall 2011
    View the complete course: ocw.mit.edu/18...
    Instructor: Ben Harris
    A teaching assistant works through a problem on least squares approximation.
    License: Creative Commons BY-NC-SA
    More information at ocw.mit.edu/terms
    More courses at ocw.mit.edu

КОМЕНТАРІ • 65

  • @MrJKostyal
    @MrJKostyal 5 років тому +139

    "i'm gonna rush through this because you should know how to multiply by now"
    *does it wrong*
    LOL

  • @abdulaziz.j1505
    @abdulaziz.j1505 2 роки тому +22

    cut him some slack. it make me feel good sometimes that MIT students and professors makes silly mistakes which is normal by the way!!. the most important part is the learning process

  • @bridge5189
    @bridge5189 4 роки тому +85

    Thanks for this problem solving and the methodology presented, but there is an error in the solution during multiplication of A_transpose with A. This error accumulates over time in the solution and results in the wrong answer. The correct answer should be y= 5/22 x^2 + 41/22 x

    • @turokg1578
      @turokg1578 2 роки тому +6

      goat comment

    • @ACh389
      @ACh389 9 місяців тому

      Computation is something that everybody is supposed to do on their own. What one really cares about are the ideas implemented to solve a problem. The remaining things seems to be of second grade.

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

      Thanks for leaving the comment! I had a little different A and b (points in another order) and it's good to know i got to the right answer!

  • @rodolfo1654
    @rodolfo1654 4 роки тому +31

    Hello everyone! The answer to A^T A is 18 at the 2,2 entry

  • @JinxiLiu-e2b
    @JinxiLiu-e2b 7 місяців тому

    It's still a nice example, I've never thought concepts of linear algebra could come together like this

  • @almonteros
    @almonteros 6 років тому +57

    Where is the 10 coming from? Shouldn't it be 18?

    • @Rhinozekon
      @Rhinozekon 6 років тому +14

      Yes it should. The correct solution is then y = (41/22)*c + (5/22)*d^2. You can also see this if you plot both equations against the given points.

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

      @@Rhinozekon y=(81/22)*c + (-25/22)*d^2

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

    I was not really doubting myself but I did not like it. This guy should know, right?! Anyway, answers I got were : C = 41/22 & D = 5/22.
    Thank you all!!!!!

  • @mllo2003
    @mllo2003 6 років тому +12

    This is a nice example. But it's a pity that there seems to an calculation error In the derivation of the projection matrix There should be an 18 instead of 10 in the matrix. And C and D should be 41/22 and 5/22, leading to (e1, e2, e3)=(-12/11, 4/11, -4/11) if my calculation is correct. If, as calculated in the video, C and D were indeed 11/2 and -5/2, then you would have (e1, e2, e3)=(-2, 4, 6). That didn't look like a "least mean square error".

    • @anyangli918
      @anyangli918 4 роки тому +3

      Correct! Right answer should be b = 5/22 x^2 + 41/22

  • @AbhishekYadav-bu9pb
    @AbhishekYadav-bu9pb 3 роки тому +4

    y = 2.3*x - 0.1*x^2 fits much more correctly.

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

    A'A would result in (6 8; 8 18).

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

    Correct me if I'm wrong, but isn't an equation of the form ax^2 + bx + c = 0, isn't y = ax^2 + bx + c just a quadratic function. I know it should be obvious, but it threw me off a bit, I wrote the equation and realized quickly that only two values of x were even possible :D

    • @ИльяЛомоносов-ю3м
      @ИльяЛомоносов-ю3м 4 роки тому +1

      This quadratic function goes through the origin, so c must be zero (there is no shift).

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

      @@ИльяЛомоносов-ю3м Why? Linear has a non-zero intercept, why not quadratic? the three points fits perfectly(0 error)

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

      @@faizanmansoori The definition of the problem says "find a quadratic equation *through the origin*"

    • @federicopinto9353
      @federicopinto9353 7 днів тому

      @@maxim_ml with no intercept it still goes through the origin at t =0, the wording should be clearer

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

    I got the same answer, he made an error accidentally

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

    There is a computation error in one of the steps. Final answer should be: (82/44, 10/44).
    To verify:
    import numpy as np
    from numpy.linalg import lstsq
    # Given points
    points = np.array([(1, 1), (2, 5), (-1, -2)])
    # Separate x and y values
    x = points[:, 0]
    y = points[:, 1]
    # Set up the design matrix for a quadratic fit y = ax^2 + bx
    X = np.vstack([x, x**2]).T
    # Perform least squares fitting
    coefficients, _, _, _ = lstsq(X, y, rcond=None)
    print(coefficients)
    print(np.round([82/44, 10/44], 8))
    Output:
    [1.86363636 0.22727273]
    [1.86363636 0.22727273]

  • @the_eternal_student
    @the_eternal_student 5 місяців тому

    What 3 points is he talking about at the end?

  • @MVerma-g1j
    @MVerma-g1j 4 місяці тому

    I am still not able to get why we took square of 1st column as the 2nd column in A

    • @zaink6652
      @zaink6652 Місяць тому

      because the equation was cx+dx^2 so for matrix a second column will be all values of first column squared to satisfy c and d.

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

    Problem13 . If e components of e=b−Ax averages to zero, then so does ( A^T * A)^(−1) * A^T * e. Why?

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

    why not make it a quadratic in the form of ax^2 + bx + c?
    instead of coefficients of only the 2nd and 1st power

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

      because the curve is through the origin thus C the y-intercept is zero

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

    UA-cam comments to the rescue. I thought I was going insane.

  • @Izma-ku8ms
    @Izma-ku8ms 10 місяців тому

    Will be always take square of first elements of A?

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

    shouldn't have rushed A transpose A

  • @Abhi-qi6wm
    @Abhi-qi6wm 4 роки тому

    Isn't it supposed to be x and not x-hat at 3:35? My reasoning is cause x-hat is the best answer we can get and x is the perfect answer.

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

    @ 5:17, it should be 18, not 10.

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

    Ehren Mann

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

    yes, 10 should be 18, and the correct formula is y=(81/22)*c + (-25/22)*d^2

    • @chotirawee
      @chotirawee 4 роки тому +5

      I think it's more like
      [6 8; 8 18] [c; d] = [13; 19]
      then c = 41/22
      d = 5/22
      y = (41/22)*t + (5/22)*t^2

    • @RaselAhmed-ix5ee
      @RaselAhmed-ix5ee 4 роки тому

      @@chotirawee how did you get that 41 please explain

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

      ​@@RaselAhmed-ix5ee it's taken as
      Eq1 and eq 2 for c and d variables.
      Where it gets the answer by using substitution.

    • @RaselAhmed-ix5ee
      @RaselAhmed-ix5ee 3 місяці тому

      @@shironoyami7002 thanks for the quick reply, I am father now not a student anymore

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

      @@RaselAhmed-ix5ee bro I just saw it by chance now.
      I searched it up because tomorrow is my exam.I tried to search answer too because I didn't understand like how you were back then.
      And I leave an answer simply for someone else to read it instead of the purpose of replying to your question....
      Congrats man.👏

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

    Why did he choose the quadratic function?

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

    how to choose what kind of equation that is?

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

      quadratic means y=ax²+bx+c
      through the origin means y(0)=0 so c=0

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

    MIT lectures >>>>>> anyone else tryna teach

  • @eduardosdelarosa5539
    @eduardosdelarosa5539 5 років тому +10

    He reminds me a person that i used to bully.

    • @nicksaba3882
      @nicksaba3882 4 роки тому +19

      And yet, he now has a Ph.D. from MIT and is now a professor of at Cornell, and you're... not.

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

      @@nicksaba3882 i'm happy XD

    • @jonpol770
      @jonpol770 3 роки тому +11

      Haha Eduardo trying to be hard on youtube while this lecturer is now a Prof at a prestigious university. Giad you're happy though Eddy x

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

      @@jonpol770 if he has now phd in his field that just makes more to bully not less lol

    • @kingplunger1
      @kingplunger1 5 місяців тому

      You are pathetic

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

    n3rd