|
| 1 | +\documentclass{beamer} |
| 2 | + |
| 3 | +\usetheme{Madrid} |
| 4 | +\usepackage{amsmath,amssymb} |
| 5 | +\usepackage{physics} |
| 6 | +\usepackage{listings} |
| 7 | +\usepackage{xcolor} |
| 8 | + |
| 9 | +% --------------------------- |
| 10 | +% Listings (Python) |
| 11 | +% --------------------------- |
| 12 | +\lstset{ |
| 13 | + language=Python, |
| 14 | + basicstyle=\ttfamily\small, |
| 15 | + keywordstyle=\color{blue}, |
| 16 | + commentstyle=\color{gray}, |
| 17 | + stringstyle=\color{purple}, |
| 18 | + showstringspaces=false, |
| 19 | + breaklines=true, |
| 20 | + frame=single, |
| 21 | + columns=fullflexible |
| 22 | +} |
| 23 | + |
| 24 | +\title{Entropy, Von Neumann Entropy, and Entanglement} |
| 25 | +\author{Lecture Notes + Worked Numerical Examples} |
| 26 | +\date{} |
| 27 | + |
| 28 | +\begin{document} |
| 29 | + |
| 30 | +%------------------------------------------------- |
| 31 | +\begin{frame} |
| 32 | +\titlepage |
| 33 | +\end{frame} |
| 34 | + |
| 35 | +%------------------------------------------------- |
| 36 | +\begin{frame}{Outline} |
| 37 | +\begin{enumerate} |
| 38 | + \item Shannon entropy (classical) and basic properties |
| 39 | + \item Density matrices and von Neumann entropy (quantum) |
| 40 | + \item Bell states and entanglement entropy |
| 41 | + \item Worked numerical examples (Python) |
| 42 | + \item Code slides: entropy computation and partial trace |
| 43 | +\end{enumerate} |
| 44 | +\end{frame} |
| 45 | + |
| 46 | +%================================================= |
| 47 | +\section{Classical entropy} |
| 48 | + |
| 49 | +\begin{frame}{Entropy: Basic Idea} |
| 50 | +\begin{itemize} |
| 51 | + \item Entropy quantifies \textbf{uncertainty} or \textbf{information content}. |
| 52 | + \item For a single event of probability $p$, the information content is |
| 53 | + \[ |
| 54 | + I(p) = -\log_2 p. |
| 55 | + \] |
| 56 | + \item Rare events ($p\to 0$) carry large information; certain events ($p=1$) carry zero information. |
| 57 | +\end{itemize} |
| 58 | +\end{frame} |
| 59 | + |
| 60 | +\begin{frame}{Shannon entropy} |
| 61 | +For a discrete random variable $X$ with outcomes $x$: |
| 62 | +\[ |
| 63 | +H(X) = -\sum_x p(x)\log_2 p(x). |
| 64 | +\] |
| 65 | + |
| 66 | +Binary entropy (outcomes with probabilities $p$ and $1-p$): |
| 67 | +\[ |
| 68 | +H_2(p) = -p\log_2 p - (1-p)\log_2(1-p). |
| 69 | +\] |
| 70 | + |
| 71 | +\begin{itemize} |
| 72 | + \item $H_2(0)=H_2(1)=0$ |
| 73 | + \item $H_2(1/2)=1$ bit (maximum uncertainty) |
| 74 | +\end{itemize} |
| 75 | +\end{frame} |
| 76 | + |
| 77 | +%================================================= |
| 78 | +\section{Quantum entropy} |
| 79 | + |
| 80 | +\begin{frame}{Density matrices} |
| 81 | +A quantum state can be: |
| 82 | +\begin{itemize} |
| 83 | + \item \textbf{Pure:} $\rho = \ket{\psi}\bra{\psi}$, with $\rho^2=\rho$ |
| 84 | + \item \textbf{Mixed:} $\rho=\sum_j p_j\ket{\psi_j}\bra{\psi_j}$, with $\rho^2\neq \rho$ |
| 85 | +\end{itemize} |
| 86 | + |
| 87 | +Properties: |
| 88 | +\[ |
| 89 | +\rho^\dagger=\rho,\quad \rho\succeq 0,\quad \Tr(\rho)=1. |
| 90 | +\] |
| 91 | +\end{frame} |
| 92 | + |
| 93 | +\begin{frame}{Von Neumann entropy} |
| 94 | +Quantum analogue of Shannon entropy: |
| 95 | +\[ |
| 96 | +S(\rho) = -\Tr\!\left(\rho \log_2 \rho\right). |
| 97 | +\] |
| 98 | + |
| 99 | +If $\rho$ has eigenvalues $\{\lambda_i\}$: |
| 100 | +\[ |
| 101 | +S(\rho)= -\sum_i \lambda_i \log_2 \lambda_i. |
| 102 | +\] |
| 103 | + |
| 104 | +\begin{itemize} |
| 105 | + \item Pure state $\Rightarrow \{\lambda\}=\{1,0,\dots\} \Rightarrow S(\rho)=0$ |
| 106 | + \item Maximally mixed in $d$ dimensions: $\rho=\frac{I_d}{d} \Rightarrow S(\rho)=\log_2 d$ |
| 107 | +\end{itemize} |
| 108 | +\end{frame} |
| 109 | + |
| 110 | +%================================================= |
| 111 | +\section{Bell states and entanglement entropy} |
| 112 | + |
| 113 | +\begin{frame}{Bell states (two qubits)} |
| 114 | +The four Bell states: |
| 115 | +\begin{align*} |
| 116 | +\ket{\Phi^+} &= \frac{1}{\sqrt{2}}(\ket{00}+\ket{11}), & |
| 117 | +\ket{\Phi^-} &= \frac{1}{\sqrt{2}}(\ket{00}-\ket{11}),\\ |
| 118 | +\ket{\Psi^+} &= \frac{1}{\sqrt{2}}(\ket{01}+\ket{10}), & |
| 119 | +\ket{\Psi^-} &= \frac{1}{\sqrt{2}}(\ket{01}-\ket{10}). |
| 120 | +\end{align*} |
| 121 | + |
| 122 | +They form an orthonormal basis of $\mathbb{C}^2\otimes \mathbb{C}^2$. |
| 123 | +\end{frame} |
| 124 | + |
| 125 | +\begin{frame}{Entanglement entropy for pure bipartite states} |
| 126 | +For a pure state $\ket{\psi}_{AB}$ with $\rho_{AB}=\ket{\psi}\bra{\psi}$, define reduced states: |
| 127 | +\[ |
| 128 | +\rho_A = \Tr_B(\rho_{AB}),\qquad \rho_B=\Tr_A(\rho_{AB}). |
| 129 | +\] |
| 130 | + |
| 131 | +\textbf{Entanglement entropy}: |
| 132 | +\[ |
| 133 | +S_A := S(\rho_A),\qquad S_B := S(\rho_B). |
| 134 | +\] |
| 135 | + |
| 136 | +For pure bipartite states: |
| 137 | +\[ |
| 138 | +S(\rho_A)=S(\rho_B). |
| 139 | +\] |
| 140 | +Moreover, $S(\rho_A)=0$ iff $\ket{\psi}$ is separable. |
| 141 | +\end{frame} |
| 142 | + |
| 143 | +\begin{frame}{Worked derivation: Bell state reduced density matrix} |
| 144 | +Take $\ket{\Phi^+}=\frac{1}{\sqrt{2}}(\ket{00}+\ket{11})$. |
| 145 | +Then |
| 146 | +\[ |
| 147 | +\rho_{AB}=\ket{\Phi^+}\bra{\Phi^+} |
| 148 | +=\frac{1}{2}\Big(\ket{00}\bra{00}+\ket{00}\bra{11}+\ket{11}\bra{00}+\ket{11}\bra{11}\Big). |
| 149 | +\] |
| 150 | + |
| 151 | +Partial trace over $B$ using $\Tr_B(\ket{ab}\bra{cd})=\braket{d}{b}\ket{a}\bra{c}$: |
| 152 | +\[ |
| 153 | +\rho_A=\Tr_B(\rho_{AB})=\frac{1}{2}\Big(\ket{0}\bra{0}+\ket{1}\bra{1}\Big)=\frac{I_2}{2}. |
| 154 | +\] |
| 155 | + |
| 156 | +Eigenvalues of $\rho_A$ are $\{1/2,1/2\}$, so |
| 157 | +\[ |
| 158 | +S(\rho_A)= -2\cdot\frac{1}{2}\log_2\left(\frac{1}{2}\right)=1~\text{bit}. |
| 159 | +\] |
| 160 | +Thus Bell states are \textbf{maximally entangled}. |
| 161 | +\end{frame} |
| 162 | + |
| 163 | +%================================================= |
| 164 | +\section{Worked numerical examples (Python)} |
| 165 | + |
| 166 | +\begin{frame}[fragile]{Numerical example 1: binary Shannon entropy curve} |
| 167 | +Compute $H_2(p)$ for representative $p$ values. |
| 168 | +\begin{lstlisting} |
| 169 | +import math |
| 170 | + |
| 171 | +def H2(p): |
| 172 | + eps = 1e-15 |
| 173 | + p = min(max(p, eps), 1.0-eps) |
| 174 | + return -p*math.log(p, 2) - (1-p)*math.log(1-p, 2) |
| 175 | + |
| 176 | +for p in [0.0, 0.1, 0.25, 0.5, 0.75, 0.9, 1.0]: |
| 177 | + # clamp for endpoints |
| 178 | + pp = min(max(p, 1e-15), 1-1e-15) |
| 179 | + print(p, H2(pp)) |
| 180 | +\end{lstlisting} |
| 181 | + |
| 182 | +\textbf{Check:} maximum near $p=0.5$, and near-zero for $p\approx 0$ or $1$. |
| 183 | +\end{frame} |
| 184 | + |
| 185 | +\begin{frame}[fragile]{Numerical example 2: von Neumann entropy from eigenvalues (2x2)} |
| 186 | +For a $2\times 2$ density matrix, eigenvalues can be computed analytically. |
| 187 | +\begin{lstlisting} |
| 188 | +import math, cmath |
| 189 | + |
| 190 | +def eigvals_2x2(rho): |
| 191 | + a, b = rho[0] |
| 192 | + c, d = rho[1] |
| 193 | + tr = a + d |
| 194 | + det = a*d - b*c |
| 195 | + disc = tr*tr - 4*det |
| 196 | + root = cmath.sqrt(disc) |
| 197 | + lam1 = 0.5*(tr + root) |
| 198 | + lam2 = 0.5*(tr - root) |
| 199 | + # return real parts (should be real for Hermitian rho) |
| 200 | + return [lam1.real, lam2.real] |
| 201 | + |
| 202 | +def S_vn_from_eigs(lams): |
| 203 | + S = 0.0 |
| 204 | + for lam in lams: |
| 205 | + lam = max(lam, 0.0) |
| 206 | + if lam > 1e-15: |
| 207 | + S -= lam*math.log(lam, 2) |
| 208 | + return S |
| 209 | + |
| 210 | +rhoA = [[0.5, 0.0], |
| 211 | + [0.0, 0.5]] |
| 212 | +print("eigvals:", eigvals_2x2(rhoA)) |
| 213 | +print("S(rhoA):", S_vn_from_eigs(eigvals_2x2(rhoA))) |
| 214 | +\end{lstlisting} |
| 215 | + |
| 216 | +For Bell-state reductions, you should get $S(\rho_A)=1$. |
| 217 | +\end{frame} |
| 218 | + |
| 219 | +\begin{frame}[fragile]{Code slide: build Bell states and compute entanglement entropy} |
| 220 | +We compute $\rho_A=\Tr_B(\rho_{AB})$ for Bell states and evaluate $S(\rho_A)$. |
| 221 | +\begin{lstlisting} |
| 222 | +import math |
| 223 | + |
| 224 | +def outer(v): |
| 225 | + n = len(v) |
| 226 | + return [[v[i]*v[j].conjugate() for j in range(n)] for i in range(n)] |
| 227 | + |
| 228 | +def partial_trace_B(rho): |
| 229 | + # 2 qubits, basis: |00>,|01>,|10>,|11> |
| 230 | + rhoA = [[0j, 0j],[0j, 0j]] |
| 231 | + for a in (0,1): |
| 232 | + for c in (0,1): |
| 233 | + s = 0j |
| 234 | + for b in (0,1): |
| 235 | + i = 2*a + b |
| 236 | + j = 2*c + b |
| 237 | + s += rho[i][j] |
| 238 | + rhoA[a][c] = s |
| 239 | + return rhoA |
| 240 | + |
| 241 | +# Bell states as length-4 vectors |
| 242 | +inv = 1/math.sqrt(2) |
| 243 | +Phi_plus = [inv, 0j, 0j, inv] |
| 244 | +Phi_minus = [inv, 0j, 0j, -inv] |
| 245 | +Psi_plus = [0j, inv, inv, 0j] |
| 246 | +Psi_minus = [0j, inv, -inv, 0j] |
| 247 | + |
| 248 | +for name, psi in [("Phi+", Phi_plus), ("Phi-", Phi_minus), |
| 249 | + ("Psi+", Psi_plus), ("Psi-", Psi_minus)]: |
| 250 | + rhoAB = outer(psi) |
| 251 | + rhoA = partial_trace_B(rhoAB) |
| 252 | + # convert to plain real for the eig solver |
| 253 | + rhoA_real = [[rhoA[0][0].real, rhoA[0][1].real], |
| 254 | + [rhoA[1][0].real, rhoA[1][1].real]] |
| 255 | + lams = eigvals_2x2(rhoA_real) |
| 256 | + print(name, "rhoA eigenvalues:", lams, "S(rhoA)=", S_vn_from_eigs(lams)) |
| 257 | +\end{lstlisting} |
| 258 | +Expected output: eigenvalues $(1/2,1/2)$ and entropy $1$ for all Bell states. |
| 259 | +\end{frame} |
| 260 | + |
| 261 | +\begin{frame}[fragile]{Numerical example 3: partially entangled state $\cos\theta|00\rangle+\sin\theta|11\rangle$} |
| 262 | +This illustrates how entanglement entropy varies continuously from 0 to 1. |
| 263 | +\begin{lstlisting} |
| 264 | +import math |
| 265 | + |
| 266 | +def psi_theta(theta): |
| 267 | + return [math.cos(theta), 0j, 0j, math.sin(theta)] |
| 268 | + |
| 269 | +print("theta S(rhoA)") |
| 270 | +for k in range(11): |
| 271 | + theta = (math.pi/2) * k/10 |
| 272 | + psi = psi_theta(theta) |
| 273 | + rhoAB = outer(psi) |
| 274 | + rhoA = partial_trace_B(rhoAB) |
| 275 | + rhoA_real = [[rhoA[0][0].real, rhoA[0][1].real], |
| 276 | + [rhoA[1][0].real, rhoA[1][1].real]] |
| 277 | + S = S_vn_from_eigs(eigvals_2x2(rhoA_real)) |
| 278 | + print(f"{theta:6.3f} {S:8.6f}") |
| 279 | +\end{lstlisting} |
| 280 | +Check: $S=0$ at $\theta=0$ and $\theta=\pi/2$, and $S=1$ at $\theta=\pi/4$. |
| 281 | +\end{frame} |
| 282 | + |
| 283 | +%================================================= |
| 284 | +\section{Optional: with NumPy (compact + scalable)} |
| 285 | + |
| 286 | +\begin{frame}[fragile]{Optional compact implementation using NumPy} |
| 287 | +If NumPy is allowed, computation becomes very compact: |
| 288 | +\begin{lstlisting} |
| 289 | +import numpy as np |
| 290 | + |
| 291 | +def vn_entropy(rho): |
| 292 | + # eigenvalues of Hermitian matrix |
| 293 | + w = np.linalg.eigvalsh(rho) |
| 294 | + w = np.maximum(w, 0.0) |
| 295 | + w = w[w > 1e-15] |
| 296 | + return -np.sum(w*np.log2(w)) |
| 297 | + |
| 298 | +# Bell state |Phi+> |
| 299 | +psi = np.array([1,0,0,1], dtype=complex)/np.sqrt(2) |
| 300 | +rhoAB = np.outer(psi, psi.conj()) |
| 301 | + |
| 302 | +# partial trace over B |
| 303 | +rhoA = np.zeros((2,2), dtype=complex) |
| 304 | +for a in [0,1]: |
| 305 | + for c in [0,1]: |
| 306 | + for b in [0,1]: |
| 307 | + rhoA[a,c] += rhoAB[2*a+b, 2*c+b] |
| 308 | + |
| 309 | +print(vn_entropy(rhoA)) # should print 1.0 |
| 310 | +\end{lstlisting} |
| 311 | +\end{frame} |
| 312 | + |
| 313 | +%================================================= |
| 314 | +\section{Summary} |
| 315 | + |
| 316 | +\begin{frame}{Summary} |
| 317 | +\begin{itemize} |
| 318 | + \item Shannon entropy $H(X)$ measures classical uncertainty. |
| 319 | + \item Von Neumann entropy $S(\rho)$ measures quantum mixedness. |
| 320 | + \item For a pure bipartite state, $S(\rho_A)$ quantifies \textbf{entanglement}. |
| 321 | + \item Bell states have reduced density matrix $\rho_A=I/2$ and entanglement entropy $S=1$ bit. |
| 322 | + \item Python examples confirm theory and give templates for larger simulations. |
| 323 | +\end{itemize} |
| 324 | +\end{frame} |
| 325 | + |
| 326 | +\end{document} |
0 commit comments