# The magic square

## Me

The Mermin-Peres magic square is a neat demonstration of measurement contextuality.

### 1 The magic square

Consider the following collection of nine observables:

 $$c_{1}$$ $$c_{2}$$ $$c_{3}$$ $$r_{1}$$ $$X\otimes I$$ $$I \otimes X$$ $$X \otimes X$$ $$r_{2}$$ $$I\otimes Z$$ $$Z \otimes I$$ $$Z \otimes Z$$ $$r_{3}$$ $$-X\otimes Z$$ $$-Z \otimes X$$ $$Y \otimes Y$$

where $$I$$ is the 2-dimensional identity, and $$X$$, $$Y$$, and $$Z$$ are the the Pauli matrices.

The first thing to note is that any pair of observables taken from the same row or the same column commute. For the first two rows and two columns this is trivial to see, because identity commutes with everything, an operator commutes with itself, and the square of a Pauli matrix is the identity. For the last column and row we can use the algebra of Pauli matrices, e.g.

\begin{align*}[X \otimes X,Z \otimes Z] &= XZ \otimes XZ - ZX \otimes ZX\\ &= (-iY) \otimes (-iY) - (iY) \otimes (iY)\\ &= - Y \otimes Y + Y \otimes Y\\ &= 0.\end{align*}

### 2 Measuring the observables

An observable $$A$$ is a self-adjoint operator, so it has a spectral decomposition which we can write as

$A = \sum_a a \mathbb{P}_a$
where $$a$$ ranges over distinct eigenvalues, and $$\mathbb{P}_a$$ is a projector onto the corresponding eigenspace.

Recall the measurement postulate: if we measure $$A$$ on a system in state $$\rho$$ we will obtain result $$a$$ with probability $$p(a)=\mathrm{Tr}(\mathbb{P}_a \rho)$$, and on getting result $$a$$ the system is projected into the state $$\rho_a = \mathbb{P}_a \rho \mathbb{P}_a / p(a)$$.

First let’s expand each observable in the table in its own eigenbasis:

 $$c_{1}$$ $$c_{2}$$ $$c_{3}$$ $$r_{1}$$ $$\mathbb{P}_{+I}-\mathbb{P}_{-I}$$ $$\mathbb{P}_{I+}-\mathbb{P}_{I-}$$ $$(\mathbb{P}_{++}+\mathbb{P}_{-{}-})-(\mathbb{P}_{+-}+\mathbb{P}_{-+})$$ $$r_{2}$$ $$\mathbb{P}_{I0}-\mathbb{P}_{I1}$$ $$\mathbb{P}_{0I}-\mathbb{P}_{1I}$$ $$(\mathbb{P}_{00}+\mathbb{P}_{11})-(\mathbb{P}_{01}+\mathbb{P}_{10})$$ $$r_{3}$$ $$(\mathbb{P}_{+1}+\mathbb{P}_{-0})-(\mathbb{P}_{+0}+\mathbb{P}_{-1})$$ $$(\mathbb{P}_{1+}+\mathbb{P}_{0-})-(\mathbb{P}_{0+}+\mathbb{P}_{1-})$$ $$(|\phi^-\rangle\langle \phi^-|+|\psi^+\rangle\langle \psi^+|)-(|\phi^+\rangle\langle \phi^+|+|\psi^-\rangle\langle \psi^-|$$

In the table most of the projectors are represented with the compact notation $$\mathbb{P}_{j\bullet}=|j\rangle\langle j|\otimes \bullet$$, $$\mathbb{P}_{I\bullet}=I\otimes \bullet$$, and similarly for the second system, so that $$\mathbb{P}_{I+}=I\otimes |+\rangle\langle +|$$ etc. The states in the projectors in the bottom right cell are the Bell states:

\begin{align*}|\phi^\pm\rangle &= (|00\rangle\pm|11\rangle)/\sqrt{2} \\ |\psi^\pm\rangle &= (|01\rangle\pm|10\rangle)/\sqrt{2}.\end{align*}

Take a moment to verify a few of the spectral decompositions for yourself.

We can now easily calculate the result of measuring a given observable. e.g. measuring $$(r_2,c_2)$$ we would get either result +1 and end up in state $$\mathbb{P}_{0I}\rho\mathbb{P}_{0I}/p(+1)$$, or get -1 and end up in state $$\mathbb{P}_{1I}\rho\mathbb{P}_{1I}/p(-1)$$.

### 3 Measuring a row or column

What makes the magic square magic is the way the results of measurements are correlated.

Imagine measuring the observables in the first row, and say we obtain the results +1 for $$c_1$$ and -1 for $$c_2$$, so that if we started with state $$\rho$$, we end up with with state (up to normalisation)

$\rho' \propto \mathbb{P}_{I-}\mathbb{P}_{+I}\rho\mathbb{P}_{+I}\mathbb{P}_{I-} = \mathbb{P}_{+-}\rho\mathbb{P}_{+-}.$

If we now measure the last observable in column $$c_3$$ we have to obtain result -1 as every eigenspace projector is orthogonal except for $$\mathbb{P}_{+-}$$ which is a projector into the eigenspace of the -1 eigenvalue. The product of the results is then $$(1)\times(-1)\times(-1) = 1$$.

By inspection you can now verify that every combination of possible (i.e. non-zero probability) results multiplies to 1. You can also easily verify that this is true regardless of the order in which you measure the observables in that row, and that the product of results for $$r_2$$ is also 1. Similarly the product of results for columns $$c_1$$ or $$c_2$$ is -1. The only tricky sets are the last row and column. That last row and column can be verified by brute force calculation, and it will show that the product of results for the row is +1 and the column is -1.

Notice that these correlations between the measurement results are independent of the state of the system.

### 4 The magic

Imagine that each cell of the table had a predefined value and the measurement ‘uncovers’ either a +1 or -1 value.

Since the product of values for a row is +1, that means that there must be an even number of -1’s in any row. The sum of three even numbers is even, so overall there must be an even number of -1’s in the whole table.

However, the product of values for a column is -1, meaning an odd number of -1’s in each column, and the sum of three odd numbers is odd so there has to be an odd number of -1’s in the whole table. A contradiction.

This illustrates the contextuality of measurements, something that is assumed not to be true in classical physics.

© Copyright 2022 Alexei Gilchrist