Zero-Knowledge Proofs Explained: Examples and Math

Quick answer: A zero-knowledge proof (ZKP) is a cryptographic method for proving a claim without revealing the secret information behind it. For example, you can prove you know a password without disclosing it, or that you are over 18 without revealing your birthdate. In the classic cave example, someone who does not know the secret has at most a 1/2 chance of passing each independent challenge, so passing 20 rounds by luck has a chance of 1 in 1,048,576. Modern systems such as zk-SNARKs compress the whole exchange into one short proof that anyone can check.

Facts checked November 22, 2026.

Can you prove you know a secret without telling anyone what it is? It sounds impossible, like proving you know the answer to a puzzle without saying the answer. In 1985, Shafi Goldwasser, Silvio Micali and Charles Rackoff showed it can be done, and the idea, the zero-knowledge proof, earned Goldwasser and Micali the 2012 Turing Award. Today it protects digital identities, blockchains and even sensitive quantum-computing research.

The Three Properties

PropertyMeaning
CompletenessIf the statement is true, an honest prover convinces the verifier
SoundnessIf it is false, a cheater fails, except with tiny probability
Zero knowledgeThe verifier learns nothing except that the statement is true

The Cave Story

The classic explanation, from a 1989 paper by Jean-Jacques Quisquater and colleagues titled “How to Explain Zero-Knowledge Protocols to Your Children,” uses a ring-shaped cave. The cave has two paths, A and B, that meet at a magic door deep inside. Peggy claims she knows the password that opens the door. Victor wants proof, but Peggy will not tell him the password.

  1. Victor waits outside while Peggy walks in down path A or B, chosen at random.
  2. Victor walks to the fork and shouts which path he wants her to come back on: A or B.
  3. If Peggy knows the password, she can always come back the requested way, opening the door if needed.

A cheater who does not know the password can only succeed if Victor happens to call the path she already took: probability \(\tfrac{1}{2}\). Repeat the game, and the chance of fooling Victor every time shrinks fast.

The Math: Why Cheating Becomes Hopeless

Each round is an independent challenge, so a cheater’s chance of passing \(n\) rounds is

\[ P(\text{cheater passes}) = \left(\tfrac{1}{2}\right)^{n}. \]
RoundsChance a cheater survives
11 in 2
101 in 1,024
201 in 1,048,576
40About 1 in a trillion

Meanwhile, Victor learns nothing about the password: he only ever sees Peggy come out of the path he named, something he could have filmed with an actor who walked in and out the same way. That is the heart of “zero knowledge”: anything the verifier sees, he could have simulated himself. For a refresher on independent events, see how to calculate probability.

A Real Protocol You Can Check: Schnorr’s Proof

Real systems replace caves with modular arithmetic. In Claus Schnorr’s protocol, Peggy proves she knows a secret number \(x\) such that \(y = g^x \bmod p\), without revealing \(x\). Toy numbers: \(p = 23\), \(g = 5\), secret \(x = 6\), so the public value is \(y = 5^6 \bmod 23 = 8\).

  1. Commit: Peggy picks a random \(r = 4\) and sends \(t = g^r = 5^4 \bmod 23 = 4\).
  2. Challenge: Victor sends a random challenge \(c = 2\).
  3. Respond: Peggy sends \(s = r + c \cdot x = 4 + 2 \times 6 = 16\) (exponents are reduced mod 22).
  4. Verify: Victor checks that \(g^s = t \cdot y^c\): \(5^{16} \bmod 23 = 3\), and \(4 \times 8^2 = 256 \equiv 3 \pmod{23}\). They match.

This is a tiny teaching example, not secure cryptography: real Schnorr proofs use carefully chosen large groups (of prime order) and unpredictable randomness, and reusing a random \(r\) can expose the secret. Victor saw \(t\), \(c\) and \(s\), but because \(r\) was random, \(s\) looks random too and reveals nothing useful about \(x\). Without knowing \(x\), Peggy could not answer both possible challenges for the same \(t\). With real 256-bit numbers, finding \(x\) from \(y\) is the discrete logarithm problem (see Bitcoin math for the elliptic-curve version).

From Interaction to a Single Message

The cave and Schnorr protocols need back-and-forth. In 1986, Amos Fiat and Adi Shamir showed how to replace the verifier’s random challenge with a hash of the commitment, producing a non-interactive proof anyone can check later, under specific security assumptions about the hash function.

What Is a zk-SNARK?

A zk-SNARK is a zero-knowledge succinct non-interactive argument of knowledge. Every proof has a public statement and a secret witness. In an age check, the public statement is “the holder of this signed credential was born before a certain date,” and the witness is the credential with the actual birthdate. The computation being checked is written as a set of arithmetic constraints (a circuit); the prover runs it, produces a short proof, and the verifier checks the proof quickly without asking any questions. For some constructions the proof is only a few hundred bytes.

TypeMain distinction
Interactive ZKPProver and verifier exchange challenges, like the cave
zk-SNARKCompact proof, fast to verify; many need a one-time trusted setup
zk-STARKTransparent setup (no trusted ceremony), generally larger proofs, based on hash functions

The trade-off: making a proof can be expensive for the prover, while checking it is cheap. That asymmetry is exactly what blockchains and auditors want.

Where Zero-Knowledge Proofs Are Used

  • Age and identity checks: in July 2025, Google open-sourced its zero-knowledge libraries (Longfellow ZK) so that a person can prove they are over 18 without sharing their birthdate or any other data. The European Union’s digital identity wallets are encouraged to use such privacy-enhancing technology.
  • Cryptocurrencies: Zcash, launched in 2016, uses zk-SNARKs to hide transaction amounts and parties while still proving no coins were created from nothing; “ZK rollups” use proofs to scale Ethereum.
  • Quantum research: in March 2026, a Google Quantum AI team estimated the resources needed to break 256-bit elliptic-curve cryptography but did not publish its attack circuits. Instead, according to reporting by The Quantum Insider, it released a zero-knowledge proof (built with the SP1 zkVM and a Groth16 SNARK) that lets anyone verify the resource estimates without seeing the improved circuits. This supported a cost estimate; it did not show a quantum computer breaking anything.
  • AI: researchers are building “zkML” systems that prove a specific AI model produced an output, without revealing the model’s weights.

Is It Really “Proof”?

Not in the absolute sense of a math theorem. A zero-knowledge proof gives overwhelming probability, with a chance of being fooled that designers set extremely low (for example around 1 in 2128 in many systems), and many constructions rely on hard math problems staying hard. Implementation bugs can still break real systems. That is the same kind of confidence that protects online banking. (For proofs checked line by line by computer, see formal verification.)

Common Misconceptions

“Zero knowledge means the verifier learns nothing at all.” The verifier learns exactly one thing: the statement is true.

“It is just encryption.” Encryption hides data so the right person can read it later; a zero-knowledge proof convinces someone of a fact without ever giving them the data.

“It is only for crypto coins.” Identity, voting research, supply chains, quantum research and AI auditing all use the same ideas.

Watch: Zero-Knowledge Proofs Explained

If you learn better by watching, these videos are worth your time.

Computer Scientist Explains One Concept in 5 Levels of Difficulty | WIRED (WIRED). Amit Sahai explains zero-knowledge proofs to a child, a teen, a student, a grad student and an expert.
Zero Knowledge Proofs – Computerphile (Computerphile). A short, clear walkthrough of the core idea.

Check Your Understanding

Five quick questions to see how much of this has stuck. Pick an answer and press Submit; you will see a short explanation either way.

Answer each question and press Submit to see your result right away.

1. In the cave game, what is a cheater’s chance of passing one round?
Found a bug? Let us know!
2. What is a cheater’s chance of passing 15 independent rounds?
Found a bug? Let us know!
3. In a zero-knowledge age check, what is the secret witness?
Found a bug? Let us know!
4. In the Schnorr example, r = 4, c = 2 and x = 6. What is s?
Found a bug? Let us know!
5. What does the verifier learn from a zero-knowledge proof?
Found a bug? Let us know!

Frequently Asked Questions

What is a zero-knowledge proof in simple terms?

A way to convince someone that a statement is true, such as knowing a password or being over 18, without revealing the password, your birthdate or anything else.

How does a zero-knowledge proof work?

The prover answers random challenges that only someone with the secret can answer every time. A cheater fails each round with probability at least 1/2, so after many rounds cheating becomes astronomically unlikely.

Who invented zero-knowledge proofs?

Shafi Goldwasser, Silvio Micali and Charles Rackoff introduced them in 1985. Goldwasser and Micali received the 2012 Turing Award.

What is a zk-SNARK?

A zero-knowledge succinct non-interactive argument of knowledge: a short proof that someone knows secret data satisfying a public set of constraints, which anyone can verify quickly without further interaction.

What is the difference between a zk-SNARK and a zk-STARK?

zk-SNARKs give very compact proofs but many need a one-time trusted setup; zk-STARKs need no trusted setup and rely on hash functions, but their proofs are generally larger.

Where are zero-knowledge proofs used?

In privacy-preserving age and identity checks (Google open-sourced its libraries in 2025), cryptocurrencies such as Zcash, Ethereum scaling, and verifying sensitive research claims without revealing details.

Keep Exploring

Sources and Further Reading

Related to This Article

What people say about "Zero-Knowledge Proofs Explained: Examples and Math - Effortless Math"?

No one replied yet.

Leave a Reply