Every time a UPI payment is made by scanning a QR code, a highly advanced mathematical process unfolds in less than a second. What appears to be a simple black-and-white square printed on paper actually contains some of the world’s most sophisticated error correction and data-processing mathematics.
From roadside tea stalls to supermarkets and pharmacies, QR codes have become the backbone of India’s digital payment ecosystem. Today, India processes more than 18 billion UPI transactions every month, with millions of them beginning through QR code scans.
The QR code, or Quick Response code, was invented in 1994 by Masahiro Hara of Denso Wave, a subsidiary of Toyota. Unlike traditional barcodes that store information in a single horizontal direction, QR codes store information both vertically and horizontally, allowing them to hold significantly more data.
A standard barcode stores roughly 20 characters, while a QR code can store up to 7,089 numeric characters or 4,296 alphanumeric characters. This increased storage capacity later made QR codes ideal for digital payments and online transactions.
When a user scans a QR code through a UPI app, the phone camera first identifies 3 large square patterns located in the corners of the code. These are known as finder patterns and help the device determine the code’s size, orientation, and alignment, even if the code is tilted or partially damaged.
The scanner then digitally corrects the image through a process called inverse perspective transformation, which straightens the scanned image before reading the actual data.
One of the most remarkable aspects of QR technology is its ability to work even when codes are faded, scratched, folded, or partially hidden. This reliability comes from a mathematical system called Reed-Solomon error correction, originally developed in 1960 at MIT Lincoln Laboratory.
The system adds extra backup data inside the QR code itself. If part of the code is damaged, the scanner reconstructs the missing information mathematically, allowing the payment to still go through successfully.
QR codes support different levels of error correction. The highest level can recover up to 30% of damaged or unreadable data.
Another hidden feature is masking, where mathematical patterns are applied to distribute black and white squares evenly. This improves readability for cameras under different lighting conditions and prevents scanning failures.
The same mathematical principles used in QR codes are also applied in spacecraft communication systems, CDs, and deep-space data transmission technologies.
Despite appearing simple, the small QR code placed at shop counters across India represents one of the most practical and powerful uses of mathematics in modern digital life.
Also read: Viksit Workforce for a Viksit Bharat
Do Follow: The Mainstream LinkedIn | The Mainstream Facebook | The Mainstream Youtube | The Mainstream Twitter
About us:
The Mainstream is a premier platform delivering the latest updates and informed perspectives across the technology business and cyber landscape. Built on research-driven, thought leadership and original intellectual property, The Mainstream also curates summits & conferences that convene decision makers to explore how technology reshapes industries and leadership. With a growing presence in India and globally across the Middle East, Africa, ASEAN, the USA, the UK and Australia, The Mainstream carries a vision to bring the latest happenings and insights to 8.2 billion people and to place technology at the centre of conversation for leaders navigating the future.


