Ūrdhva-Tiryagbhyām
Vertically and crosswise
General multiplication for any two numbers — the 'Vedic multiplication' people know.
Any multiplication; especially efficient for 2- and 3-digit numbers done mentally.
For two 2-digit numbers ab × cd: rightmost digit = b·d; middle = a·d + b·c; leftmost = a·c. Carry as needed.
2-digit ab × cd: ac | ad + bc | bd, carrying from right to left.
Worked examples
Try it yourself
Try to solve, then reveal the steps one at a time.
Modern applications
Where this ancient technique still lives in today's world.
Schoolbook to Karatsuba
Vertically-and-crosswise is the schoolbook multiplication that big-integer libraries (GMP, Java BigInteger) optimise via Karatsuba and Toom–Cook.
Matrix dot products
The crosswise pattern is conceptually a 1D convolution / inner product — the building block of every neural network layer.
Code in your favourite language
Multiply any two numbers using vertical-and-crosswise digit by digit.
def urdhva(a: int, b: int) -> int:
sa = list(map(int, str(a)))[::-1]
sb = list(map(int, str(b)))[::-1]
n = len(sa) + len(sb)
out = [0] * n
for i, x in enumerate(sa):
for j, y in enumerate(sb):
out[i + j] += x * y
for k in range(n - 1):
out[k + 1] += out[k] // 10
out[k] %= 10
return int(''.join(map(str, out[::-1])).lstrip('0') or '0')
print(urdhva(56, 47)) # 2632Stuck? Ask the tutor.
Get a personal walkthrough of Ūrdhva-Tiryagbhyām with examples tuned to your question.
Open AI Tutor