Skip to content

Commit 24b721a

Browse files
authored
Merge pull request kodecocodes#291 from Zialus/patch-1
Fix mistake in the formula that simplifies to (a*d + b*c)
2 parents 313c4d3 + b40c3d6 commit 24b721a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Karatsuba Multiplication/README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Now, we can say:
6262

6363
This had been know since the 19th century. The problem is that the method requires 4 multiplications (`a*c`, `a*d`, `b*c`, `b*d`). Karatsuba's insight was that you only need three! (`a*c`, `b*d`, `(a+b)*(c+d)`). Now a perfectly valid question right now would be "How is that possible!?!" Here's the math:
6464

65-
(a+b)*(c+d) - a*c - b*c = (a*c + a*d + b*c + b*d) - a*c - b*c
65+
(a+b)*(c+d) - a*c - b*d = (a*c + a*d + b*c + b*d) - a*c - b*d
6666
= (a*d + b*c)
6767

6868
Pretty cool, huh?

0 commit comments

Comments
 (0)