QUANTUM COURSE · BEFORE DAY 1

Day 0|量子计算:先把世界看对Day 0 | A clear-eyed introduction to quantum computing

一篇从零开始的图文预备课:不要求先会量子力学,也不把“同时算所有答案”当解释。我们从状态、振幅、相位、干涉和测量这五件事,搭起一张正确的概念地图。

An illustrated primer with no quantum-mechanics prerequisite—and no “it tries every answer at once” shortcut. We build a reliable map from five ideas: state, amplitude, phase, interference, and measurement.

建议用时 35–50 分钟;先看图、再读解释,最后完成自测。Day 0 是预备篇,不计入后面的 21 个正式学习日。Allow 35–50 minutes. Read the diagrams first, then the explanations, and finish with the checks. This primer is not counted among the 21 numbered lessons.

读完这篇,你应该能做到什么

What you should be able to do

说清量子比特是什么Describe a qubit

它不是一颗同时标着 0 和 1 的小球,而是用复数振幅描述、会按量子规则演化的状态。

It is not a tiny ball labeled 0 and 1 at once. It is a state described by complex amplitudes and evolved by quantum rules.

分清振幅和概率Separate amplitude from probability

振幅可以相加并干涉;概率是测量统计,等于振幅模长的平方。

Amplitudes add and interfere. Probabilities are measurement statistics: squared magnitudes of amplitudes.

识别量子计算的边界Recognize the limits

量子计算不是所有任务都更快,也不能把测量前的全部振幅一次读出来。

Quantum computers are not faster for every task, and measurement cannot reveal every amplitude at once.

1|量子计算究竟在解决什么问题?1 | What problem is quantum computing trying to solve?

先把“量子计算机更快”这句话放在一边。真正的起点不是速度,而是自然界的规则:原子、电子、光子等微观系统遵循量子力学。若我们要模拟分子如何结合、材料如何响应光,经典计算机必须用大量数字近似描述这些系统;系统越复杂,所需状态变量增长得越快。量子计算的一个重要动机,是让计算设备本身也遵循相同的量子规则,从而更自然地表示和操控某些量子系统。

这并不意味着“只要问题跟原子有关,量子计算就自动秒杀经典计算”。计算任务需要被转写成电路,电路要能在真实设备上运行,结果还必须能通过有限次测量读出来。算法理论回答“理想情况下查询或运算次数能否减少”;工程实践还要回答“需要多少量子比特、多少门、噪声会不会淹没信号、最后的经典后处理要花多久”。这几层问题不能混成一句宣传语。

所以,本课程关注的不是“量子是否神奇”,而是一个具体的计算问题:我们能否用状态演化,让有用答案的测量概率提高、让无用结果彼此抵消?后续会看到,叠加负责建立可用的路径,门负责改变路径上的幅度和相位,干涉负责重新分配测量概率,测量负责把结果交给经典世界。没有哪一步是免费得到所有答案。

Put “quantum computers are faster” aside for a moment. The starting point is the rulebook of nature: atoms, electrons, and photons obey quantum mechanics. A classical computer can approximate a molecule or a material, but the number of variables required can grow rapidly with system size. One motivation for quantum computing is to use a device governed by quantum rules to represent and manipulate some quantum systems more naturally.

That does not mean every problem involving atoms is automatically solved faster. A task must be encoded as a circuit, that circuit must run on hardware, and the answer must be extractable from a finite number of measurements. Complexity theory asks whether an ideal algorithm reduces queries or operations. Engineering asks how many qubits and gates it needs, whether noise overwhelms the signal, and how expensive classical post-processing will be. These are different questions.

Our course asks a more precise question: can state evolution increase the chance of useful measurement outcomes while cancelling unhelpful ones? Superposition creates paths, gates change their amplitudes and phases, interference redistributes probabilities, and measurement returns a classical result. No step gives you every answer for free.

2|经典比特和量子比特:区别不是“有更多答案”2 | A bit and a qubit: the difference is not “more answers”

经典比特是计算机信息的基本单位,它在计算基中取 0 或 1。我们可以把它想成一盏只显示两种状态的灯:当前显示哪一种,原则上可以直接读出。量子比特也有两个用来描述测量结果的基态,记作 |0⟩ 和 |1⟩;但在测量前,它的状态一般不能只用“现在是 0”或“现在是 1”来概括,而要用两个复数振幅共同描述。

把这两个基态想成一张坐标纸的两根轴,量子态是平面上的一个向量:它在 |0⟩ 轴上有一个分量,在 |1⟩ 轴上有另一个分量。这个比喻是数学模型,不是说量子比特真的藏在二维纸片里。向量长度必须归一化,因为测量所有可能结果的概率总和必须为 1。向量的方向携带状态信息,测量只会按规则把其中一个结果交出来。

因此,“量子比特可以处于 0 和 1 的叠加”是简写,不能把它理解成一个微型硬币同时朝上和朝下,也不能把它理解成设备已经把两道题都算完、等着你一次性读取。它的准确含义是:状态在一组基态上的线性组合,后续操作可以让这些分量相加、相消或被旋转。至于读出哪个值,要看测量基和测量概率。

经典概率也能描述“我不知道硬币正反面”的不确定性:硬币客观上已经朝上或朝下,只是观察者不知道。量子叠加则不只是这种知识不足的换一种说法:不同分量能够在后续实验中重新相遇并产生干涉。若你把相位抹掉,只保留一张普通概率表,就预测不了所有量子实验的结果。课程会在 Day 2 和 Day 8 用算式与图形把这个差别讲实。

A classical bit is the basic unit of information and takes 0 or 1 in the computational basis. Picture a lamp with two possible displays: in principle, you can read which one is currently on. A qubit also has two measurement basis states, |0⟩ and |1⟩, but before measurement its state is generally not captured by saying “it is 0” or “it is 1.” Two complex amplitudes are needed.

Imagine two coordinate axes, one for each basis state. A quantum state is a vector with a component along each axis. This is a mathematical model, not a claim that a qubit literally sits on a two-dimensional sheet. Its length is normalized because the probabilities of all measurement outcomes must add to one. The vector encodes the state; measurement returns an outcome according to a rule.

So “a qubit is in a superposition of 0 and 1” is shorthand. It is not a tiny coin simultaneously showing heads and tails, nor a machine that has already solved two problems and will reveal both. It means the state is a linear combination of basis states, whose components can later add, cancel, or rotate. The measurement basis and the state determine what you read.

Classical probability can represent ignorance: a coin already has a face up, but you do not know which. Quantum superposition is not merely ignorance with a new name. Its components can meet again and interfere in later experiments. If you erase phase and retain only an ordinary probability table, you cannot predict every quantum experiment. Days 2 and 8 will make this distinction concrete.

Classical bit and qubit state diagramA classical bit selects one basis value; a qubit is represented by amplitudes on two basis states. CLASSICAL BITQUBIT STATE 0 OR 1 read α|0⟩ + β|1⟩|0⟩|1⟩ measurement0 or 1
图 1|经典比特可以直接读出当前值;量子比特先由振幅描述,测量才给出一个经典结果。图中的向量是数学示意,不表示真实空间方向。Figure 1 | A classical bit can be read as a current value. A qubit is described by amplitudes first; measurement returns one classical result. The vector is a mathematical illustration, not a literal spatial direction.

3|什么是量子态:描述“下一步会如何”的完整账本3 | A quantum state: a complete ledger for predicting the next step

在量子计算入门中,“态”是最值得先熟悉的词。它不是粒子的一张照片,也不是某个测量结果的清单,而是对系统可观测预测的数学描述。给定一个态和一个要实施的操作,我们可以计算各种测量结果的概率;如果改变操作或测量方式,预测也会改变。你不需要先回答“粒子在没人看时到底是什么样”这类哲学问题,照着态、操作、测量三件事就能开始做计算。

对单个量子比特,状态可写成 |ψ⟩=α|0⟩+β|1⟩。α、β 可以是实数,也可以是复数,并满足 |α|²+|β|²=1。这个式子不是一段文字装饰:它同时告诉你有哪些基态分量、分量有多大、彼此相位关系如何。只看测量概率时,你得到 |α|² 和 |β|²;但相位藏在复振幅中,决定这些分量在后面能否建设性相加或相消。

“完整账本”也有范围:纯态是对理想、可完整描述系统的向量模型;现实设备会与环境相互作用,也可能有我们不知道的制备误差,这时密度矩阵等工具更合适。 Day 0 不要求你会密度矩阵,只要知道简单的 α、β 向量是一个有用起点,不是所有实际情况的最终描述。到 Day 12,我们会重新处理这个更一般的版本。

把态看成程序的当前变量很有帮助。经典程序读写的是整数、布尔值或数组;量子程序的中间状态是复数向量,门像受约束的矩阵操作。测量把这个状态映射为经典数据,但通常会丢失一部分相位信息。于是每次读出都像“把一份丰富的内部描述压缩成一个样本”,这就是为什么算法要精心安排门序和测量时机。

同一个态的整体相位,和分量之间的相对相位

Global phase versus relative phase

复数振幅可以想成带方向的箭头,因此除了长度,还要记方向。把一个完整量子态的所有振幅同时乘上同一个相位因子 e^{iγ},不会改变任何测量预测;这叫全局相位。相反,只改变某一个分量、让它相对另一个分量转过角度,通常会改变可观察结果,这叫相对相位。比如 (|0⟩+|1⟩)/√2 与 (|0⟩−|1⟩)/√2 不是整体差一个相位,而是 |1⟩ 分量相对 |0⟩ 多了 π 的相位。

初学者容易把“相位看不见”误听成“相位没有用”。更准确的说法是:直接按计算基测量时,结果概率只看模长平方,所以相位暂时不出现在这组概率里;但先施加 H 或让路径再次汇合,相对相位便能改变干涉并转化成不同概率。也要注意“全局”是对整个联合态而言:若一个相位只作用在多比特系统的某个分支,它可能正是分支间的相对相位,不能随手删掉。

A complex amplitude can be pictured as a directed arrow: it has both length and direction. Multiplying every amplitude in the complete state by the same phase factor e^{iγ} changes no measurement prediction; this is global phase. Changing only one component relative to another usually can change observable results; this is relative phase. The plus and minus states (|0⟩±|1⟩)/√2 are not related by one overall phase: the |1⟩ component has a relative phase of π.

“Phase is invisible” does not mean “phase is useless.” A direct computational-basis measurement uses squared magnitudes, so phase does not appear in those immediate probabilities. Apply H or recombine paths, however, and relative phase changes interference and becomes a probability difference. Also, “global” refers to the entire joint state. A phase applied to one branch of a multi-qubit system may be relative to other branches and must not be discarded.

In an introductory course, “state” is the first word worth mastering. It is not a photograph of a particle or a list of outcomes; it is a mathematical description used to predict observable results. Given a state and an operation, we can calculate measurement probabilities. Change the operation or the measurement, and the predictions may change. You can begin computing without settling philosophical questions about what a particle is when nobody looks.

A single-qubit state is written |ψ⟩=α|0⟩+β|1⟩, where α and β may be real or complex and satisfy |α|²+|β|²=1. This compact expression records which basis components exist, their sizes, and their relative phases. A measurement in the computational basis gives |α|² and |β|², while phase information remains in the complex amplitudes and can affect later addition or cancellation.

The “complete ledger” has a scope. A pure state is a useful vector model for an ideal, fully specified system. Real devices interact with their environment and have preparation errors, for which density matrices are often more suitable. Day 0 only needs you to know that the α,β vector is a powerful starting point, not the last word for every real-world situation. Day 12 returns to the more general description.

It helps to view the state as a program’s current variable. Classical programs manipulate integers, booleans, and arrays; a quantum program evolves a complex vector through constrained matrix operations. Measurement maps that state to classical data and usually discards phase information. Each readout compresses a rich internal description into one sample, so gate order and measurement timing matter.

4|叠加不是“我不知道”:可区分性的关键在后续实验4 | Superposition is not ignorance: later experiments can tell them apart

比较两种状态:第一种是确定的 |0⟩;第二种是等幅叠加 (|0⟩+|1⟩)/√2。若现在就在计算基测量,第一种永远得到 0,第二种有一半机会得到 0、一半机会得到 1。此时你可能会说第二种只是“我们不知道它是 0 还是 1”。但这个解释不够,因为我们还可以在测量前加一个门,再看输出统计。

再看状态 (|0⟩−|1⟩)/√2。它和刚才的正号叠加在计算基中都有 50% 的 0、50% 的 1;任何只读取当前概率的描述都会把它们误认为一样。可对它们施加 Hadamard 门 H,正号态会变成 |0⟩,负号态会变成 |1⟩。它们的区别之前就存在,只是标准计算基的单次概率看不出来;H 把相位差转换成可见的结果差。

这就是叠加和经典未知混合态的实验性差别:有相干叠加时,路径之间保留相位关系,可以通过合适的操作重新组合;若真的只是“系统已随机选了一个值,而我们不知道”,就没有这种稳定的相位关系供你恢复。混合状态不是“我不懂”,而是另一种数学对象;用一张概率表强行代替纯态,会漏掉干涉现象。

想象两队人分别从两条小路走到广场。若你不知道他们各自从哪条路来,只知道人数比例,那只是信息不完整;但若他们能像波一样相遇,就还要知道相对节拍和方向。量子态里的相位正是控制“相遇时怎么合并”的信息。这个类比只帮助理解数学,不是说电子是普通水波或人群;真正可检验的是门操作前后的测量统计。

Compare two states: the definite state |0⟩ and the equal superposition (|0⟩+|1⟩)/√2. Measured immediately in the computational basis, the first always gives 0, while the second gives 0 or 1 with equal probability. It is tempting to call the second “we simply do not know whether it is 0 or 1.” That explanation fails once we apply a gate before measuring.

Consider (|0⟩−|1⟩)/√2. It has the same 50/50 computational-basis probabilities as the plus state, but a Hadamard gate H maps the plus state to |0⟩ and the minus state to |1⟩. Their distinction was already present; the standard-basis probabilities did not reveal it. H converts the phase difference into a visible outcome difference.

That is the experimental difference between coherent superposition and classical ignorance. Coherent paths retain phase relationships and can be recombined. A system that has already randomly selected a value, with no phase relationship left, cannot reproduce that interference pattern. A mixed state is a distinct mathematical object, not just “something we do not understand.” Replacing a pure state with a probability table can erase the feature we need to predict.

Imagine two groups arriving at a plaza along different paths. Knowing only how many took each route is incomplete information; if they can meet like waves, their relative timing and direction also matter. Phase plays that role in the mathematics. The analogy is not a claim that electrons are ordinary water waves. The testable fact is the change in measurement statistics after a chosen operation.

5|振幅为什么不能直接叫概率5 | Why an amplitude is not a probability

经典概率是 0 到 1 之间的实数,描述长期重复实验中某结果出现的频率。在量子理论里,每个测量结果先对应一个振幅,振幅可以是负数,也可以是复数;真正的概率要取它的模长平方。若某结果振幅是 1/√2,概率就是 1/2;若振幅是 i/√2,因为 |i|=1,概率仍是 1/2。振幅中的符号或复数相位不能在计算前删掉。

为什么概率不是别的函数?Born 规则把量子态的振幅映射成非负概率,并且保证归一化状态对应总概率 1。学习时不必从公理推导这条规则,但要会正确使用:先把同一结果通道的振幅按量子演化相加,再对总振幅取模平方。这个顺序至关重要。若你先把每条路径各自平方成概率,再把概率相加,就会错过路径间的交叉项,也就错过干涉。

举一个最小算式:两条路到同一探测器,振幅分别为 a 和 b。量子预测的概率是 |a+b|²,展开后包含 |a|²、|b|²,以及两者的交叉项。交叉项取决于相对相位,可以增加结果概率,也可以降低甚至抵消它。普通经典概率独立相加的形式只有 |a|²+|b|²,没有这部分相位信息。因此,量子算法设计常常不是“把概率搬到正确答案”,而是精确设计哪些振幅相加、相位差是多少。

振幅也不代表可以随意放大。量子门必须保持总概率为 1,对应的数学变换是幺正变换。某个结果的振幅增加时,其他方向的振幅要相应调整;算法不能凭空创造总概率,只能重新分配。这个约束解释了为什么量子优势通常要靠精心构造结构,而不是增加一个“量子并行”按钮就结束。

Classical probability is a real number from 0 to 1, describing frequencies across repeated trials. In quantum theory, each measurement outcome is first associated with an amplitude, which may be negative or complex. The probability is the squared magnitude. An amplitude of 1/√2 gives probability 1/2; i/√2 also gives 1/2 because |i|=1. Do not discard signs or phases before the calculation is complete.

The Born rule maps amplitudes to non-negative probabilities and makes their total equal one for a normalized state. You need not derive the rule from axioms yet, but you must apply it in the right order: add amplitudes leading to the same outcome, then take the squared magnitude. If you square each path first and add probabilities, you lose cross terms and therefore lose interference.

Suppose two paths reach the same detector with amplitudes a and b. The quantum probability is |a+b|². Expanding it gives the individual squared magnitudes plus cross terms that depend on relative phase. Those terms can increase the probability, decrease it, or cancel it. Ordinary independent classical probabilities add as |a|²+|b|² and contain no phase information. Quantum algorithm design is often about arranging which amplitudes meet and what their phase difference is.

Amplitudes cannot be increased arbitrarily. Quantum gates preserve total probability and correspond to unitary transformations. Increasing the amplitude of one outcome changes the amplitudes in other directions; an algorithm cannot create probability from nothing, only redistribute it. That is why quantum advantage requires careful structure, not a magical “quantum parallel” button.

P(outcome j) = |amplitude j|²
|a + b|² = |a|² + |b|² + interference terms

6|相位和干涉:一个能亲手调的双路径实验6 | Phase and interference: tune a two-path experiment yourself

相位可以先用“圆周上的方向”来记:复数的模长像箭头长度,辐角像箭头指向。两个等长箭头同向时,相加变长;反向时,相加变成零;相差 90° 时,合成长度介于两者之间。因为概率取合成振幅的模平方,箭头方向会间接影响测量概率。用这个图像先建立直觉,之后再用复数乘法和矩阵计算精确结果。

下图是一个简化的 Mach–Zehnder 干涉仪:第一个分束器把输入分成两条路径;其中一条路径经过相位片,获得相位 φ;第二个分束器让两条路径重新合并,最后到达两个探测器。经过理想、平衡的两个分束器,两个出口的概率分别是 cos²(φ/2) 和 sin²(φ/2)。当 φ=0,两条路在一个出口相长、另一个相消;当 φ=π,明暗交换。每个光子单独探测时仍只在一个探测器留下一个点击,许多次重复后才出现可预测的统计分布。

这套装置说明“路径信息”和“干涉图样”有关系。如果你在路径中放入足以区分光子到底走哪条路的探测装置,路径与探测器会发生关联,干涉可见度就会降低。日常说“观察改变结果”容易让人误以为人的意识在起作用;关键不是有人看见,而是系统和测量环境发生了物理相互作用,导致相干关系被记录或破坏。

现在拖动相位滑块:注意变化的是两条路径的相对相位,两个探测器的概率此消彼长,而不是单个粒子在两条路上留下两份完整结果。这个小实验是数学模型,不模拟设备噪声、探测效率或复杂量子光学细节;它只把课程的核心机制——振幅合并后平方——可视化。Day 8 会把同一机制扩展到更多结果通道和算法。

A useful first picture of phase is direction around a circle: the magnitude of a complex number is an arrow’s length and its argument is its direction. Equal arrows pointing the same way add; opposite arrows cancel; perpendicular arrows produce an intermediate result. Since probability is the squared magnitude of the combined amplitude, direction affects measurement statistics. This gives intuition; complex arithmetic and matrices will provide exact calculations.

The diagram shows a simplified Mach–Zehnder interferometer. The first beam splitter creates two paths. A phase shifter adds φ to one path. A second beam splitter recombines them at two detectors. For ideal balanced splitters, the output probabilities are cos²(φ/2) and sin²(φ/2). At φ=0, one output is constructive and the other destructive; at φ=π, they swap. Each photon still produces a click at one detector. The distribution appears after many repetitions.

Path information and interference are connected. If a device can distinguish which path a photon took, the paths become correlated with that device and interference visibility falls. “Observation changes the result” can misleadingly sound like human consciousness matters. The relevant event is a physical interaction with a measurement environment that records or disrupts coherence.

Move the phase slider. The relative phase changes, and the two detector probabilities trade off; one particle does not leave two complete outcomes. This compact model omits noise, detector efficiency, and advanced optics. It visualizes one core mechanism: combine amplitudes first, then square. Day 8 extends it to more outcome channels and algorithms.

Mach–Zehnder two-path interference diagramA beam splitter creates two paths; one receives phase phi; a second splitter combines amplitudes into two detectors. BS1 phase φ BS2 inputD₀D₁
图 2|两个分束器之间的一条路径增加相位,第二个分束器让振幅重新相加。相位片不是“给某个答案加概率”,而是改变两条路径汇合时的相对方向。Figure 2 | A phase is added to one path between two beam splitters. The second splitter recombines amplitudes. The phase shifter does not “add probability to an answer”; it changes the relative direction of the amplitudes when they meet.

互动实验|改变相位,看概率如何流动Interactive demo | Change phase and watch probability move

D₀
100.0%
D₁
0.0%

理想模型:P(D₀)=cos²(φ/2),P(D₁)=sin²(φ/2)。这显示的是多次相同实验的理论频率,不是对单次光子结果的预言。

Ideal model: P(D₀)=cos²(φ/2), P(D₁)=sin²(φ/2). These are theoretical frequencies over repeated identical trials, not a prediction of one photon’s detector.

7|测量和 Born 规则:一次读出,不是一份完整状态7 | Measurement and the Born rule: one readout is not the whole state

若单比特态是 α|0⟩+β|1⟩,在计算基测量时,得到 0 的概率为 |α|²,得到 1 的概率为 |β|²。一次测量只会返回一个经典结果,不会附送“另一个结果也算出来了”的副本。若你希望估计概率,就要在可重复的相同制备条件下运行许多次,也称为 shots 或重复采样。100 次测量不保证恰好出现 50 个 0 和 50 个 1;有限样本会有统计波动。

例如真正概率是 P(0)=0.7、P(1)=0.3,重复 100 次时最常见的是 0 约 70 次,但出现 64 次或 76 次都不奇怪。增加 shots 会让频率通常更接近真实概率,但误差下降大约按样本数平方根的倒数缩小;想把统计误差缩小一半,通常需要约四倍样本。量子实验因此有测量成本:设备运行时间、排队、校准漂移和读出噪声都要纳入设计。

测量还依赖你选择的基。计算基测量回答“更像 0 还是 1”;换一个基测量,就在问另一类问题。Hadamard 基可以通过先作用 H、再按计算基读出实现。前面正负号叠加都呈现 50/50,但先加 H 后,一个态稳定输出 0,另一个稳定输出 1。这样,相位信息并不是“永远看不见”,而是需要把它转换成适当的可观测量。

所谓测量塌缩,是说得到某个结果后,后续预测要以这个结果对应的状态更新;它不是实验室里一团物质突然化成另一个粒子的戏剧化爆炸。测量和幺正演化在数学上扮演不同角色:理想门操作可逆,读出过程会把量子信息转成经典结果,通常无法倒回去恢复所有相位。算法为何多数在最后测量?因为太早读取可能破坏还要用来干涉的相干结构。

shots 越多,估计通常越稳,但不会“把随机变成确定”

More shots improve estimates, but do not make randomness disappear

假设同一电路每次得到 0 的概率都是 p,运行 N 次后,0 的频率是对 p 的估计。在独立、条件稳定的理想模型里,这个频率的标准差为 √(p(1−p)/N);最不利的 p=1/2 时是 1/(2√N)。所以 100 次实验的典型波动尺度约为 5 个百分点,10,000 次约为 0.5 个百分点。这里说的是统计波动的尺度,不是每次误差必定落在这个范围,也不是把硬件偏差包含进去了。

这条平方根规律说明了为什么高精度结果很贵:想让随机误差大约缩小 10 倍,shots 通常得增加约 100 倍。若设备在两次运行之间漂移,或每次制备条件不同,增加样本并不能自动消除系统误差。好的实验要记录样本数、读出校准、重复测量分布和不确定度;算法也应尽量设计成只需少量可辨认统计量,而不是要求重建整个高维态。

Suppose the same circuit returns 0 with probability p on every run. After N repetitions, the observed frequency estimates p. Under an ideal independent and stable model, its standard deviation is √(p(1−p)/N), reaching 1/(2√N) at p=1/2. Thus 100 trials have a typical fluctuation scale of about five percentage points, while 10,000 trials give about half a point. This is a scale, not a guarantee for every run, and it excludes hardware bias.

The square-root rule explains why precision can be expensive: reducing random error by roughly ten times usually takes about one hundred times as many shots. Drift between runs or changing preparation conditions can create systematic error that more samples do not automatically remove. Good experiments report shot count, readout calibration, repeated distributions, and uncertainty. Algorithms should ideally extract a few useful statistics rather than reconstruct an entire high-dimensional state.

For α|0⟩+β|1⟩ measured in the computational basis, the probabilities are |α|² for 0 and |β|² for 1. One measurement returns one classical result; it does not provide a copy of the other outcome. To estimate probabilities, repeat the same preparation and circuit many times—these runs are often called shots. A hundred trials need not produce exactly fifty zeros and fifty ones; finite samples fluctuate.

If P(0)=0.7 and P(1)=0.3, roughly seventy zeros are typical in one hundred trials, but sixty-four or seventy-six would not be surprising. More shots usually improve the estimate, with statistical error shrinking roughly as the inverse square root of the sample count. Halving that error often requires about four times as many samples. Runtime, queueing, calibration drift, and readout noise are real costs.

Measurement also depends on the basis. A computational-basis measurement asks whether the result is 0 or 1; a different basis asks another question. The Hadamard basis can be measured by applying H and then reading in the computational basis. The plus and minus states both look 50/50 before H, yet become definite 0 and 1 afterward. Phase is not forever invisible; it must be converted into a suitable observable.

Measurement collapse means that later predictions are updated based on the observed outcome. It is not a dramatic explosion in which matter suddenly becomes another particle. Ideal gates and readout play mathematically different roles: gates are reversible, while readout turns quantum information into classical data and generally loses phase information. Measuring too early can destroy coherence that a later interference step needs.

Repeated measurement estimates probabilityIndividual runs produce one result; accumulated counts approach the underlying distribution. ONE RUN → ONE OUTCOME · MANY RUNS → A DISTRIBUTION sample outcomes (schematic) 01frequency
图 3|上方每个点代表一次运行中的一个结果;右侧柱形概括重复运行的频数。示意图不是精确的实验数据,重点是“一个样本”与“估计分布”的区别。Figure 3 | Each dot is one outcome from one run; the bars summarize repeated runs. This is schematic, not experimental data. The point is the distinction between one sample and an estimated distribution.

8|量子门做什么:旋转和重组,不是任意擦写8 | What quantum gates do: rotate and recombine, not arbitrary overwriting

经典逻辑门可以把输入映射成输出,例如 NOT 把 0 变 1、把 1 变 0。量子门对量子态执行线性变换,并且必须保持内积与总概率,因此理想量子门对应幺正矩阵。简单来说,门可以旋转状态向量、重新安排各结果的振幅,但不能随意把任意两个输入压成同一个输出;若演化过程可逆,程序就能原则上把门序列倒过来执行。

X 门是最容易上手的例子:X|0⟩=|1⟩、X|1⟩=|0⟩。若输入是 α|0⟩+β|1⟩,线性性告诉我们输出是 β|0⟩+α|1⟩,也就是交换两个幅度。Z 门把 |1⟩ 的分量乘以 −1,却不改变这一刻在计算基测得的概率;这个负号会在之后与别的路径合并时显现。H 门则把 |0⟩送到 (|0⟩+|1⟩)/√2,把 |1⟩送到 (|0⟩−|1⟩)/√2,是连接基态与干涉的常用入口。

门的顺序会改变结果:X 后接 H,通常不等于 H 后接 X,因为矩阵乘法不满足交换律。你可以把它看成先转向再翻转,与先翻转再转向的路径不同;同一个终点也可能由不同门序列抵达。Day 3 会把 ket、bra、向量和矩阵统一起来,Day 4 则专门比较 X、Z、H 的职责。现在只需记住,量子程序的“指令”不是对概率表做任意赋值,而是对状态振幅作受约束的变换。

这也解释了为什么单纯读取、复制或删除量子比特不是免费的经典操作。任意未知量子态不能被完美复制(不可克隆定理);测量会改变态;纠缠状态还可能让一个比特无法独立描述。实际量子程序要用门来间接控制态,再选择合适的时机读出。工程上每个门都可能有误差,因此“多加几层试试看”不是稳妥策略。

A classical logic gate maps inputs to outputs; NOT swaps 0 and 1. A quantum gate applies a linear transformation and must preserve inner products and total probability, so an ideal gate is represented by a unitary matrix. It can rotate a state vector and redistribute amplitudes, but it cannot arbitrarily merge distinct inputs. Because the evolution is reversible, the gate sequence can in principle be reversed.

The X gate is a useful first example: X|0⟩=|1⟩ and X|1⟩=|0⟩. By linearity, it swaps the amplitudes in α|0⟩+β|1⟩. The Z gate multiplies the |1⟩ component by −1 without changing immediate computational-basis probabilities; that sign becomes visible when paths later combine. H maps |0⟩ to (|0⟩+|1⟩)/√2 and |1⟩ to (|0⟩−|1⟩)/√2, linking basis states to interference.

Gate order matters: X followed by H is generally not the same as H followed by X, because matrix multiplication is not commutative. “Turn, then flip” follows a different path from “flip, then turn.” Day 3 unifies bras, kets, vectors, and matrices; Day 4 compares X, Z, and H. For now, remember that quantum instructions transform amplitudes under constraints rather than assigning arbitrary values to a probability table.

This is also why reading, copying, or deleting a qubit is not a free classical operation. An arbitrary unknown quantum state cannot be perfectly cloned; measurement changes the state; and an entangled qubit may not have an independent description. Programs control states indirectly with gates and choose when to read them. Since physical gates are imperfect, “add more layers and see” is rarely a sound strategy.

9|多个量子比特和纠缠:整体可能比两部分更完整9 | Multiple qubits and entanglement: the whole can be more than two parts

两个经典比特有四种组合:00、01、10、11;两个量子比特的状态向量也有四个对应基态分量。一般 n 个量子比特需要 2ⁿ 个计算基振幅来描述,因此经典模拟理想态会遇到指数增长的存储负担。但“有 2ⁿ 个振幅”不等于“可以一次读出 2ⁿ 个答案”:测量依旧只给一个 n 位结果;要拿到整个概率分布或验证细节,通常需要重复实验和额外计算。

有些两比特态可以拆成两个单比特态的张量积,例如 |0⟩⊗(|0⟩+|1⟩)/√2;有些不能这样拆。Bell 态 |Φ⁺⟩=(|00⟩+|11⟩)/√2 就不能写成“第一个比特一个独立状态,第二个比特另一个独立状态”的乘积。单独看任一比特,测量结果都是随机的;两边一起看,却总得到相同值。描述相关性必须看整个联合态。

这叫纠缠。它的反直觉处在于:整体拥有明确关联,局部却没有可预先指定的确定值。它不是两人之间能控制的超光速暗号。测量一方后,另一方的条件分布会与结果相关,但远端观察者单独统计自己的结果仍看见随机分布;想比较结果仍需要通过经典通信。量子关联可以超过某些经典模型的限制,却不能被拿来违反相对论因果关系。

纠缠是资源而非魔法:协议需要先制备合适的纠缠态、保护它免受噪声破坏,并结合经典信息和特定测量。制备、传输和纠错都要成本。 Day 9 会用张量积把维度翻倍讲清,Day 10 构造 Bell 态,Day 11 再观察关联实验;到那时你已经有了“联合态”这个准确的提问方式。

一个两比特态能否拆成两个单比特态?

Can a two-qubit state be split into two single-qubit states?

把一般两比特纯态写成 a|00⟩+b|01⟩+c|10⟩+d|11⟩。如果它能拆成 (u|0⟩+v|1⟩)⊗(x|0⟩+y|1⟩),展开后系数必须满足 a=ux、b=uy、c=vx、d=vy,因此 ad−bc=0。这个简单判据让“纠缠”不再只是玄妙形容词:只要系数矩阵的行列式不为零,这个纯态就不能拆成两个独立单比特态。

Bell 态的系数是 a=d=1/√2、b=c=0,因此 ad−bc=1/2,不等于零,确实不可分解。相反,|0⟩⊗(|0⟩+|1⟩)/√2 的系数满足 ad−bc=0,是可分离态。这个代数检查只适用于这里讨论的两比特纯态;有混合态时要用更一般的可分离性判定。课程现在先让你看见“一体态还是整体态”的关键问题,后面的张量积和密度矩阵会补上完整工具。

Write a general two-qubit pure state as a|00⟩+b|01⟩+c|10⟩+d|11⟩. If it factors as (u|0⟩+v|1⟩)⊗(x|0⟩+y|1⟩), then a=ux, b=uy, c=vx, and d=vy, so ad−bc=0. This small test makes entanglement more than a mysterious adjective: if the coefficient matrix has a nonzero determinant, the pure state cannot be split into independent single-qubit states.

For a Bell state, a=d=1/√2 and b=c=0, giving ad−bc=1/2, so it is inseparable. The product state |0⟩⊗(|0⟩+|1⟩)/√2 has determinant zero and is separable. This test applies to the two-qubit pure states discussed here; mixed states require more general separability criteria. The key question is already visible: do we need one state per part, or a description of the whole?

Two classical bits have four combinations: 00, 01, 10, and 11. A two-qubit vector also has four corresponding basis amplitudes. In general, n qubits require 2ⁿ computational-basis amplitudes to describe a pure state, which creates an exponential storage cost for classical simulation. But 2ⁿ amplitudes do not mean 2ⁿ answers can be read at once: measurement still returns one n-bit outcome.

Some two-qubit states factor into two single-qubit states, such as |0⟩⊗(|0⟩+|1⟩)/√2. Others do not. The Bell state |Φ⁺⟩=(|00⟩+|11⟩)/√2 cannot be written as an independent state for each qubit. Either qubit alone gives a random result; measured together, their values always match. The joint state is needed to describe the correlation.

This is entanglement: the whole has a definite correlation even though each part has no predetermined local value in the state description. It is not a controllable faster-than-light message. After one party measures, the other party’s conditional distribution is correlated with that result, but their local statistics remain random; comparing results still requires classical communication. Quantum correlations can exceed limits of certain classical models without violating relativistic causality.

Entanglement is a resource, not magic. A protocol must prepare an appropriate state, protect it from noise, and combine it with classical information and specific measurements. Preparation, transmission, and error correction all have costs. Day 9 develops tensor products, Day 10 constructs a Bell state, and Day 11 studies correlation experiments.

Bell pair correlation diagramTwo separated qubits have random local outcomes but matching joint outcomes in a Bell state. Qubit A0 or 1 (random) Qubit B0 or 1 (random) joint state00 or 11
图 4|Bell 态中,单边结果各自随机,联合结果却只出现 00 或 11。虚线表示统计关联,不表示有信号从 A 飞到 B。Figure 4 | In a Bell state, each local result is random, while joint outcomes are 00 or 11. The dashed lines represent statistical correlation, not a signal travelling from A to B.

10|量子算法的关键:不是并行“算完”,而是把信息编码对10 | The key to quantum algorithms: encode information, then interfere

如果你把 n 个量子比特放进均匀叠加,形式上确实含有 2ⁿ 个基态分量;可一次测量只抽到其中一个结果。若算法让每个分支各自算出一个答案、最后直接读出,通常并没有得到指数级工作量的免费压缩。真正有用的问题要有额外结构:例如可以通过 oracle 查询某个性质,算法要把这个性质写进相位,再借助干涉让目标性质影响最终测量统计。

Deutsch 算法是非常小的例子:它不是把函数对 0 和 1 的两个值同时打印出来,而是问函数是否为常量或平衡。在承诺条件成立时,量子电路可用一次 oracle 查询,通过相位回踢和干涉读出这个整体性质;经典确定性算法最坏要查询两次。这里的结论属于特定问题、特定查询模型,不能简单推广成“量子计算普遍快一倍”。Deutsch–Jozsa 把例子扩到多比特,但也依赖明确的 promise。

Grover 搜索解决无结构搜索的查询问题,理想查询次数约为 √N,而经典需要与 N 同阶,这是平方级而非指数级提升。Shor 算法的突出之处是把整数分解归约到周期寻找,并利用量子傅里叶变换和经典后处理;但要在现实规模上运行,需要远超当前噪声设备能力的容错资源估算。每个算法都要说明输入模型、精度、输出要求、查询成本和硬件成本,才能公平比较。

查询次数减少,不等于实际运行时间按同样倍数缩短

Fewer oracle queries do not guarantee the same wall-clock speedup

用 Grover 做个数量级估算:若 N=1024 且恰有一个目标,理想最优轮数约为 π√N/4,约 25 轮;无结构经典搜索在最坏情况下最多检查 1024 项。这个例子说明查询次数的平方级改善,但不表示真实设备一定快 40 倍。每轮 Grover 都包含 oracle 和扩散操作;若 oracle 本身很深、两比特门错误高,或要进行大量 shots 与经典验证,墙钟时间可能并没有优势。理论复杂度回答的是特定成本模型下的增长趋势,硬件基准则要测量完整端到端流程。

For an order-of-magnitude example, Grover search with N=1024 and one target needs about π√N/4, or roughly 25 ideal iterations; an unstructured classical search may inspect up to 1024 items. This illustrates a quadratic query improvement, not a guarantee of forty-times lower runtime on real hardware. Each Grover iteration includes an oracle and diffusion operation. A deep oracle, noisy two-qubit gates, many shots, or classical verification can erase a wall-clock advantage. Complexity describes growth under a cost model; hardware benchmarks must measure the full end-to-end workflow.

设计电路时可以按五步提问:第一,目标输出是什么?第二,如何把问题写入输入态或 oracle?第三,哪些振幅路径携带相关信息?第四,用什么门让错误路径相消、正确路径相长?第五,测量能否用可接受的重复次数区分答案?如果在第三步说不清“相位里藏的是什么信息”,往往说明还没找到算法,而不是少背了某个门的名称。

把一个真实问题变成量子电路,要经过哪些翻译?

What translations turn a real task into a quantum circuit?

第一步先把任务讲成精确的输入—输出关系,而不是先打开电路编辑器。输入是一个整数、一张图、一个分子哈密顿量,还是只能通过黑盒查询的函数?输出是精确答案、近似答案、某个性质的一个比特,还是符合指定分布的样本?任务表述不同,算法和资源计数就会不同。必须提前写清精度要求、成功概率和允许的经典预处理,否则“快多少”没有共同比较标准。

第二步把输入编码到量子态。少量整数可以直接写成计算基态 |x⟩;连续数据或庞大数据库则需要更复杂的制备过程。不要把状态制备当作免费初始化:如果要逐项读取 N 条经典数据才能制备目标态,那么这一步可能已经花费 O(N) 时间。论文中常见的“假设输入已经是某个量子态”,并不等于现实系统可以低成本、可重复地提供它。

第三步设计可逆电路和 oracle。经典程序经常会覆盖旧变量或丢弃中间结果,而量子门必须保持可逆;工程师通常要额外加入辅助比特,把计算结果写入新寄存器,再把不需要的临时信息“反计算”清理干净。oracle 也不是无限能力的魔法盒:在查询复杂度模型里,它的调用次数被单独统计;落到硬件上,oracle 往往包含一段很长的算术电路,其门数和深度必须计入成本。

第四步把理想门编译成设备可执行的原生门,安排比特布局、连接路线、测量和重复次数。不同硬件能直接执行的门集不同,编译器可能需要插入额外门来完成两颗远距离量子比特间的操作;多出来的深度会增加噪声风险。最后,把测量样本送回经典代码,进行统计估计、误差校正或候选答案验证。完整流程通常是经典与量子交替合作,而不是“量子芯片接过全部工作”。

First state the task as a precise input–output relation before opening a circuit editor. Is the input an integer, a graph, a molecular Hamiltonian, or a function accessible only through a black-box query? Is the output an exact answer, an approximation, one property bit, or a sample from a target distribution? These choices change the algorithm and the resource count. Specify precision, success probability, and allowed classical preprocessing; otherwise “how much faster” has no common basis.

Next encode the input into a quantum state. A small integer may be a computational-basis state |x⟩; continuous data or a large database may require a more elaborate preparation procedure. State preparation is not free initialization. If it requires reading N classical records one by one, it may already cost O(N). A paper that assumes “the input is already this quantum state” has not shown that a real system can supply it cheaply and repeatedly.

Then design reversible operations and any oracle. Classical programs often overwrite variables or discard intermediate values; quantum gates must be reversible. A circuit may need ancilla qubits, write results into extra registers, and uncompute temporary information. An oracle is not an unlimited magic box: query complexity counts calls separately, while a hardware implementation may contain a long arithmetic circuit whose gates and depth must also be counted.

Finally compile ideal gates into the device’s native set, map qubits to hardware connections, choose measurements and shots, and decode samples with classical code. Some devices require extra routing gates for distant qubits, increasing depth and noise exposure. The full workflow often alternates classical and quantum steps; the chip does not take over every part of the task.

A uniform superposition over n qubits contains 2ⁿ basis components mathematically, but one measurement samples only one result. If each branch independently computes an answer and we simply read one branch, there is no free compression of exponential work. Useful problems have extra structure. For example, an oracle can answer a property query; a circuit can encode that property into phase and use interference to affect the final statistics.

Deutsch’s algorithm is a tiny example. It does not print both function values; it asks whether a promised function is constant or balanced. Under that promise, one quantum oracle query plus phase kickback and interference can reveal the global property, while a deterministic classical algorithm needs two queries in the worst case. This is a result for a particular problem and query model, not a general “twice as fast” claim. Deutsch–Jozsa extends the example but also relies on a promise.

Grover’s algorithm searches an unstructured space in roughly √N ideal queries, compared with order N classically—a quadratic, not exponential, improvement. Shor’s algorithm reduces factoring to period finding and uses the quantum Fourier transform plus classical post-processing. Running it at realistic scale requires fault-tolerant resources far beyond today’s noisy devices. Every comparison must specify the input model, precision, output, query cost, and hardware cost.

When designing a circuit, ask five questions: What output do we want? How is the problem encoded in the input or oracle? Which amplitude paths carry relevant information? Which gates make wrong paths cancel and useful paths add? Can a practical number of measurements distinguish the answer? If you cannot explain what information is stored in phase, you may not yet have an algorithm; memorizing more gate names will not fix that.

11|真实量子计算机:器件会出错,所以深电路不等于强11 | Real quantum computers: errors make depth a cost

量子态很容易受到环境影响:热噪声、电磁扰动、控制脉冲偏差、读出错误、串扰都会让理想态偏离。相干时间有限,门也不是数学上完美的矩阵。所谓 NISQ(含噪中等规模量子)描述的是一类当前硬件阶段,不是“已经实用、只是还不够大”的保证。许多设备可以让研究者运行小电路、验证控制方法、探索混合算法,但噪声和规模仍然限制可靠计算。

物理量子比特与逻辑量子比特要分清。物理比特是芯片或离子阱中的实际器件;逻辑比特是通过纠错码把多个物理比特组织起来、用于更可靠运算的编码信息。纠错要不断测量综合征,定位错误并校正,同时不直接测出逻辑态本身。一个逻辑比特往往需要许多物理比特和大量额外门;具体开销依赖错误率、码距、架构和任务。因此,看到“处理器有几百个物理比特”并不能直接推导它能运行任意几百比特的长算法。

门模型和量子退火:都是量子技术,但计算方式不同

Gate model and quantum annealing are different approaches

本课程主要学习门模型:把状态初始化后,按时间顺序施加 X、H、受控门等离散操作,最后测量。量子退火则把一个优化问题写成能量函数,尝试让物理系统从较容易制备的状态缓慢演化到目标能量景观,希望落入低能量解。它们共享量子物理基础,但编程接口、硬件结构和适用任务不同。退火器不会因此自动找到任意问题的全局最优解;问题映射、嵌入、能隙、热噪声和重复采样仍影响成功率。看到“量子计算机”这个总称时,先确认讨论的是哪种模型。

This course focuses on the gate model: initialize a state, apply ordered operations such as X, H, and controlled gates, then measure. Quantum annealing encodes an optimization task as an energy function and tries to evolve a physical system toward a low-energy solution. Both rely on quantum physics, but their programming interfaces, hardware, and target workloads differ. An annealer does not automatically find a global optimum for every problem; mapping, embedding, energy gaps, thermal noise, and repeated sampling all matter. When a report says “quantum computer,” first identify the model it means.

量子优势的工程比较要把经典基线选好。经典算法不断进步;某些问题还有近似算法、专用芯片或数据结构优化。量子算法可能省掉某种渐近资源,却增加状态制备、重复测量、纠错和读出成本。一个诚实的实验会报告电路深度、门数、shots、误差条、基准方法和硬件参数,而不只展示一个令人惊讶的输出样例。要看懂量子计算新闻,先找它比较的到底是什么成本。

入门阶段你不必购买设备或安装沉重开发套件。先在本地模拟器上验证 1–3 个比特的手算电路,记录每步态向量和最终概率;再把同样电路送到云端设备,比较理想结果与实际频数。差异不是你数学学错的证据,而是噪声模型和硬件条件的一部分。Day 20 会系统讨论噪声、退相干、误差缓解和纠错。

Quantum states are vulnerable to their environment. Thermal noise, electromagnetic disturbance, imperfect control pulses, readout error, and crosstalk can move a device away from the ideal state. Coherence time is limited, and gates are not perfect mathematical matrices. NISQ describes a noisy, intermediate-scale hardware era; it does not promise that useful applications are already available at larger scale.

Distinguish physical from logical qubits. A physical qubit is a device such as a circuit or trapped ion. A logical qubit is information encoded across physical qubits to enable more reliable computation. Error correction repeatedly measures syndromes to locate errors without directly measuring the logical state. One logical qubit may require many physical qubits and extra gates; overhead depends on error rates, code distance, architecture, and task. A processor with hundreds of physical qubits cannot automatically run any deep algorithm on hundreds of reliable logical qubits.

A fair engineering comparison needs a strong classical baseline. Classical algorithms keep improving, and some tasks have approximation methods, specialized chips, or data-structure optimizations. A quantum algorithm may reduce one asymptotic resource while adding state preparation, repeated sampling, error correction, and readout costs. Good experiments report depth, gate count, shots, uncertainty, baselines, and hardware conditions—not just a surprising output sample.

You do not need to buy hardware or install a large SDK to begin. Simulate a hand-calculated one-to-three-qubit circuit, recording each state vector and final probability. Then run the same circuit on a cloud device and compare ideal predictions with observed frequencies. A difference is not necessarily a math mistake; noise and hardware conditions are part of the model. Day 20 covers noise, decoherence, mitigation, and correction.

12|量子计算的限制:不能读出所有振幅,也不是通用加速器12 | The limits: amplitudes are not all readable, and not every task speeds up

“n 个量子比特包含 2ⁿ 个复数,所以能存 2ⁿ 条信息”听起来有道理,却容易混淆内部状态参数和可访问的经典数据。对任意未知态,一次测量只能给有限信息;若要重建任意 n 比特状态,所需实验次数通常随规模急剧增长。量子优势不是把大数组装进芯片后一次导出,而是利用特定演化,把我们关心的某个性质压缩到少数可测统计量里。

量子计算机也不会自动让网页加载、文字搜索、数据库查询、视频转码和所有 AI 训练更快。每个任务要看是否存在适合的量子算法、输入如何提供、输出需不需要完整列出,以及数据进出量子设备的开销。对很多业务问题,经典 CPU、GPU、专用硬件和成熟算法已经非常高效;量子设备可能只在某些问题类型、规模和资源条件下有优势。

可以用“输入、运算、输出”三段来筛选应用。第一,输入是怎么交给量子设备的?若一份巨大的经典数据必须逐个编码进量子态,装载成本可能抵消理论上的运算优势。第二,量子电路实际减少了什么?是 oracle 调用次数、渐近运行时间,还是某种采样复杂度?第三,输出要什么精度、多少样本、多少经典后处理?若用户最终需要把所有候选答案完整列出来,测量和传输也会产生成本。

量子化学常被认为是潜在方向,因为被研究的对象本身是量子系统;但“更自然地表示”不等于立即得到准确、便宜的药物答案。还要处理分子模型、误差界、状态制备、能量估计、纠错成本,并和经典量化化学方法比较。组合优化也很热门,却没有“把任意优化问题放进量子芯片就得到全局最优解”的通用保证。每种应用必须逐题分析,不能从一个成功演示推断整个行业都将被加速。

Use an input–computation–output checklist. First, how does classical input reach the quantum device? If a large data set must be encoded one item at a time, loading costs may erase a theoretical speedup. Second, what resource does the circuit reduce: oracle calls, asymptotic runtime, or a sampling cost? Third, what precision, number of samples, and classical post-processing are needed? If users need every candidate answer listed, measurement and data transfer also cost time.

Quantum chemistry is a promising area because the target systems are quantum, but a more natural representation does not instantly produce cheap, accurate drug predictions. Models, error bounds, state preparation, energy estimation, fault tolerance, and comparisons with classical methods all matter. Combinatorial optimization is also an active area, yet there is no general guarantee that putting any optimization problem on a quantum chip yields a global optimum. Evaluate applications one problem at a time.

安全领域也需要准确表述。足够强且容错的量子计算机会威胁部分基于整数分解或离散对数的公钥密码体系,Shor 算法是相关理论基础;但当前设备不等于已经能破译现实规模的 RSA。对称加密和哈希面对量子算法时有不同影响,不能简单说“量子会破解所有密码”。长期敏感数据可能需要考虑“先收集、以后解密”的风险,迁移到后量子密码是标准与工程的渐进过程,不是恐慌性的一键替换。

最实用的判断方法是问四件事:量子算法具体解决什么输入规模?与最好的经典算法比,改善的是时间、查询次数、样本数还是内存?算法需要多少可纠错逻辑比特和门深度?结果的精度和可信度如何验证?如果一篇报道只说“量子计算指数级加速”却不回答这些问题,就先把它当作宣传摘要,而不是完整的工程结论。

“n qubits contain 2ⁿ complex amplitudes, so they store 2ⁿ pieces of information” confuses state parameters with accessible classical data. One measurement of an arbitrary unknown state reveals only limited information; reconstructing a general n-qubit state can require a rapidly growing number of experiments. Quantum advantage is not exporting a huge array in one read. It is using a particular evolution to encode a property of interest into a small set of measurable statistics.

Quantum computers do not automatically speed up web pages, text search, databases, video conversion, or every AI training run. Each task needs a suitable quantum algorithm, an input model, an output requirement, and a cost analysis for moving data in and out. Classical CPUs, GPUs, specialized hardware, and mature algorithms are already excellent for many workloads. Any quantum advantage depends on problem type, scale, and resources.

Security claims also need precision. A sufficiently large fault-tolerant quantum computer would threaten some public-key systems based on factoring or discrete logarithms; Shor’s algorithm provides the theoretical foundation. Today’s devices cannot simply break real-world RSA at scale. Symmetric cryptography and hashes are affected differently, so “quantum breaks all encryption” is wrong. Long-lived sensitive data may face a harvest-now, decrypt-later risk; post-quantum migration is a standards and engineering process, not a panic button.

A practical evaluation asks four questions: What input size does the algorithm handle? Which resource improves against the best classical method—time, queries, samples, or memory? How many error-corrected logical qubits and gates are required? How is accuracy verified? If a report says “exponential quantum speedup” without answering these, treat it as a headline, not a full engineering result.

13|从比特到算法:一张学习地图,帮你知道每个概念何时登场13 | From bits to algorithms: when each concept enters the story

这门 21 天课程不是 21 个互不相干的名词清单,而是一条依赖关系链。先会描述一个比特的状态,才能谈门怎么改变状态;理解复数与相位,才能解释干涉;掌握测量概率,才能读懂算法输出;再把单比特推广到多比特,才能讨论纠缠和高维电路。等这些积木稳定后,Deutsch、QFT、相位估计、Grover 和 Shor 才会像同一套语言的不同应用,而不是一串神秘缩写。

正式前七天打基础:Day 1 讲比特和量子比特的状态观;Day 2 讲复数振幅、概率和相位;Day 3 把 Dirac 记号变成向量和矩阵;Day 4 学 X、Z、H 三种核心门;Day 5 把相位门作为可编程操作;Day 6 认真处理测量和 Born 规则;Day 7 用 Bloch 球把单比特状态和旋转做几何整合。Day 0 负责把“为什么”和“不要误解什么”放在前面,给正式课程垫底。

后面八天从干涉走向算法:先学两比特张量积与纠缠,再读 Bell 关联、密度矩阵和电路设计;随后用 Deutsch 系列练习查询问题编码,再学习 QFT、相位估计、Shor 周期寻找和 Grover 幅度放大。最后讨论噪声、纠错与小项目路线。并不是每个人都需要熟练掌握所有推导;我们的目标是知道模型假设、会算小例子、能解释输出逻辑,逐步形成可以继续深造的基础。

数学准备不需要先修完整量子力学。会四则运算、平方根、初等代数和二维向量就能起步;复数会在 Day 2 学,矩阵乘法在 Day 3 和 Day 4 补齐。线性代数如果还不熟,先掌握向量、转置、共轭和矩阵作用即可。每一天都尽量从一个可手算的例子开始,再把同一逻辑迁移到图形、门电路或实验统计里。遇到符号不用慌:先问它代表状态、操作还是测量结果。

The 21 lessons are not a disconnected glossary; they form a dependency chain. You need a state description before asking how a gate changes it, complex phase before explaining interference, and measurement probabilities before reading an algorithm’s output. Then multiple qubits introduce entanglement and larger state spaces. With these pieces in place, Deutsch, QFT, phase estimation, Grover, and Shor become applications of one language rather than mysterious acronyms.

Days 1–7 build foundations: state, complex amplitudes and phase, Dirac notation and matrices, X/Z/H gates, phase gates, measurement and the Born rule, then a geometric view using the Bloch sphere. Day 0 supplies the “why” and removes misconceptions before the formal lessons begin.

The next lessons move from interference to algorithms: tensor products and entanglement, Bell correlations, density matrices, circuit design, Deutsch’s query problem, QFT, phase estimation, Shor’s period finding, and Grover’s amplitude amplification. The final days discuss noise, correction, and a small project. You do not need every derivation memorized; aim to state assumptions, solve small examples, and explain output logic.

You do not need a full quantum-mechanics course first. Arithmetic, square roots, elementary algebra, and two-dimensional vectors are enough to start. Complex numbers arrive on Day 2; matrix multiplication is introduced on Days 3–4. If linear algebra is new, begin with vectors, transpose, conjugation, and matrix action. Each lesson starts with a hand-computable example and carries the same logic into diagrams, circuits, or experiment statistics. When a symbol feels unfamiliar, ask whether it denotes a state, an operation, or an outcome.

Day 0科学直觉与误区Intuition & myths
Days 1–7单比特基础Single-qubit foundations
Days 8–13干涉、纠缠、电路Interference, entanglement, circuits
Days 14–19算法骨架与资源Algorithms & resources
Days 20–21噪声与项目实践Noise & a project

14|先建立这五个不容易错的直觉14 | Five intuitions that will keep you out of trouble

  1. 先问态,再问答案。测量前,系统由什么状态描述?你准备施加什么操作?目标结果在哪个测量基里定义?Ask about the state before the answer. What state describes the system before measurement, what operation will you apply, and in which basis is the target defined?
  2. 概率看模平方,演化看振幅。不要在干涉发生之前把复数振幅提前转换成普通概率。Probabilities use squared magnitudes; evolution uses amplitudes. Do not convert complex amplitudes into ordinary probabilities before interference.
  3. 叠加不是免费并行输出。它提供可操作的多个分量,但你仍需要算法结构把有用信息汇到可测统计上。Superposition is not free parallel output. It gives manipulable components; an algorithm must still funnel useful information into measurable statistics.
  4. 纠缠是联合态结构,不是传讯通道。局部结果可随机,联合统计可高度相关,但不能单边发送可控消息。Entanglement is joint-state structure, not a messaging channel. Local results can be random and joint statistics strongly correlated, without controllable one-way signalling.
  5. 算法优势必须带着成本一起说。查询、门数、深度、shots、纠错资源、输入输出和经典后处理都属于计算成本。State the costs with the speedup. Queries, gates, depth, shots, error correction, input/output, and classical post-processing all count.

15|自测:用自己的话答,不急着背定义15 | Self-check: answer in your own words, not by memorizing definitions

问题 1:一个等幅量子叠加态是否意味着一次运行会同时输出 0 和 1?Question 1: Does an equal superposition mean one run outputs both 0 and 1?

不会。一次测量给出一个结果;重复运行才能估计概率分布。叠加的价值在于相干振幅能被门操作重组。

No. One measurement gives one result; repeated runs estimate a distribution. Superposition is useful because coherent amplitudes can be recombined by gates.

问题 2:两个态在计算基下都有 50/50 概率,它们一定相同吗?Question 2: If two states are both 50/50 in the computational basis, must they be identical?

不一定。例如正号和负号等幅叠加概率相同,但相对相位不同;加 H 门后会分别成为 |0⟩ 和 |1⟩。

No. The plus and minus states have the same probabilities but different relative phase. After H they become |0⟩ and |1⟩, respectively.

问题 3:为什么两条量子路径的振幅要先相加再平方?Question 3: Why do we add path amplitudes before squaring?

通向同一测量结果的振幅会相干叠加;交叉项包含相对相位,产生相长或相消。先平方各路会丢失这些项。

Amplitudes leading to the same outcome combine coherently. Cross terms contain relative phase and create constructive or destructive interference. Squaring each path first loses them.

问题 4:纠缠能不能拿来超光速传消息?Question 4: Can entanglement send a message faster than light?

不能。对方本地看到的仍是随机分布,只有双方通过经典渠道比较结果后才能确认关联。

No. The other party’s local results remain random. The correlation can be confirmed only after comparing results through a classical channel.

问题 5:量子算法声称快,至少应追问哪两件事?Question 5: What should you ask when a quantum algorithm claims a speedup?

它相对什么经典基线、在哪种输入/查询模型下改善哪种资源;以及真实硬件要多少逻辑比特、门、shots 和纠错成本。

Ask which classical baseline and input/query model it beats, which resource improves, and how many logical qubits, gates, shots, and error-correction resources real hardware needs.

读完 Day 0,正式从 Day 1 开始After Day 0, begin the formal course with Day 1

如果你现在能用自己的话解释“振幅不是概率”“叠加不是同时输出答案”“测量需要重复采样”,就已经具备进入正式课程的直觉基础。还不熟也没关系:Day 1 会从经典比特和量子比特的状态表示开始,逐步把这套语言落到具体向量;Day 2 再处理复数与概率,不要求一次记住所有术语。

If you can explain in your own words that amplitudes are not probabilities, superposition is not simultaneous output, and measurement needs repeated sampling, you have a useful starting intuition. If not, that is fine: Day 1 begins with state representations, and Day 2 develops complex numbers and probabilities step by step.

把 Day 0 当作一张地图,而不是考试。每次遇到一个新算法,都回到四个问题:状态怎么编码?门序列怎样演化它?哪一步发生干涉?测量最终能告诉我们什么?当你能把答案写成小规模算式、画成路径图,再用自然语言解释,就不再只是“听过量子计算”,而是在建立可以迁移的计算思维。

Treat Day 0 as a map, not an exam. For every new algorithm, return to four questions: How is the state encoded? How does the gate sequence evolve it? Where does interference occur? What can measurement finally tell us? When you can express the answer as a small calculation, a path diagram, and a plain-language explanation, you are building transferable computational intuition.

觉得好用?Found it useful?