SlideShare a Scribd company logo
4
Most read
5
Most read
7
Most read
KARATSUBA
ALGORITHM
FOR FAST
MLTIPLICATION
CONVENTIONAL METHOD OF MULTIPLICATION AND ITS
COMPLEXITY
 The Naive approach for multiplication is the process that we study in school.
 Conventional method of n digit multiplication total n*n=n2 multiplication is required.
let’s take an example of 2-digit multiplication…
6 5 * 9 7 == 6 3 0 5
 Here first 7 is multiplied by 5 and then 6. It makes two multiplication.
 Again 9 is multiplied by 5 and then 6. It also make two multiplication.
So, total multiplication required is 4.
As we can say n*n=n2 multiplication is required.
KARATSUBA MULTIPLICATION
 This algorithm reduces the number of multiplication comparing to conventional method of
multiplication.
 Using Divide and Conquer, we can multiply two integers in less time complexity. We divide
the given numbers in two halves. Let the given numbers be X and Y.
Let, X = 1 2 3 4
Y = 9 8 7 6 Here n = 4
Here we divide the number into two halves
a = 1 2 b = 3 4
c = 9 8 d = 7 6
Here we can write X and Y as..
X = a*10n/2 + b Y = c*10n/2 + d
Let’s multiply X and Y
X * Y = (a*10n/2 + b ) (c*10n/2 + d)
= (10n)ac + (10n/2)(ad + bc) + bd
Here in each step of recursive call we are performing 4 extra multiplication and two extra atomic
addition.
In each step two chopped number is passed to recursive function whose length reduces to ½
times each steps.
Overall function becomes
M(n) = 4M(n/2) + O(n) (two atomic addition performs in each steps).
The tricky part of this algorithm is to change the middle two terms to some other form so that
only one extra multiplication would be sufficient.
Here we can write
ad + bc = (a + b) (c + d) – ac – bd
We are reducing one extra multiplication and now our function becomes….
M(n) = 3M(n/2) + O(n)
By doing this we are performing 3 extra multiplications of size n/2 in each step.
Using the master theorem on the above recurrence yields that the running time of the Karatsuba algorithm
is Θ(nlog
2
3) ≈ Θ(n1.585) which is less than n2.
COMPLEXITY OF KARATSUBA ALGORITHM
Notice that each time digit is reduced by ½ times the previous ones , thus we can write…
n = 2k
log2n = k log22
k = log2n
For conventional multiplication 4k = 4log
2
n = 2(log 4)(log n) =n(log 4) = n2
For karatsuba multiplication 3k = 3log
2
n = 2(log 3)(log n) = n(log 3) = n1.584…
As we can see that complexity of multiplication reduced to n1.584…

More Related Content

PPTX
Stressen's matrix multiplication
PPTX
Divide and Conquer - Part 1
PPT
Design and Analysis of Algorithms
PPT
Divide and Conquer
PPTX
Greedy Algorithms
PPTX
Analysis of algorithm
PDF
Iterations and Recursions
PPTX
Matrix chain multiplication
Stressen's matrix multiplication
Divide and Conquer - Part 1
Design and Analysis of Algorithms
Divide and Conquer
Greedy Algorithms
Analysis of algorithm
Iterations and Recursions
Matrix chain multiplication

What's hot (20)

PPT
08 multiplexing
PPT
Computer architecture pipelining
PPTX
Semantic nets in artificial intelligence
PPTX
Presentation on Flip Flop
PPT
Divide and conquer
PPTX
Divide and conquer - Quick sort
PPTX
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
PPT
Chapter 03 cyclic codes
PPTX
Multicast routing
PPT
Primitive Recursive Functions
PPTX
asymptotic notation
PPTX
Booth’s algorithm.(a014& a015)
PPTX
Predicate logic
PDF
COMPILER DESIGN- Syntax Directed Translation
DOC
Unit 3 daa
PPTX
Asymptotic notations
PPT
All-Reduce and Prefix-Sum Operations
PPT
Floating point arithmetic
PPTX
Galois field
08 multiplexing
Computer architecture pipelining
Semantic nets in artificial intelligence
Presentation on Flip Flop
Divide and conquer
Divide and conquer - Quick sort
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
Chapter 03 cyclic codes
Multicast routing
Primitive Recursive Functions
asymptotic notation
Booth’s algorithm.(a014& a015)
Predicate logic
COMPILER DESIGN- Syntax Directed Translation
Unit 3 daa
Asymptotic notations
All-Reduce and Prefix-Sum Operations
Floating point arithmetic
Galois field
Ad

Similar to Karatsuba algorithm for fast mltiplication (20)

PPT
L6_Large_number_multi.ppt large number multiplication
PPTX
Data structure and algorithm presentation.pptx
PPT
Project PPT slides_student_id#104519347
PDF
02 Notes Divide and Conquer
PDF
02 Analysis of Algorithms: Divide and Conquer
DOC
pradeepbishtLecture13 div conq
PPTX
DAA - UNIT 4 - Engineering.pptx
PPTX
Vedic ganit
PDF
Quicker maths
PDF
Maths formula by viveksingh698@gmail.com
PDF
Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...
PDF
A study on number theory and its applications
PPT
numbersenseforbeginnersandadvancedtricks.ppt
PDF
CS330-Lectures Statistics And Probability
PPT
Lecture11_12COMPILER DESIGN_unit 2COMPILER DESIGN_unit 2.ppt
PPTX
Computer Science study slides on Recursion
PPT
Vedicmaths
PPTX
Speed Maths | Learn Speed Maths | Speed Maths Trick | Mdfaisal.com
PDF
Algebra 6
PDF
Vedic maths
L6_Large_number_multi.ppt large number multiplication
Data structure and algorithm presentation.pptx
Project PPT slides_student_id#104519347
02 Notes Divide and Conquer
02 Analysis of Algorithms: Divide and Conquer
pradeepbishtLecture13 div conq
DAA - UNIT 4 - Engineering.pptx
Vedic ganit
Quicker maths
Maths formula by viveksingh698@gmail.com
Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...
A study on number theory and its applications
numbersenseforbeginnersandadvancedtricks.ppt
CS330-Lectures Statistics And Probability
Lecture11_12COMPILER DESIGN_unit 2COMPILER DESIGN_unit 2.ppt
Computer Science study slides on Recursion
Vedicmaths
Speed Maths | Learn Speed Maths | Speed Maths Trick | Mdfaisal.com
Algebra 6
Vedic maths
Ad

Recently uploaded (20)

PPT
Project quality management in manufacturing
PPTX
Sustainable Sites - Green Building Construction
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
composite construction of structures.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
PPT on Performance Review to get promotions
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
web development for engineering and engineering
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Welding lecture in detail for understanding
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
DOCX
573137875-Attendance-Management-System-original
Project quality management in manufacturing
Sustainable Sites - Green Building Construction
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
CH1 Production IntroductoryConcepts.pptx
composite construction of structures.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT on Performance Review to get promotions
Internet of Things (IOT) - A guide to understanding
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
web development for engineering and engineering
Embodied AI: Ushering in the Next Era of Intelligent Systems
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Foundation to blockchain - A guide to Blockchain Tech
additive manufacturing of ss316l using mig welding
Welding lecture in detail for understanding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
573137875-Attendance-Management-System-original

Karatsuba algorithm for fast mltiplication

  • 2. CONVENTIONAL METHOD OF MULTIPLICATION AND ITS COMPLEXITY  The Naive approach for multiplication is the process that we study in school.  Conventional method of n digit multiplication total n*n=n2 multiplication is required. let’s take an example of 2-digit multiplication… 6 5 * 9 7 == 6 3 0 5  Here first 7 is multiplied by 5 and then 6. It makes two multiplication.  Again 9 is multiplied by 5 and then 6. It also make two multiplication. So, total multiplication required is 4. As we can say n*n=n2 multiplication is required.
  • 3. KARATSUBA MULTIPLICATION  This algorithm reduces the number of multiplication comparing to conventional method of multiplication.  Using Divide and Conquer, we can multiply two integers in less time complexity. We divide the given numbers in two halves. Let the given numbers be X and Y. Let, X = 1 2 3 4 Y = 9 8 7 6 Here n = 4 Here we divide the number into two halves a = 1 2 b = 3 4 c = 9 8 d = 7 6
  • 4. Here we can write X and Y as.. X = a*10n/2 + b Y = c*10n/2 + d Let’s multiply X and Y X * Y = (a*10n/2 + b ) (c*10n/2 + d) = (10n)ac + (10n/2)(ad + bc) + bd Here in each step of recursive call we are performing 4 extra multiplication and two extra atomic addition. In each step two chopped number is passed to recursive function whose length reduces to ½ times each steps. Overall function becomes M(n) = 4M(n/2) + O(n) (two atomic addition performs in each steps).
  • 5. The tricky part of this algorithm is to change the middle two terms to some other form so that only one extra multiplication would be sufficient. Here we can write ad + bc = (a + b) (c + d) – ac – bd We are reducing one extra multiplication and now our function becomes…. M(n) = 3M(n/2) + O(n) By doing this we are performing 3 extra multiplications of size n/2 in each step.
  • 6. Using the master theorem on the above recurrence yields that the running time of the Karatsuba algorithm is Θ(nlog 2 3) ≈ Θ(n1.585) which is less than n2.
  • 7. COMPLEXITY OF KARATSUBA ALGORITHM Notice that each time digit is reduced by ½ times the previous ones , thus we can write… n = 2k log2n = k log22 k = log2n For conventional multiplication 4k = 4log 2 n = 2(log 4)(log n) =n(log 4) = n2 For karatsuba multiplication 3k = 3log 2 n = 2(log 3)(log n) = n(log 3) = n1.584… As we can see that complexity of multiplication reduced to n1.584…