Lecture 11: Integer Arithmetic, Karatsuba Multiplication

Поделиться
HTML-код
  • Опубликовано: 13 янв 2013
  • MIT 6.006 Introduction to Algorithms, Fall 2011
    View the complete course: ocw.mit.edu/6-006F11
    Instructor: Srini Devadas
    License: Creative Commons BY-NC-SA
    More information at ocw.mit.edu/terms
    More courses at ocw.mit.edu

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

  • @xpickles
    @xpickles 6 лет назад +89

    "this is one of those things where if you were born early enough you get your name on an algorithm" damn why you gotta throw shade on my boy karatsuba like that

    • @avatar098
      @avatar098 4 года назад +13

      The amount of salt in his blood is too damn high! xD

    • @Artaxerxes.
      @Artaxerxes. 2 года назад

      Is it true tho. Do we no longer give names to new algorithms. ifaik if scientist Z comes with a new algo, we call it Z algo

    • @xpickles
      @xpickles 2 года назад +4

      ​@@Artaxerxes. He's saying the algorithm was easy, anyone born early enough could've been the first to come up with it.

  • @sergeykholkhunov1888
    @sergeykholkhunov1888 2 года назад +25

    02:56 irrationals
    06:56 Catalan numbers (fun digression)
    18:08 Newton's method
    24:12 quadratic convergence
    32:52 high precision multiplication
    38:02 Karatsuba algorithm
    42:13 demo: fun geometric problem
    Spoiler: plot twist in demo is related to Catalan numbers.

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

      1234. 03 05.07 05
      5678 11 13 15 13
      33 65 105. 65. And so forth
      05 12 21 33

  • @prateeksinghal630
    @prateeksinghal630 4 года назад +39

    Dr Devadas reminds me of Sheldon Cooper whenever he laughs XD

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

      He even laughs in a similar way :J (21:12)

  • @SaisankarGochhayat
    @SaisankarGochhayat 6 лет назад +41

    Karatsuba starts at 33:54

  • @productivelb
    @productivelb 6 лет назад

    Cool demo - I have seen it many times in this lecture and still amazed!

  • @mingyulu6029
    @mingyulu6029 8 лет назад +12

    He's so much more fun in this class

  • @PamirTea
    @PamirTea 6 лет назад +18

    46:17 What a twist!

  • @nyc132132
    @nyc132132 10 лет назад +36

    36:49 error Z2 = X2*Y2 - should be z2 = x1*y1 .. also 2^log(3) is a transcendental number and not just irrational

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

      I read your comment after 6 years, thank you

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

      Haha thanks. Glad I'm not the only one who sees that

  • @alpers.2123
    @alpers.2123 3 года назад +2

    Speaking from 2020! Multiplication is now proved to be computable in nlogn time complexity

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

      You're from the future? What's it like in 2020!?

  • @tentotheace
    @tentotheace 5 лет назад +22

    After all the great lectures up to this point, this is a truly confusing and incoherent one.
    Let's hope Victor clears things up :)

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

      my exact thoughts, I think this is more theory and textbook based from their class

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

      Exactly! It was all skimming over topics and no dots connected, took a lot of effort to make sense of simple things! Maybe they crammed too much stuff into a single lecture!

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

    Catalan number thing is dope! Pretty cool lecture.

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

    Last 2 mins blew my mind. Numbers are MindBlowing 🤯🤯🤯🤯🤯🤯🤯🤯🤯

  • @MichalCanecky
    @MichalCanecky 11 лет назад +4

    40:00 z2 supposed to be x1y1 not x2y2, x2, y2 are undefined

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

    Ok, completely blown away in the last 5 mins, not gonna lie!

  • @letMeSayThatInIrish
    @letMeSayThatInIrish 9 лет назад +6

    3:05 Among the Pythagoreans, Hippasus was likely the first to realize some numbers where not rational. According to legend he discovered this at sea, and his fellow pythagoreans responded by throwing him overboard.

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

      Pythagoreans knew about irrational numbers all well. They knew the square root of 2, the golden ratio, and they used the pentagram (full of irrational golden ratios) as their secret sign. What they drowned Hippasus for was not for discovering irrational numbers, but for revealing the secret to the non-initiated.

  • @NadineDeHope
    @NadineDeHope 9 лет назад +33

    wow, cool end of the lecture

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

      Yes, wow, I didn't see this coming, really amazing!

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

      whas that catalan numbers showing up?

  • @jurian0101
    @jurian0101 11 лет назад

    x-Sqr(x^2-1)==1/(x+Sqr(x^2-1)~1/2x in this case, it's about 1E-12.

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

    Thank you MIT.

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

    Professor’s shirt is glittering in video 💥

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

    Love your concern towards india🇮🇳

  • @mohabmetwally5749
    @mohabmetwally5749 8 лет назад +29

    if don't know about catalan numbers.
    at 6:30 pause the video and read this en.wikipedia.org/wiki/Catalan_number he is terrible in this part. better read wikipedia .

    • @johnhart1790
      @johnhart1790 6 лет назад

      The student that said C_1*C_1 was correct.

    • @johnhart1790
      @johnhart1790 6 лет назад

      According to the definition on page 61 of Peter Cameron's book. Ok the two definitions are slightly different.
      The Catalan of Cameron's book C_n = C_(n-1) of the lecture.

    • @MrMrVV
      @MrMrVV 5 лет назад +5

      go to ruclips.net/video/eoofvKI_Okg/видео.html start from minute 2:00 and you find great explanation

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

      Thanks!

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

      maybe it's a matter of style, but I find it a lot easy to grok something if I'm given examples first then generalised with a method/proof/formal definition.. rather than starting with a formal definition then using it to build examples.. like.. just draw a few examples of balanced pairs of brackets 1 = () 2 = ()(), (()) 3 = ((())), ()(()), (())(), (()()), ()()() etc and I think I would have gotten it a lot easier than trying to define alpha and beta which I still don't get :V now it's suddely popping up everywhere especially binary trees

  • @rotariuandreilucian6572
    @rotariuandreilucian6572 11 лет назад +1

    i head about MIT ...what a big peace of chulck

  • @EranM
    @EranM 4 года назад +4

    46:30 THIS IS WITCH CRAFT!! How the hell did he get the catlan numbers in there!!! Sorcery !!!

  • @MrNoBody114
    @MrNoBody114 11 лет назад +13

    magic design shifting shirt

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

    "42 is on the list!"
    That was very funny.

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

    Now that is some sorcery at the end of lecture.

  • @64standardtrickyness
    @64standardtrickyness 4 года назад

    when you break up into 3 chunks why are you trying to get away with less than 8 multiplications ? I think it should be 9 (100a+10b+c )(100d +10e+f) involves ad,ae,af, bd,bd,bf, cd,ce,cf or it should be 5 as log(6)/log(3)>1.58

  • @SuryaTripathi
    @SuryaTripathi 7 лет назад +22

    16:34 : I came in early.. lol

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

    At MIT, "five hundred thousand" equals "five hundred billion".

  • @user-hk5dl6bv6m
    @user-hk5dl6bv6m 8 лет назад +15

    I was so X[i]-ted

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

    thank you sir.

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

    i have problem understanding from 33:39 onwards

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

    qudratic convergence using newton methos

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

    37:31, 39:00 z2 = x2*y2 should be z2 = x1*y1

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

    Let's see if the professor was right.
    >>> def cn(x):
    ... if x < 2: return 1
    ... sum = 0
    ... for k in range(x):
    ... sum = sum + cn(k)*cn(x-1-k)
    ... return sum
    ...
    >>> cn(2)
    2
    >>> cn(3)
    5
    >>> cn(4)
    14

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

    I like this guy... !
    [with the observation that the original (long) 3x3 split would need 9 dm (digit multiplications), not 8 :P (and you can multiply them in only 6 dm, see karatsuba on wiki, asymmetric formulae), which is just a bit better than 2x2 split (where you make 6 dm instead of 8 dm). Toom-3 can get 5 dm instead of 9 dm in that case, etc (see Toom-Cook on wiki).]

  • @1732ashish
    @1732ashish 3 года назад

    anyone knows any link where I can read about the appearance of catalan numbers in the last circle calculation?

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

      start learning Discreate math

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

      www.afjarvis.staff.shef.ac.uk/maths/jarvisspec01.pdf see generating function here. A very enlightening read.

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

    3:30 Hindu-Arabic numerals are more important than Pythagoras' triangle theorem, so there's that.

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

    I hope you all recovered from the quiz LOL

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

    Excellent lecture ( except for initial explanation of Catalan numbers ) - great teaching nevertheless

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

    God I want to be in the class of Srini Devadas

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

    goog ting ur middle shool hs teachers arent her elik eim so gladdd

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

    this lecture was directed by christopher nolan lol(last min was more than crazy)

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

    his shirt is giving my phones gpu tough time

  • @wilhelm.reeves
    @wilhelm.reeves 5 лет назад

    what is this? some kinda genjutsu!

  • @florianwicher
    @florianwicher 6 лет назад +2

    His shirt is trippy... :D

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

      It's like when you take a picture of the computer screen~ :p

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

    36:49

  • @AbhishekTyagi1994
    @AbhishekTyagi1994 11 лет назад +1

    didn't know professors could really make u laugh =D

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

    I am a bit surprised that the professor keeps questioning the existence of irrational numbers throughout this lecture, as if advances in computing could in the future reveal a cycle in, say sqrt(2) [sure old Pythagoras would have been delighted if such a hope had ever existed]. If there is one thing I learned from 6.042 (also in youtube), is that what makes mathematical proof superior to other proof methods, like the scientific method, is that you can prove propositions about numbers once and for all without having to enumerate any concrete numbers, just by a chain of logical deductions starting from a set of axioms; such proofs are theorems. As an example, there was a proof by contradiction of the irrationality of sqrt(2) in one 6.042 lecture, apparently the same that was already known by the pythagoreans, which as I have said, must be independent of any advances in computation, by definition of mathematical proof. Have I missed anything? Of course, maybe my mistake is believing that not having a cycle (definition given in this lecture) is the same as claiming that then a number cannot be expressed as the fraction of two whole numbers, which is how irrational numbers were defined in 6.042.

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

    how did he get the derivative at 22:09?

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

      He used the formula for the tangent

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

    #properties#Soll#Liebe#schönen#Highlight#Episode#awarded Liebe und zu Videos#so#schönes#

  • @rasraster
    @rasraster 6 лет назад +5

    Catalan number explanation is the worst explanation he's given of anything in this course.

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

      its not really related to this video (except for the end part). That's why he did not emphasize it that much.

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

    #POW

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

    The problem with his exposition in this lecture is how he abstract the concept even before the viewers know what he will do. For example is when he introduced the high precision multiplication, he started pulling random variables z_2, z_1, z_0, without any context instead of showing how x times y would lead to the derivation of their values:
    x*y = (r^(n/2) * x_1 + x_0) (r^(n/2) * y_1 + y_0)
    = (r^(n) * x_1 * y_1) + (r^(n/2)(x_1*y_0 + x_0*y_1)) + (x_0*y_0) [through the distributive property]
    which is the values of z_2, z_1, z_0 summed up with each other, i.e.:
    x*y = (r^n * z_2) + (r^(n/2) * z_1) + z_0.
    If you want to better understand Karatsuba Algorithm, I highly recommend this video: ruclips.net/video/JCbZayFr9RE/видео.html

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

    4862

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

    That wasn't the smartest choice for a shirt :J

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

    🙏🙏🙏💞💓💞👍🐉

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

    Are these Catalan numbers of any real importance? Hmmmmmmm - I don't think so, but who knows.

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

      Are these big intergers of any real importance? I don't know.

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

      But I'm very surprised, that such fast algorithms exist.

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

      Maybe, because of RSA.

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

    How can I CS professor at MIT make such a glaring mistake? It can be proved that square root(2) can never have repeating patterns, because it can never be expressed as (p/q) where p,q are integers. That's elementary stuff which we learned at school. Quality of education at US universities must be really going down.

    • @jsh31425
      @jsh31425 2 года назад +4

      He didn't say "repeating patterns." He said "patterns." Irrational numbers can have plenty of patterns.
      For instance, 0.123456789101112131415161718192021...

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

    Sadly not many people these days understand the significance of 42

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

    If you want to save nearly 40 minutes of your life, the actual Karatsuba multiplication is as far as at 38:19 :P
    But if you want to save even more, skip this video entirely and go somewhere else, because this dude's explanation is terribly bad :P

    • @MrMrVV
      @MrMrVV 5 лет назад +2

      and I thought I was the only one not undrestanding what he is talking about!

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

      I haven't finished all the videos but so far this lesson is the most difficult one for me.

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

      Yeah I think he didnt do a good job in this lecture , thanks.

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

    He is not as good as Erik