All techniques
Sūtra 3 of 16

Ūrdhva-Tiryagbhyām

Vertically and crosswise

General multiplication for any two numbers — the 'Vedic multiplication' people know.

When to use

Any multiplication; especially efficient for 2- and 3-digit numbers done mentally.

How it works

For two 2-digit numbers ab × cd: rightmost digit = b·d; middle = a·d + b·c; leftmost = a·c. Carry as needed.

Memory formula

2-digit ab × cd: ac | ad + bc | bd, carrying from right to left.

Worked examples

Problem 1
23 × 41
0/4
    Problem 2
    62 × 78
    0/4

      Try it yourself

      Try to solve, then reveal the steps one at a time.

      easy
      Compute 21 × 32
      medium
      Compute 56 × 47

      Modern applications

      Where this ancient technique still lives in today's world.

      Coding

      Schoolbook to Karatsuba

      Vertically-and-crosswise is the schoolbook multiplication that big-integer libraries (GMP, Java BigInteger) optimise via Karatsuba and Toom–Cook.

      AI / ML

      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.

      Python
      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))  # 2632

      Stuck? Ask the tutor.

      Get a personal walkthrough of Ūrdhva-Tiryagbhyām with examples tuned to your question.

      Open AI Tutor