Modes, Occupation Lists, and Assumptions

An occupation list
{
n
1
,
n
2
,…,
n
m
}
records the photon count in each of the
m
modes, with one entry per mode. Here, each input or output mode corresponds to a port of the optical network. An input occupation list specifies how many photons enter each input port; an output occupation list specifies how many photons are detected at each output port. The occupation list
{
n
1
,
n
2
,…,
n
m
}
labels the Fock state
|
n
1
,
n
2
,…,
n
m
〉
.
A collision-free input or output occupation list has at most one photon per mode. For example,
{1,0,1}
describes two photons, one in mode 1 and one in mode 3.
We will follow two photons through a beam splitter, derive the normalized permanent amplitude, compare ways of computing it, and examine what this says about classical sampling. Computing one amplitude, collecting every probability, and drawing one sample are different tasks; keeping them separate is essential to the hardness argument.
The examples assume a passive lossless network and number-resolving detectors. The photons may enter different ports, but their internal wave packets must match in arrival time, spectrum, polarization, and unresolved spatial structure to interfere fully. Partial distinguishability reduces that interference. Loss changes the detected photon-number sectors, while threshold detectors merge different occupation lists into the same click pattern; neither alone makes the photons distinguishable.
Load QuantumFramework and its second-quantization tools, then evaluate the cells in order:
In[]:=
Needs["Wolfram`QuantumFramework`"];​​Needs["Wolfram`QuantumFramework`SecondQuantization`"];
Let's start!

Two-Photon Interference at a Beam Splitter

Start with the smallest interesting case: two identical photons, one into each port of a single balanced beam splitter. A balanced beam splitter sends each incoming photon out either side with equal probability, so a classical intuition says the two photons land on the same side half the time and on opposite sides half the time. The quantum answer is stranger: the two photons never come out on opposite sides. They always leave together. In other words, the output occupation list
{1,1}
, one photon in each output mode, has probability zero. This is the Hong-Ou-Mandel effect, and it is the whole subject in miniature.
Build a two-mode interferometer that is a single balanced beam splitter (the angle
θ=π/4
makes the reflection and transmission amplitudes equal in size):
In[]:=
qbs=QuantumInterferometer[{"BS"[π/4,0]->{1,2}},2]
Out[]=
QuantumInterferometer
Modes: 2
Method: None
Beam splitters: 1
Depth: 1

Draw it, so we can see the one element the photons meet:
In[]:=
qbs["Diagram"]
Out[]=
Everything a passive network of
m
modes does to a single photon is held in one
m×m
matrix
W
, its transfer matrix: the entry
W
jk
is the amplitude for a photon entering port
k
to leave port
j
. For the beam splitter
m=2
, and we store its matrix as
Wbs
.
Read the transfer matrix:
In[]:=
Wbs=qbs["TransferMatrix"];​​Wbs//MatrixForm
Out[]//MatrixForm=
1
2
-
1
2
1
2
1
2
As one can see, the four entries are equal in magnitude but not in sign: one of them carries a minus. That sign is not decoration. It is the seed of the interference, and we are about to watch it cancel an entire outcome.
Ask
QuantumInterferometer
for the full distribution over output occupation lists when one photon enters each port, giving the input occupation list
{1,1}
:
In[]:=
qbs["Probabilities",{1,1}]
Out[]=
20
1
2
,110,02
1
2

As one can see, the output occupation list
{1,1}
has probability zero, while the two bunched output occupation lists
{2,0}
and
{0,2}
split the probability between them. The photons leave together, every time. The next question is where that zero comes from, and the cleanest way to see it is to compute the same three numbers for three different kinds of particle and read them side by side.

Occupation Lists and the Permanent Formula

To compare the three particle types, we need the permanent of a square matrix. It is defined like the determinant, as a sum over all ways of pairing rows with columns, except that every term is added with a plus sign where the determinant alternates the signs.
The probability helpers below assume valid input and output occupation lists with the same positive total photon count.
Define a helper,
modeList
, that converts an input or output occupation list into a mode assignment list: a list containing the mode label once for each photon in that mode. Replace each count
n
j
with
n
j
copies of the mode label
j
, then join the groups into one list. For example,
{2,0,1}⟶{{1,1},{},{3}}⟶{1,1,3}.
The occupation list has one entry per mode; the mode assignment list has one entry per photon. These entries are bookkeeping for the occupied modes and do not make the photons distinguishable.
In[]:=
ClearAll[modeList];​​modeList[occ_List]:=Catenate@MapIndexed[ConstantArray[First[#2],#1]&,occ]
Name the three output occupation lists we are comparing:
In[]:=
outs={{2,0},{1,1},{0,2}};
For indistinguishable bosons, let
S={
s
1
,…,
s
m
}
and
T={
t
1
,…,
t
m
}
be the input and output occupation lists, with
∑
k
s
k
=
∑
j
t
j
=n
, since a passive lossless network neither creates nor destroys photons. Define
bosonProb
to compute the probability of observing
T
given
S
and the transfer matrix:
In[]:=
ClearAll[bosonProb];​​bosonProb[w_,s_,t_]:=Abs[Permanent[w[[modeList[t],modeList[s]]]]]^2/Times@@Factorial[Join[s,t]]
To unpack this calculation, start with the device's transfer matrix
W
, whose entries are single-photon amplitudes. The input mode assignment list selects columns, and the output mode assignment list selects rows: repeat column
k
s
k
times and row
j
t
j
times. Call the resulting
n×n
matrix
M=
W
T,S
.
Each column of
M
represents an incoming photon, and each row an outgoing detection. A complete connection between them uses every row and column once. Because the photons do not interact, its contribution is the product of the corresponding single-photon amplitudes. For example, one contribution is
M
11
M
22
⋯
M
nn
.
Identical bosons require us to add these contributions with no extra exchange signs. Summing over all
n!
permutations
σ
of the columns gives precisely the permanent:
Per(M)=
∑
σ
n
∏
a=1
M
a,σ(a)
.
Normalizing the input and output Fock states then gives the amplitude:
A(T←S)=
Per(M)
∏
k
s
k
!
∏
j
t
j
!
.
The factorials account for the normalization of states with multiple photons in the same mode. To obtain the probability, take the squared magnitude of the amplitude:
P(TS)=
2
A(T←S)
=
2
Per(M)
∏
k
s
k
!
∏
j
t
j
!
.
This is what
bosonProb
evaluates:
Abs[...]^2
takes the squared magnitude of the permanent, and
Times@@Factorial[Join[s,t]]
multiplies the factorials of all input and output occupation counts.

Comparing Particle Statistics

For classical distinguishable particles the amplitudes never interfere. Each photon crosses the network on its own, leaving input mode
k
for output mode
j
with probability
2
W
jk
, so the probability of an output occupation list is the permanent of the block of entrywise squared magnitudes
2
W
T,S
, selected by the same repeated rows and columns, divided only by the output factorials:
P
dist
(TS)=
Per
2
W
T,S

∏
j
t
j
!
The permanent counts each assignment of photons to output modes
∏
j
t
j
!
times, once for every way of matching the photons in mode
j
to the
t
j
copies of row
j
, and the output factorials remove that overcount. There is no
s
k
!
, because photons that start in the same mode are still different particles. Define that:
In[]:=
ClearAll[distProb];​​distProb[w_,s_,t_]:=Permanent[(Abs[w]^2)[[modeList[t],modeList[s]]]]/Times@@Factorial[t]
For indistinguishable noninteracting fermions, odd permutations contribute a minus sign, giving a determinant. A valid input occupation list has only zero-or-one counts; output collisions have probability zero, and the definition returns that zero directly instead of relying on a numerically computed determinant of a matrix with a repeated row. Define the probability for such inputs:
In[]:=
ClearAll[fermionProb];​​fermionProb[w_,s_,t_]:=If[Max[t]>1,0,Abs[Det[w[[modeList[t],modeList[s]]]]]^2]
Put the three particle types in one table, with one row per output occupation list:
In[]:=
Grid[​​Join[​​{Style[#,Bold]&/@{"output","indistinguishable bosons","distinguishable bosons","indistinguishable fermions"}},​​Table[Prepend[Through[{bosonProb,distProb,fermionProb}[Wbs,{1,1},t]],Row[{"|",Row[t,","],"〉"}]],{t,outs}]],​​Frame->All,Spacings->{2,1}]
Out[]=
output
indistinguishable bosons
distinguishable bosons
indistinguishable fermions
|2,0〉
1
2
1
4
0
|1,1〉
0
1
2
1
|0,2〉
1
2
1
4
0
The distinguishable probabilities are a quarter, a half, a quarter. Bosonic coincidence vanishes because its two contributions are
+
1
2
and
-
1
2
: positive exchange coefficients do not prevent destructive interference between signed optical amplitudes. Fermions instead leave one particle in each output mode with certainty. A bunched output repeats a matrix row, making its determinant zero, as required by Pauli exclusion.
Check the coincidence amplitude at a variable beam-splitter angle:
In[]:=
ClearAll[θ];​​With[{splitter=QuantumInterferometer[{"BS"[θ,0]->{1,2}},2]},​​FullSimplify[splitter["Amplitude",{1,1}->{1,1}]==Cos[2θ],​​θ∈Reals]​​]
Out[]=
True
At
θ=0
this amplitude is one, restoring the input; at
θ=π/4
it vanishes. We can now derive the amplitude for an arbitrary passive network.

Many-Photon Amplitudes as Normalized Permanents

The same amplitude formula follows directly from how a passive network acts on the creation operators. Each network sends the operator that creates a photon in input port
k
to a superposition over the outputs,
†
a
k

∑
j
W
jk
†
a
j
.
Take an input occupation list
S={
s
1
,…,
s
m
}
, with
s
k
photons entering port
k
and
n=
∑
k
s
k
photons in total. Its Fock state is
|S〉=
∏
k
s
k

†
a
k

s
k
!
|0〉
. Substituting the transformed operator for every
†
a
k
and expanding the product gives
Build a random five-mode interferometer with a fixed seed, so the run is reproducible:
Draw the mesh the photons will cross:
Read its transfer matrix:
Confirm it equals the permanent of the matrix selected by the same input and output occupation lists:
Check the amplitude against the normalized permanent:

Computing and Checking the Full Output Distribution

Show the five most likely output occupation lists:
Confirm the distribution has exactly that many entries:
Verify the probabilities independently as well:

The Cost of One Amplitude

For six photons in 12 modes, the three input occupation lists are:
Display the input occupation lists for six photons:
Use the same network for all three occupation patterns and keep their names as association keys:
Use photon counts up to 24 for the plot; shorten the list for a quicker run:
Run the benchmark, indexing the results first by photon count and then by occupation pattern:
Plot the cost of one QI amplitude:

From Amplitude Cost to Sampling Hardness

A hard probability calculation does not by itself establish hard sampling. A sampler can avoid constructing the full distribution, and even a distribution written using permanents may admit easy samples.
This verifies the normalized single-photon distributions used by that sampler, without evaluating any permanent.
The hiding step is where the original argument needs a dilute regime, with many more modes than photons: only then does a small block of a random network look like a matrix of independent Gaussian entries. That is not a universal restriction: later work extends hardness evidence to a linear number of modes, where collisions are common (Bouland et al., 2026).

Summary and Next Questions

We have connected two-photon interference to normalized permanent amplitudes, checked those amplitudes and probabilities against an independent coefficient calculation, measured how photon count and occupation structure affect QI amplitude calculations, and drawn samples in which bosonic bunching is visible directly. The computations explain the optical probabilities; the cited complexity results supply the separate, conditional argument about classical sampling.
The next questions concern partial distinguishability, loss, and detector resolution, each of which changes the experiment differently. Replacing single-photon inputs by squeezed vacuum leads to Gaussian boson sampling, where hafnians take the role played here by permanents.

CITE THIS NOTEBOOK

Why boson sampling is hard: Matrix permanents, multi-photon interference, and classical complexity​
by Mads Bahrami​
Wolfram Community, STAFF PICKS, November 2, 2026
​https://community.wolfram.com/t/28486